diff --git a/src/vs/workbench/services/extensions/browser/extensionService.ts b/src/vs/workbench/services/extensions/browser/extensionService.ts index a181772e..55d2ef34 100644 --- a/src/vs/workbench/services/extensions/browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/browser/extensionService.ts @@ -41,9 +41,16 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA import { IRemoteExplorerService } from 'vs/workbench/services/remote/common/remoteExplorerService'; import { IUserDataInitializationService } from 'vs/workbench/services/userData/browser/userDataInit'; import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; +import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; + +const HasInstalledExtDependencyExtensionContext = new RawContextKey('hasExtDependency', false); +const HasInstalledOfflineExtManagerExtensionContext = new RawContextKey('hasOfflineExtManager', false); +const HasInstalledProjectManagerExtensionContext = new RawContextKey('hasProjectManager', false); export class ExtensionService extends AbstractExtensionService implements IExtensionService { - + private HasInstalledExtDependencyExtensionContextKey: IContextKey; + private HasInstalledOfflineExtManagerExtensionContextKey: IContextKey; + private HasInstalledProjectManagerExtensionContextKey: IContextKey; constructor( @IInstantiationService instantiationService: IInstantiationService, @INotificationService notificationService: INotificationService, @@ -67,6 +74,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten @IWorkspaceTrustManagementService private readonly _workspaceTrustManagementService: IWorkspaceTrustManagementService, @IRemoteExplorerService private readonly _remoteExplorerService: IRemoteExplorerService, @IDialogService dialogService: IDialogService, + @IContextKeyService contextKeyService: IContextKeyService, ) { const extensionsProposedApi = instantiationService.createInstance(ExtensionsProposedApi); const extensionHostFactory = new BrowserExtensionHostFactory( @@ -79,6 +87,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten extensionEnablementService, logService ); + super( extensionsProposedApi, extensionHostFactory, @@ -101,7 +110,9 @@ export class ExtensionService extends AbstractExtensionService implements IExten remoteAuthorityResolverService, dialogService ); - + this.HasInstalledExtDependencyExtensionContextKey = HasInstalledExtDependencyExtensionContext.bindTo(contextKeyService); + this.HasInstalledOfflineExtManagerExtensionContextKey = HasInstalledOfflineExtManagerExtensionContext.bindTo(contextKeyService); + this.HasInstalledProjectManagerExtensionContextKey = HasInstalledProjectManagerExtensionContext.bindTo(contextKeyService); // Initialize installed extensions first and do it only after workbench is ready lifecycleService.when(LifecyclePhase.Ready).then(async () => { await this._userDataInitializationService.initializeInstalledExtensions(this._instantiationService); @@ -149,7 +160,15 @@ export class ExtensionService extends AbstractExtensionService implements IExten this._scanWebExtensions(), this._remoteExtensionsScannerService.scanExtensions() ]); - + remoteExtensions.forEach(extension => { + if (extension.identifier.value === 'KylinIDETeam.extension-dependency') { + this.HasInstalledExtDependencyExtensionContextKey.set(true); + } else if (extension.identifier.value === 'KylinIDETeam.offline-extensions-manager') { + this.HasInstalledOfflineExtManagerExtensionContextKey.set(true); + } else if (extension.identifier.value === 'KylinIDETeam.project-manager') { + this.HasInstalledProjectManagerExtensionContextKey.set(true); + } + }); return new ResolvedExtensions(localExtensions, remoteExtensions, /*hasLocalProcess*/false, /*allowRemoteExtensionsInLocalWebWorker*/true); }