mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
Special case TS dev version detection
Allow pointing to a TS local build without setting `tsdk_version` Fixes #33977
This commit is contained in:
@@ -58,17 +58,24 @@ export class TypeScriptVersion {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let p = serverPath.split(path.sep);
|
||||
const p = serverPath.split(path.sep);
|
||||
if (p.length <= 2) {
|
||||
return undefined;
|
||||
}
|
||||
let p2 = p.slice(0, -2);
|
||||
let modulePath = p2.join(path.sep);
|
||||
const p2 = p.slice(0, -2);
|
||||
const modulePath = p2.join(path.sep);
|
||||
let fileName = path.join(modulePath, 'package.json');
|
||||
if (!fs.existsSync(fileName)) {
|
||||
// Special case for ts dev versions
|
||||
if (path.basename(modulePath) === 'built') {
|
||||
fileName = path.join(modulePath, '..', 'package.json');
|
||||
}
|
||||
}
|
||||
if (!fs.existsSync(fileName)) {
|
||||
return undefined;
|
||||
}
|
||||
let contents = fs.readFileSync(fileName).toString();
|
||||
|
||||
const contents = fs.readFileSync(fileName).toString();
|
||||
let desc: any = null;
|
||||
try {
|
||||
desc = JSON.parse(contents);
|
||||
|
||||
Reference in New Issue
Block a user