mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
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
This commit is contained in:
@@ -16,6 +16,11 @@
|
|||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Name of the plugin as listed in the package.json."
|
"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) {
|
if (pluginManager.plugins.length) {
|
||||||
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
|
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
|
||||||
|
|
||||||
if (currentVersion.path === this._versionProvider.defaultVersion.path) {
|
const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
|
||||||
pluginPaths.push(...pluginManager.plugins.map(x => x.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 {
|
export interface TypeScriptServerPlugin {
|
||||||
readonly path: string;
|
readonly path: string;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
readonly enableForWorkspaceTypeScriptVersions: boolean;
|
||||||
readonly languages: ReadonlyArray<string>;
|
readonly languages: ReadonlyArray<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ export class PluginManager extends Disposable {
|
|||||||
for (const plugin of pack.contributes.typescriptServerPlugins) {
|
for (const plugin of pack.contributes.typescriptServerPlugins) {
|
||||||
plugins.push({
|
plugins.push({
|
||||||
name: plugin.name,
|
name: plugin.name,
|
||||||
|
enableForWorkspaceTypeScriptVersions: !!plugin.enableForWorkspaceTypeScriptVersions,
|
||||||
path: extension.extensionPath,
|
path: extension.extensionPath,
|
||||||
languages: Array.isArray(plugin.languages) ? plugin.languages : [],
|
languages: Array.isArray(plugin.languages) ? plugin.languages : [],
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user