mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
Allow manually restarting TS Server even if it has crashed too many times
Currently if the server crashes too many times, the user has to restart VS Code. It's possible the user could fix something (such as a bad plugin) and then run this command to just restart the server without needing to restart the entire editor
This commit is contained in:
@@ -15,6 +15,6 @@ export class RestartTsServerCommand implements Command {
|
||||
) { }
|
||||
|
||||
public execute() {
|
||||
this.lazyClientHost.value.serviceClient.restartTsServer();
|
||||
this.lazyClientHost.value.serviceClient.restartTsServer(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,13 +280,20 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
this.loadingIndicator.reset();
|
||||
}
|
||||
|
||||
public restartTsServer(): void {
|
||||
public restartTsServer(fromUserAction = false): void {
|
||||
if (this.serverState.type === ServerState.Type.Running) {
|
||||
this.info('Killing TS Server');
|
||||
this.isRestarting = true;
|
||||
this.serverState.server.kill();
|
||||
}
|
||||
|
||||
if (fromUserAction) {
|
||||
// Reset crash trackers
|
||||
this.hasServerFatallyCrashedTooManyTimes = false;
|
||||
this.numberRestarts = 0;
|
||||
this.lastStart = Date.now();
|
||||
}
|
||||
|
||||
this.serverState = this.startService(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user