workbench API: assumeGalleryExtensionsAreAddressable

This commit is contained in:
João Moreno 2021-05-27 13:53:26 +02:00
parent e94e8ed399
commit 7a83e5aa62
No known key found for this signature in database
GPG key ID: 896B853774D1A575
2 changed files with 12 additions and 1 deletions

View file

@ -267,6 +267,10 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten
}
canAddExtension(galleryExtension: IGalleryExtension): boolean {
if (this.environmentService.options?.assumeGalleryExtensionsAreAddressable) {
return true;
}
return !!galleryExtension.properties.webExtension && !!galleryExtension.webResource;
}
@ -275,7 +279,7 @@ export class WebExtensionsScannerService extends Disposable implements IWebExten
throw new Error(localize('cannot be installed', "Cannot install '{0}' because this extension is not a web extension.", galleryExtension.displayName || galleryExtension.name));
}
const extensionLocation = galleryExtension.webResource!;
const extensionLocation = joinPath(galleryExtension.assetUri, 'Microsoft.VisualStudio.Code.WebResources', 'extension');
const packageNLSUri = joinPath(extensionLocation, 'package.nls.json');
const context = await this.requestService.request({ type: 'GET', url: packageNLSUri.toString() }, CancellationToken.None);
const packageNLSExists = isSuccess(context);

View file

@ -333,6 +333,13 @@ interface IWorkbenchConstructionOptions {
*/
readonly _enableBuiltinExtensions?: boolean;
/**
* Allows the workbench to skip checking whether an extension was built for the web
* and assumes they are addressable via the `Microsoft.VisualStudio.Code.WebResources`
* asset URI.
*/
readonly assumeGalleryExtensionsAreAddressable?: boolean;
/**
* Support for URL callbacks.
*/