Improve default extensionKind detection

This commit is contained in:
Alex Dima 2020-07-23 23:24:35 +02:00
parent 2fa41fb23e
commit fd91d449f9
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0
2 changed files with 11 additions and 5 deletions

View file

@ -124,7 +124,7 @@ async function getDefaultExtensionInfos() {
let extensionArg = args['extension'];
if (!extensionArg) {
return { extensions, locations }
return { extensions, locations };
}
const extensionPaths = Array.isArray(extensionArg) ? extensionArg : [extensionArg];
@ -164,7 +164,6 @@ async function getExtensionPackageJSON(extensionPath) {
fancyLog(`${ansiColors.yellow('Warning')}: Could not find ${mainFilePath}. Use ${ansiColors.cyan('yarn gulp watch-web')} to build the built-in extensions.`);
}
}
packageJSON.extensionKind = ['web']; // enable for Web
const packageNLSPath = path.join(extensionPath, 'package.nls.json');
const packageNLSExists = await exists(packageNLSPath);

View file

@ -61,16 +61,23 @@ export function getExtensionKind(manifest: IExtensionManifest, productService: I
// Not an UI extension if it has main
if (manifest.main) {
if (manifest.browser) {
return ['workspace', 'web'];
}
return ['workspace'];
}
// Not an UI extension if it has dependencies or an extension pack
if (manifest.browser) {
return ['web'];
}
// Not an UI nor web extension if it has dependencies or an extension pack
if (isNonEmptyArray(manifest.extensionDependencies) || isNonEmptyArray(manifest.extensionPack)) {
return ['workspace'];
}
if (manifest.contributes) {
// Not an UI extension if it has no ui contributions
// Not an UI nor web extension if it has no ui contributions
for (const contribution of Object.keys(manifest.contributes)) {
if (!isUIExtensionPoint(contribution)) {
return ['workspace'];
@ -78,7 +85,7 @@ export function getExtensionKind(manifest: IExtensionManifest, productService: I
}
}
return ['ui', 'workspace'];
return ['ui', 'workspace', 'web'];
}
let _uiExtensionPoints: Set<string> | null = null;