mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
Fixing a few cases for missing tsserver
This commit is contained in:
@@ -328,7 +328,11 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
}
|
||||
|
||||
private get bundledTypeScriptPath(): string {
|
||||
return require.resolve('typescript/lib/tsserver.js');
|
||||
try {
|
||||
return require.resolve('typescript/lib/tsserver.js');
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
private get localTypeScriptPath(): string | null {
|
||||
@@ -392,12 +396,12 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
|
||||
this.info(`Using tsserver from location: ${modulePath}`);
|
||||
if (!fs.existsSync(modulePath)) {
|
||||
window.showWarningMessage(localize('noServerFound', 'The path {0} doesn\'t point to a valid tsserver install. Falling back to bundled TypeScript version.', path.dirname(modulePath)));
|
||||
modulePath = this.bundledTypeScriptPath;
|
||||
if (!fs.existsSync(modulePath)) {
|
||||
window.showErrorMessage(localize('noBundledServerFound', 'VSCode\'s tsserver was deleted by a another application such as a misbehaving virus detection tool. Please reinstall VS Code.'));
|
||||
window.showWarningMessage(localize('noServerFound', 'The path {0} doesn\'t point to a valid tsserver install. Falling back to bundled TypeScript version.', modulePath ? path.dirname(modulePath) : ''));
|
||||
if (!this.bundledTypeScriptPath) {
|
||||
window.showErrorMessage(localize('noBundledServerFound', 'VSCode\'s tsserver was deleted by another application such as a misbehaving virus detection tool. Please reinstall VS Code.'));
|
||||
return reject(new Error('Could not find bundled tsserver.js'));
|
||||
}
|
||||
modulePath = this.bundledTypeScriptPath;
|
||||
}
|
||||
|
||||
let version = this.getTypeScriptVersion(modulePath);
|
||||
@@ -485,9 +489,9 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
return this.showVersionPicker(false);
|
||||
}
|
||||
|
||||
private showVersionPicker(firstRun: boolean) {
|
||||
private showVersionPicker(firstRun: boolean): Thenable<string> {
|
||||
const modulePath = this.modulePath || this.globalTypescriptPath;
|
||||
if (!workspace.rootPath) {
|
||||
if (!workspace.rootPath || !modulePath) {
|
||||
return Promise.resolve(modulePath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user