diff options
author | Sandeep Somavarapu <sasomava@microsoft.com> | 2021-07-01 17:15:27 +0300 |
---|---|---|
committer | Sandeep Somavarapu <sasomava@microsoft.com> | 2021-07-01 17:15:42 +0300 |
commit | b69eb3926488e0a21df05013919e232fcc749958 (patch) | |
tree | e32df856b23267cfb2d8ff8208641353df2003c7 /src/vs/workbench/contrib/extensions/common | |
parent | ec6919acfa636e24f20d3c2ab1d37935a635c1e6 (diff) |
update extension input on extension change
Diffstat (limited to 'src/vs/workbench/contrib/extensions/common')
-rw-r--r-- | src/vs/workbench/contrib/extensions/common/extensionsInput.ts | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/vs/workbench/contrib/extensions/common/extensionsInput.ts b/src/vs/workbench/contrib/extensions/common/extensionsInput.ts index 9806baaee18..0559dc75e16 100644 --- a/src/vs/workbench/contrib/extensions/common/extensionsInput.ts +++ b/src/vs/workbench/contrib/extensions/common/extensionsInput.ts @@ -8,9 +8,10 @@ import { URI } from 'vs/base/common/uri'; import { localize } from 'vs/nls'; import { EditorInputCapabilities, IEditorInput, IUntypedEditorInput } from 'vs/workbench/common/editor'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; -import { IExtension } from 'vs/workbench/contrib/extensions/common/extensions'; +import { IExtension, IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { join } from 'vs/base/common/path'; + export class ExtensionsInput extends EditorInput { static readonly ID = 'workbench.extensions.input2'; @@ -26,18 +27,26 @@ export class ExtensionsInput extends EditorInput { override get resource() { return URI.from({ scheme: Schemas.extension, - path: join(this.extension.identifier.id, 'extension') + path: join(this._extension.identifier.id, 'extension') }); } constructor( - public readonly extension: IExtension + private _extension: IExtension, + @IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService ) { super(); + this._register(extensionsWorkbenchService.onChange(extension => { + if (extension && areSameExtensions(this._extension.identifier, extension.identifier)) { + this._extension = extension; + } + })); } + get extension(): IExtension { return this._extension; } + override getName(): string { - return localize('extensionsInputName', "Extension: {0}", this.extension.displayName); + return localize('extensionsInputName', "Extension: {0}", this._extension.displayName); } override matches(other: IEditorInput | IUntypedEditorInput): boolean { @@ -45,6 +54,6 @@ export class ExtensionsInput extends EditorInput { return true; } - return other instanceof ExtensionsInput && areSameExtensions(this.extension.identifier, other.extension.identifier); + return other instanceof ExtensionsInput && areSameExtensions(this._extension.identifier, other._extension.identifier); } } |