mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 718331d6f3ebd1b571530ab499edb266ddd493d5
This commit is contained in:
@@ -19,6 +19,8 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { StorageManager } from 'vs/platform/extensionManagement/common/extensionEnablementService';
|
||||
|
||||
const SOURCE = 'IWorkbenchExtensionEnablementService';
|
||||
|
||||
export class ExtensionEnablementService extends Disposable implements IWorkbenchExtensionEnablementService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
@@ -40,7 +42,7 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
|
||||
) {
|
||||
super();
|
||||
this.storageManger = this._register(new StorageManager(storageService));
|
||||
this._register(this.globalExtensionEnablementService.onDidChangeEnablement(extensions => this.onDidChangeExtensions(extensions)));
|
||||
this._register(this.globalExtensionEnablementService.onDidChangeEnablement(({ extensions, source }) => this.onDidChangeExtensions(extensions, source)));
|
||||
this._register(extensionManagementService.onDidUninstallExtension(this._onDidUninstallExtension, this));
|
||||
}
|
||||
|
||||
@@ -169,13 +171,13 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
|
||||
private _enableExtension(identifier: IExtensionIdentifier): Promise<boolean> {
|
||||
this._removeFromWorkspaceDisabledExtensions(identifier);
|
||||
this._removeFromWorkspaceEnabledExtensions(identifier);
|
||||
return this.globalExtensionEnablementService.enableExtension(identifier);
|
||||
return this.globalExtensionEnablementService.enableExtension(identifier, SOURCE);
|
||||
}
|
||||
|
||||
private _disableExtension(identifier: IExtensionIdentifier): Promise<boolean> {
|
||||
this._removeFromWorkspaceDisabledExtensions(identifier);
|
||||
this._removeFromWorkspaceEnabledExtensions(identifier);
|
||||
return this.globalExtensionEnablementService.disableExtension(identifier);
|
||||
return this.globalExtensionEnablementService.disableExtension(identifier, SOURCE);
|
||||
}
|
||||
|
||||
private _enableExtensionInWorkspace(identifier: IExtensionIdentifier): void {
|
||||
@@ -273,10 +275,12 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
|
||||
this.storageManger.set(storageId, extensions, StorageScope.WORKSPACE);
|
||||
}
|
||||
|
||||
private async onDidChangeExtensions(extensionIdentifiers: ReadonlyArray<IExtensionIdentifier>): Promise<void> {
|
||||
const installedExtensions = await this.extensionManagementService.getInstalled();
|
||||
const extensions = installedExtensions.filter(installedExtension => extensionIdentifiers.some(identifier => areSameExtensions(identifier, installedExtension.identifier)));
|
||||
this._onEnablementChanged.fire(extensions);
|
||||
private async onDidChangeExtensions(extensionIdentifiers: ReadonlyArray<IExtensionIdentifier>, source?: string): Promise<void> {
|
||||
if (source !== SOURCE) {
|
||||
const installedExtensions = await this.extensionManagementService.getInstalled();
|
||||
const extensions = installedExtensions.filter(installedExtension => extensionIdentifiers.some(identifier => areSameExtensions(identifier, installedExtension.identifier)));
|
||||
this._onEnablementChanged.fire(extensions);
|
||||
}
|
||||
}
|
||||
|
||||
private _onDidUninstallExtension({ identifier, error }: DidUninstallExtensionEvent): void {
|
||||
|
||||
@@ -28,7 +28,8 @@ export class ExtensionManagementServerService implements IExtensionManagementSer
|
||||
if (remoteAgentConnection) {
|
||||
const extensionManagementService = new ExtensionManagementChannelClient(remoteAgentConnection!.getChannel<IChannel>('extensions'));
|
||||
this.remoteExtensionManagementServer = {
|
||||
authority: remoteAgentConnection.remoteAuthority, extensionManagementService,
|
||||
authority: remoteAgentConnection.remoteAuthority,
|
||||
extensionManagementService,
|
||||
get label() { return labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); }
|
||||
};
|
||||
}
|
||||
@@ -42,4 +43,4 @@ export class ExtensionManagementServerService implements IExtensionManagementSer
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IExtensionManagementServerService, ExtensionManagementServerService);
|
||||
registerSingleton(IExtensionManagementServerService, ExtensionManagementServerService);
|
||||
|
||||
@@ -46,7 +46,8 @@ export class ExtensionManagementServerService implements IExtensionManagementSer
|
||||
if (remoteAgentConnection) {
|
||||
const extensionManagementService = new RemoteExtensionManagementChannelClient(remoteAgentConnection.getChannel<IChannel>('extensions'), this.localExtensionManagementServer.extensionManagementService, galleryService, logService, configurationService, productService);
|
||||
this.remoteExtensionManagementServer = {
|
||||
authority: remoteAgentConnection.remoteAuthority, extensionManagementService,
|
||||
authority: remoteAgentConnection.remoteAuthority,
|
||||
extensionManagementService,
|
||||
get label() { return labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import { Schemas } from 'vs/base/common/network';
|
||||
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { productService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { productService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { GlobalExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionEnablementService';
|
||||
|
||||
function createStorageService(instantiationService: TestInstantiationService): IStorageService {
|
||||
Reference in New Issue
Block a user