diff options
author | Sandeep Somavarapu <sasomava@microsoft.com> | 2018-03-06 12:24:03 +0300 |
---|---|---|
committer | Sandeep Somavarapu <sasomava@microsoft.com> | 2018-03-06 12:24:03 +0300 |
commit | 1035348c4f9128ca9b982ba722913e81e52f2d42 (patch) | |
tree | 96ce267906e73fad5b28683dd8f756d964fa3f1d | |
parent | b30b2c56249c8fc6595862533decc9cb77fdd1fc (diff) |
Fix #44104
-rw-r--r-- | src/vs/workbench/parts/extensions/browser/extensionsActions.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/vs/workbench/parts/extensions/browser/extensionsActions.ts b/src/vs/workbench/parts/extensions/browser/extensionsActions.ts index 6e300d32eed..9f3465b4ac5 100644 --- a/src/vs/workbench/parts/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/parts/extensions/browser/extensionsActions.ts @@ -17,7 +17,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle'; import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewlet, AutoUpdateConfigurationKey } from 'vs/workbench/parts/extensions/common/extensions'; import { ExtensionsConfigurationInitialContent } from 'vs/workbench/parts/extensions/common/extensionsFileTemplate'; -import { LocalExtensionType, IExtensionEnablementService, IExtensionTipsService, EnablementState, ExtensionsLabel } from 'vs/platform/extensionManagement/common/extensionManagement'; +import { LocalExtensionType, IExtensionEnablementService, IExtensionTipsService, EnablementState, ExtensionsLabel, IExtensionIdentifier } from 'vs/platform/extensionManagement/common/extensionManagement'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ToggleViewletAction } from 'vs/workbench/browser/viewlet'; @@ -916,17 +916,17 @@ export class ReloadAction extends Action { if (state === ExtensionState.Installing || state === ExtensionState.Uninstalling) { return TPromise.wrap<void>(null); } - return this.extensionService.getExtensions() - .then(runningExtensions => this.computeReloadState(runningExtensions)); + return TPromise.join([this.extensionService.getExtensions(), this.extensionEnablementService.getDisabledExtensions()]) + .then(([runningExtensions, disabledExtensions]) => this.computeReloadState(runningExtensions, disabledExtensions)); }).done(() => { this.class = this.enabled ? ReloadAction.EnabledClass : ReloadAction.DisabledClass; }); } - private computeReloadState(runningExtensions: IExtensionDescription[]): void { + private computeReloadState(runningExtensions: IExtensionDescription[], disabledExtensions: IExtensionIdentifier[]): void { const isInstalled = this.extensionsWorkbenchService.local.some(e => e.id === this.extension.id); const isUninstalled = this.extension.state === ExtensionState.Uninstalled; - const isDisabled = !this.extensionEnablementService.isEnabled({ id: this.extension.id, uuid: this.extension.uuid }); + const isDisabled = this.isDisabled(disabledExtensions); const filteredExtensions = runningExtensions.filter(e => areSameExtensions(e, this.extension)); const isExtensionRunning = filteredExtensions.length > 0; @@ -968,6 +968,14 @@ export class ReloadAction extends Action { } } + private isDisabled(disabledExtensions: IExtensionIdentifier[]): boolean { + const identifier = { id: this.extension.id, uuid: this.extension.uuid }; + if (this.extension.type === LocalExtensionType.System) { + return disabledExtensions.some(d => areSameExtensions(d, identifier)); + } + return !this.extensionEnablementService.isEnabled({ id: this.extension.id, uuid: this.extension.uuid }); + } + run(): TPromise<any> { return this.windowService.reloadWindow(); } |