From d7e2a9dfbb8021b78c68c30bff370d47c41f1813 Mon Sep 17 00:00:00 2001 From: chemzqm Date: Thu, 13 Jun 2019 13:18:50 +0800 Subject: [PATCH] restart tsserver on normal exit --- src/server/typescriptServiceClient.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/typescriptServiceClient.ts b/src/server/typescriptServiceClient.ts index 9e20000..a95d0f4 100644 --- a/src/server/typescriptServiceClient.ts +++ b/src/server/typescriptServiceClient.ts @@ -96,6 +96,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient >() private _apiVersion: API private readonly disposables: Disposable[] = [] + private isRestarting = false constructor(private pluginManager: PluginManager) { this.pathSeparator = path.sep @@ -180,6 +181,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient return Promise.resolve(this.servicePromise.then(childProcess => { this.state = ServiceStat.Stopping this.info('Killing TS Server') + this.isRestarting = true childProcess.kill() this.servicePromise = null }).then(start)) @@ -312,7 +314,8 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient this.error(`TSServer exited with code: ${code}`) } this.info(`TSServer log file: ${this.tsServerLogFile || ''}`) - this.serviceExited(code != null) + this.serviceExited(!this.isRestarting) + this.isRestarting = false }) handle.createReader(