From 456d58d9c90dc3a99352baa6434f1a286bc70b3d Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 26 Apr 2017 22:14:28 -0700 Subject: [PATCH] Automatically restart TS server when user changes TS versions. Fixes #25431 --- .../typescript/src/typescriptServiceClient.ts | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/extensions/typescript/src/typescriptServiceClient.ts b/extensions/typescript/src/typescriptServiceClient.ts index 5c053b92bf1..c90616f632a 100644 --- a/extensions/typescript/src/typescriptServiceClient.ts +++ b/extensions/typescript/src/typescriptServiceClient.ts @@ -226,7 +226,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient if (this.servicePromise === null && (oldglobalTsdk !== this.globalTsdk || oldLocalTsdk !== this.localTsdk)) { this.startService(); } else if (this.servicePromise !== null && (this.tsServerLogLevel !== oldLoggingLevel || (oldglobalTsdk !== this.globalTsdk || oldLocalTsdk !== this.localTsdk))) { - this.promptUserToRestartTsServer(); + this.restartTsServer(); } })); if (this.packageInfo && this.packageInfo.aiKey) { @@ -255,21 +255,6 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient } } - private promptUserToRestartTsServer(): void { - const restartItem = { title: localize('restartTsServerTitle', 'Restart') }; - window.showInformationMessage( - localize('restartTypeScriptServerBlurb', 'Restart TypeScript Server to apply change'), - restartItem, - { - title: localize('later', 'Later'), - isCloseAffordance: true - }) - .then(selected => { - if (selected === restartItem) { - this.restartTsServer(); - } - }); - } private extractGlobalTsdk(configuration: WorkspaceConfiguration): string | null { let inspect = configuration.inspect('typescript.tsdk'); @@ -673,7 +658,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient if (firstRun || newModulePath === this.modulePath) { return; } - this.promptUserToRestartTsServer(); + this.restartTsServer(); }; return window.showQuickPick(pickOptions, { @@ -854,6 +839,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient private serviceExited(restart: boolean): void { this.servicePromise = null; + this.tsServerLogFile = null; Object.keys(this.callbacks).forEach((key) => { this.callbacks[parseInt(key)].e(new Error('Service died.')); });