Skip to content

Commit fd745e7

Browse files
committed
Enable passing TSServer plugins to TSServer on web
For #140455 This does not actually enable this feature but a first step for it. Requires work on the TS side to actually get working
1 parent c42d086 commit fd745e7

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

extensions/typescript-language-features/src/tsServer/spawner.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,23 +237,21 @@ export class TypeScriptServerSpawner {
237237
}
238238
}
239239

240-
if (!isWeb()) {
241-
const pluginPaths = this._pluginPathsProvider.getPluginPaths();
240+
const pluginPaths = isWeb() ? [] : this._pluginPathsProvider.getPluginPaths();
242241

243-
if (pluginManager.plugins.length) {
244-
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
242+
if (pluginManager.plugins.length) {
243+
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
245244

246-
const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
247-
for (const plugin of pluginManager.plugins) {
248-
if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
249-
pluginPaths.push(plugin.path);
250-
}
245+
const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
246+
for (const plugin of pluginManager.plugins) {
247+
if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
248+
pluginPaths.push(isWeb() ? plugin.uri.toString() : plugin.uri.path);
251249
}
252250
}
251+
}
253252

254-
if (pluginPaths.length !== 0) {
255-
args.push('--pluginProbeLocations', pluginPaths.join(','));
256-
}
253+
if (pluginPaths.length !== 0) {
254+
args.push('--pluginProbeLocations', pluginPaths.join(','));
257255
}
258256

259257
if (configuration.npmLocation && !isWeb()) {

extensions/typescript-language-features/src/utils/plugins.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as arrays from './arrays';
88
import { Disposable } from './dispose';
99

1010
export interface TypeScriptServerPlugin {
11-
readonly path: string;
11+
readonly uri: vscode.Uri;
1212
readonly name: string;
1313
readonly enableForWorkspaceTypeScriptVersions: boolean;
1414
readonly languages: ReadonlyArray<string>;
@@ -17,7 +17,7 @@ export interface TypeScriptServerPlugin {
1717

1818
namespace TypeScriptServerPlugin {
1919
export function equals(a: TypeScriptServerPlugin, b: TypeScriptServerPlugin): boolean {
20-
return a.path === b.path
20+
return a.uri.toString() === b.uri.toString()
2121
&& a.name === b.name
2222
&& a.enableForWorkspaceTypeScriptVersions === b.enableForWorkspaceTypeScriptVersions
2323
&& arrays.equals(a.languages, b.languages);
@@ -76,7 +76,7 @@ export class PluginManager extends Disposable {
7676
plugins.push({
7777
name: plugin.name,
7878
enableForWorkspaceTypeScriptVersions: !!plugin.enableForWorkspaceTypeScriptVersions,
79-
path: extension.extensionPath,
79+
uri: extension.extensionUri,
8080
languages: Array.isArray(plugin.languages) ? plugin.languages : [],
8181
configNamespace: plugin.configNamespace,
8282
});

0 commit comments

Comments
 (0)