Enable JS/TS project wide intellisense for opened folders on web (#171678)

For #170920
This commit is contained in:
Matt Bierner
2023-01-18 14:25:11 -08:00
committed by GitHub
parent da521ba57c
commit 9f48317464

View File

@@ -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 {