Fix errors in untitled JS/TS files

This commit is contained in:
Matt Bierner 2021-09-27 14:09:31 -07:00
parent 117b201b80
commit 8731be5e78
No known key found for this signature in database
GPG key ID: 099C331567E11888

View file

@ -19,7 +19,7 @@ import { TypeScriptVersionManager } from './tsServer/versionManager';
import { ITypeScriptVersionProvider, TypeScriptVersion } from './tsServer/versionProvider';
import { ClientCapabilities, ClientCapability, ExecConfig, ITypeScriptServiceClient, ServerResponse, TypeScriptRequests } from './typescriptService';
import API from './utils/api';
import { areServiceConfigurationsEqual, SyntaxServerConfiguration, ServiceConfigurationProvider, TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration';
import { areServiceConfigurationsEqual, ServiceConfigurationProvider, SyntaxServerConfiguration, TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration';
import { Disposable } from './utils/dispose';
import * as fileSchemes from './utils/fileSchemes';
import { Logger } from './utils/logger';
@ -681,7 +681,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
}
default:
{
return this.inMemoryResourcePrefix + '/' + resource.scheme + resource.path;
return this.inMemoryResourcePrefix + '/' + resource.scheme + (resource.path.startsWith('/') ? resource.path : '/' + resource.path);
}
}
}
@ -727,8 +727,11 @@ export default class TypeScriptServiceClient extends Disposable implements IType
}
if (filepath.startsWith(this.inMemoryResourcePrefix)) {
const resource = vscode.Uri.parse(filepath.slice(1));
return this.bufferSyncSupport.toVsCodeResource(resource);
const parts = filepath.match(/^\^\/([^\/]+)\/(.+)$/);
if (parts) {
const resource = vscode.Uri.parse(parts[1] + ':' + parts[2]);
return this.bufferSyncSupport.toVsCodeResource(resource);
}
}
return this.bufferSyncSupport.toResource(filepath);
}