action to open installed web extensions resource

This commit is contained in:
Sandeep Somavarapu 2021-08-23 15:40:49 +02:00
parent 3f74492a24
commit 6e46f926fe
No known key found for this signature in database
GPG key ID: 1FED25EC4646638B

View file

@ -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);