From 46830710dcc222799320323d0a50cff57e106b53 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 18 Jan 2023 13:51:25 -0800 Subject: [PATCH] Enable JS/TS project wide intellisense for opened folders on web For #170920 --- .../src/typescriptServiceClient.ts | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/extensions/typescript-language-features/src/typescriptServiceClient.ts b/extensions/typescript-language-features/src/typescriptServiceClient.ts index 5f2611293c48d..a88a852619b54 100644 --- a/extensions/typescript-language-features/src/typescriptServiceClient.ts +++ b/extensions/typescript-language-features/src/typescriptServiceClient.ts @@ -675,27 +675,22 @@ export default class TypeScriptServiceClient extends Disposable implements IType return undefined; } - switch (resource.scheme) { - case fileSchemes.file: - { - let result = resource.fsPath; - if (!result) { - return undefined; - } - result = path.normalize(result); + if (resource.scheme === fileSchemes.file && !isWeb()) { + let result = resource.fsPath; + if (!result) { + return undefined; + } + result = path.normalize(result); - // Both \ and / must be escaped in regular expressions - return result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/'); - } - default: - { - return (this.isProjectWideIntellisenseOnWebEnabled() ? '' : this.inMemoryResourcePrefix) - + '/' + resource.scheme - + '/' + (resource.authority || this.emptyAuthority) - + (resource.path.startsWith('/') ? resource.path : '/' + resource.path) - + (resource.fragment ? '#' + resource.fragment : ''); - } + // Both \ and / must be escaped in regular expressions + return result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/'); } + + return (this.isProjectWideIntellisenseOnWebEnabled() ? '' : this.inMemoryResourcePrefix) + + '/' + resource.scheme + + '/' + (resource.authority || this.emptyAuthority) + + (resource.path.startsWith('/') ? resource.path : '/' + resource.path) + + (resource.fragment ? '#' + resource.fragment : ''); } public toPath(resource: vscode.Uri): string | undefined {