提交 ae7254a2 编写于 作者: M Matt Bierner

Fixing some errors when loading workspace TS versions

上级 23c4467e
......@@ -4,5 +4,5 @@
*--------------------------------------------------------------------------------------------*/
export function isWeb(): boolean {
return typeof process !== 'undefined';
return typeof process === 'undefined';
}
......@@ -82,8 +82,8 @@ export class DiskTypeScriptVersionProvider implements ITypeScriptVersionProvider
try {
const extension = vscode.extensions.getExtension(extensionId);
if (extension) {
const typescriptPath = path.join(extension.extensionPath, ...pathToTs, 'typescript', 'lib');
const bundledVersion = new TypeScriptVersion(source, path.join(typescriptPath, 'tsserver.js'), DiskTypeScriptVersionProvider.getApiVersion(typescriptPath), '');
const serverPath = path.join(extension.extensionPath, ...pathToTs, 'typescript', 'lib', 'tsserver.js');
const bundledVersion = new TypeScriptVersion(source, serverPath, DiskTypeScriptVersionProvider.getApiVersion(serverPath), '');
if (bundledVersion.isValid) {
return bundledVersion;
}
......@@ -101,19 +101,21 @@ export class DiskTypeScriptVersionProvider implements ITypeScriptVersionProvider
private loadVersionsFromSetting(source: TypeScriptVersionSource, tsdkPathSetting: string): TypeScriptVersion[] {
if (path.isAbsolute(tsdkPathSetting)) {
const serverPath = path.join(tsdkPathSetting, 'tsserver.js');
return [
new TypeScriptVersion(source,
path.join(tsdkPathSetting, 'tsserver.js'),
DiskTypeScriptVersionProvider.getApiVersion(tsdkPathSetting))
serverPath,
DiskTypeScriptVersionProvider.getApiVersion(serverPath))
];
}
const workspacePath = RelativeWorkspacePathResolver.asAbsoluteWorkspacePath(tsdkPathSetting);
if (workspacePath !== undefined) {
const serverPath = path.join(workspacePath, 'tsserver.js');
return [
new TypeScriptVersion(source,
path.join(workspacePath, 'tsserver.js'),
DiskTypeScriptVersionProvider.getApiVersion(tsdkPathSetting),
serverPath,
DiskTypeScriptVersionProvider.getApiVersion(serverPath),
tsdkPathSetting)
];
}
......@@ -138,8 +140,8 @@ export class DiskTypeScriptVersionProvider implements ITypeScriptVersionProvider
label = path.join(root.name, relativePath);
}
const serverPath = path.join(root.uri.fsPath, relativePath);
versions.push(new TypeScriptVersion(source, path.join(serverPath, 'tsserver.js'), DiskTypeScriptVersionProvider.getApiVersion(serverPath), label));
const serverPath = path.join(root.uri.fsPath, relativePath, 'tsserver.js');
versions.push(new TypeScriptVersion(source, serverPath, DiskTypeScriptVersionProvider.getApiVersion(serverPath), label));
}
return versions;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册