提交 6b892478 编写于 作者: M Matt Bierner

Allow extension contributed TS plugins to be loaded for workspace versions of TS

Fixes #65031

Adds a `enableForWorkspaceTypeScriptVersions` flag (default false) to the plugins contributions that  allows a contributed plugin to be loaded for workspace versions of ts
上级 3a0be849
......@@ -16,6 +16,11 @@
"name": {
"type": "string",
"description": "Name of the plugin as listed in the package.json."
},
"enableForWorkspaceTypeScriptVersions": {
"type": "boolean",
"default": false,
"description": "Should the plugin be loaded when using workspace versions of TypeScript?"
}
}
}
......
......@@ -113,8 +113,11 @@ export class TypeScriptServerSpawner {
if (pluginManager.plugins.length) {
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
if (currentVersion.path === this._versionProvider.defaultVersion.path) {
pluginPaths.push(...pluginManager.plugins.map(x => x.path));
const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
for (const plugin of pluginManager.plugins) {
if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
pluginPaths.push(plugin.path);
}
}
}
......
......@@ -10,6 +10,7 @@ import { memoize } from './memoize';
export interface TypeScriptServerPlugin {
readonly path: string;
readonly name: string;
readonly enableForWorkspaceTypeScriptVersions: boolean;
readonly languages: ReadonlyArray<string>;
}
......@@ -25,6 +26,7 @@ export class PluginManager extends Disposable {
for (const plugin of pack.contributes.typescriptServerPlugins) {
plugins.push({
name: plugin.name,
enableForWorkspaceTypeScriptVersions: !!plugin.enableForWorkspaceTypeScriptVersions,
path: extension.extensionPath,
languages: Array.isArray(plugin.languages) ? plugin.languages : [],
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册