Add more specific check for lib files on web

This commit is contained in:
Matt Bierner
2021-10-14 10:10:42 -07:00
parent 787554d251
commit 6ae9e9d86c

View File

@@ -722,8 +722,8 @@ export default class TypeScriptServiceClient extends Disposable implements IType
public toResource(filepath: string): vscode.Uri {
if (isWeb()) {
// On web, treat absolute paths as pointing to standard lib files
if (filepath.startsWith('/')) {
// On web, the stdlib paths that TS return look like: '/lib.es2015.collection.d.ts'
if (filepath.startsWith('/lib.') && filepath.endsWith('.d.ts')) {
return vscode.Uri.joinPath(this.context.extensionUri, 'dist', 'browser', 'typescript', filepath.slice(1));
}
}