From 6e46f926fe44e29db8b9b138c1a2e30e7e651489 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 23 Aug 2021 15:40:49 +0200 Subject: [PATCH] action to open installed web extensions resource --- .../common/webExtensionsScannerService.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/vs/workbench/services/extensionManagement/common/webExtensionsScannerService.ts b/src/vs/workbench/services/extensionManagement/common/webExtensionsScannerService.ts index c1dbd2693c4..84e0fcf45f9 100644 --- a/src/vs/workbench/services/extensionManagement/common/webExtensionsScannerService.ts +++ b/src/vs/workbench/services/extensionManagement/common/webExtensionsScannerService.ts @@ -29,6 +29,11 @@ import { format2 } from 'vs/base/common/strings'; import { IExtensionManifestPropertiesService } from 'vs/workbench/services/extensions/common/extensionManifestPropertiesService'; import { IStringDictionary } from 'vs/base/common/collections'; import { IExtensionResourceLoaderService } from 'vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader'; +import { Action2, registerAction2 } from 'vs/platform/actions/common/actions'; +import { CATEGORIES } from 'vs/workbench/common/actions'; +import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; interface IStoredWebExtension { readonly identifier: IExtensionIdentifier; @@ -79,6 +84,7 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten this.customBuiltinExtensionsCacheResource = joinPath(environmentService.userRoamingDataHome, 'customBuiltinExtensionsCache.json'); this.builtinExtensionsPromise = this.readSystemExtensions(); this.customBuiltinExtensionsPromise = this.readCustomBuiltinExtensions(); + this.registerActions(); } } @@ -482,6 +488,24 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten return resourceQueue; } + private registerActions(): void { + const that = this; + this._register(registerAction2(class extends Action2 { + constructor() { + super({ + id: 'workbench.extensions.action.openInstalledWebExtensionsResource', + title: { value: localize('openInstalledWebExtensionsResource', "Open Installed Web Extensions Resource"), original: 'Open Installed Web Extensions Resource' }, + category: CATEGORIES.Developer, + f1: true, + precondition: IsWebContext + }); + } + run(serviceAccessor: ServicesAccessor): void { + serviceAccessor.get(IEditorService).openEditor({ resource: that.installedExtensionsResource }); + } + })); + } + } registerSingleton(IWebExtensionsScannerService, WebExtensionsScannerService);