Skip to content

Commit

Permalink
Enable JS/TS project wide intellisense for opened folders on web
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Jan 18, 2023
1 parent d8568bb commit 4683071
Showing 1 changed file with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4683071

Please sign in to comment.