提交 456d58d9 编写于 作者: M Matt Bierner

Automatically restart TS server when user changes TS versions. Fixes #25431

上级 31fdab9d
...@@ -226,7 +226,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient ...@@ -226,7 +226,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
if (this.servicePromise === null && (oldglobalTsdk !== this.globalTsdk || oldLocalTsdk !== this.localTsdk)) { if (this.servicePromise === null && (oldglobalTsdk !== this.globalTsdk || oldLocalTsdk !== this.localTsdk)) {
this.startService(); this.startService();
} else if (this.servicePromise !== null && (this.tsServerLogLevel !== oldLoggingLevel || (oldglobalTsdk !== this.globalTsdk || oldLocalTsdk !== this.localTsdk))) { } else if (this.servicePromise !== null && (this.tsServerLogLevel !== oldLoggingLevel || (oldglobalTsdk !== this.globalTsdk || oldLocalTsdk !== this.localTsdk))) {
this.promptUserToRestartTsServer(); this.restartTsServer();
} }
})); }));
if (this.packageInfo && this.packageInfo.aiKey) { if (this.packageInfo && this.packageInfo.aiKey) {
...@@ -255,21 +255,6 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient ...@@ -255,21 +255,6 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
} }
} }
private promptUserToRestartTsServer(): void {
const restartItem = { title: localize('restartTsServerTitle', 'Restart') };
window.showInformationMessage<MessageItem>(
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 { private extractGlobalTsdk(configuration: WorkspaceConfiguration): string | null {
let inspect = configuration.inspect('typescript.tsdk'); let inspect = configuration.inspect('typescript.tsdk');
...@@ -673,7 +658,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient ...@@ -673,7 +658,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
if (firstRun || newModulePath === this.modulePath) { if (firstRun || newModulePath === this.modulePath) {
return; return;
} }
this.promptUserToRestartTsServer(); this.restartTsServer();
}; };
return window.showQuickPick<MyQuickPickItem>(pickOptions, { return window.showQuickPick<MyQuickPickItem>(pickOptions, {
...@@ -854,6 +839,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient ...@@ -854,6 +839,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
private serviceExited(restart: boolean): void { private serviceExited(restart: boolean): void {
this.servicePromise = null; this.servicePromise = null;
this.tsServerLogFile = null;
Object.keys(this.callbacks).forEach((key) => { Object.keys(this.callbacks).forEach((key) => {
this.callbacks[parseInt(key)].e(new Error('Service died.')); this.callbacks[parseInt(key)].e(new Error('Service died.'));
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册