Skip to content

Commit

Permalink
update language client to 8.0.2
Browse files Browse the repository at this point in the history
Signed-off-by: Shi Chen <[email protected]>
  • Loading branch information
CsCherrYY committed Feb 13, 2023
1 parent 31b0a60 commit c7455ae
Show file tree
Hide file tree
Showing 12 changed files with 541 additions and 535 deletions.
84 changes: 36 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"virtualWorkspaces": false
},
"engines": {
"vscode": "^1.65.0"
"vscode": "^1.67.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -1400,7 +1400,7 @@
"@types/node": "^8.10.51",
"@types/semver": "^7.3.8",
"@types/sinon": "^10.0.12",
"@types/vscode": "^1.65.0",
"@types/vscode": "^1.67.0",
"@types/winreg": "^1.2.30",
"@types/winston": "^2.4.4",
"@vscode/test-electron": "^2.1.5",
Expand Down Expand Up @@ -1431,7 +1431,7 @@
"htmlparser2": "6.0.1",
"jdk-utils": "^0.4.4",
"semver": "^7.3.5",
"vscode-languageclient": "7.1.0-next.5",
"vscode-languageclient": "8.0.2",
"winreg-utf8": "^0.1.1",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^3.10.0"
Expand Down
26 changes: 18 additions & 8 deletions src/clientErrorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { window, commands } from "vscode";
import { ErrorHandler, Message, ErrorAction, CloseAction } from "vscode-languageclient";
import { ErrorHandler, Message, ErrorAction, CloseAction, ErrorHandlerResult, CloseHandlerResult } from "vscode-languageclient";
import { Commands } from "./commands";
import { logger } from "./log";

Expand All @@ -10,21 +10,27 @@ export class ClientErrorHandler implements ErrorHandler {
this.restarts = [];
}

public error(_error: Error, _message: Message, count: number): ErrorAction {
public error(_error: Error, _message: Message, count: number): ErrorHandlerResult {
if (count && count <= 3) {
logger.error(`${this.name} server encountered error: ${_message}, ${_error && _error.toString()}`);
return ErrorAction.Continue;
return {
action: ErrorAction.Continue
};
}

logger.error(`${this.name} server encountered error and will shut down: ${_message}, ${_error && _error.toString()}`);
return ErrorAction.Shutdown;
return {
action: ErrorAction.Shutdown
};
}

public closed(): CloseAction {
public closed(): CloseHandlerResult {
this.restarts.push(Date.now());
if (this.restarts.length < 5) {
logger.error(`The ${this.name} server crashed and will restart.`);
return CloseAction.Restart;
return {
action: CloseAction.Restart
};
} else {
const diff = this.restarts[this.restarts.length - 1] - this.restarts[0];
if (diff <= 3 * 60 * 1000) {
Expand All @@ -36,12 +42,16 @@ export class ClientErrorHandler implements ErrorHandler {
commands.executeCommand(Commands.OPEN_LOGS);
}
});
return CloseAction.DoNotRestart;
return {
action: CloseAction.DoNotRestart
};
}

logger.error(`The ${this.name} server crashed and will restart.`);
this.restarts.shift();
return CloseAction.Restart;
return {
action: CloseAction.Restart
};
}
}
}
Loading

0 comments on commit c7455ae

Please sign in to comment.