11import { window , commands } from "vscode" ;
2- import { ErrorHandler , Message , ErrorAction , CloseAction } from "vscode-languageclient" ;
2+ import { ErrorHandler , Message , ErrorAction , CloseAction , ErrorHandlerResult , CloseHandlerResult } from "vscode-languageclient" ;
33import { Commands } from "./commands" ;
44import { logger } from "./log" ;
55
@@ -10,21 +10,27 @@ export class ClientErrorHandler implements ErrorHandler {
1010 this . restarts = [ ] ;
1111 }
1212
13- public error ( _error : Error , _message : Message , count : number ) : ErrorAction {
13+ public error ( _error : Error , _message : Message , count : number ) : ErrorHandlerResult {
1414 if ( count && count <= 3 ) {
1515 logger . error ( `${ this . name } server encountered error: ${ _message } , ${ _error && _error . toString ( ) } ` ) ;
16- return ErrorAction . Continue ;
16+ return {
17+ action : ErrorAction . Continue
18+ } ;
1719 }
1820
1921 logger . error ( `${ this . name } server encountered error and will shut down: ${ _message } , ${ _error && _error . toString ( ) } ` ) ;
20- return ErrorAction . Shutdown ;
22+ return {
23+ action : ErrorAction . Shutdown
24+ } ;
2125 }
2226
23- public closed ( ) : CloseAction {
27+ public closed ( ) : CloseHandlerResult {
2428 this . restarts . push ( Date . now ( ) ) ;
2529 if ( this . restarts . length < 5 ) {
2630 logger . error ( `The ${ this . name } server crashed and will restart.` ) ;
27- return CloseAction . Restart ;
31+ return {
32+ action : CloseAction . Restart
33+ } ;
2834 } else {
2935 const diff = this . restarts [ this . restarts . length - 1 ] - this . restarts [ 0 ] ;
3036 if ( diff <= 3 * 60 * 1000 ) {
@@ -36,12 +42,16 @@ export class ClientErrorHandler implements ErrorHandler {
3642 commands . executeCommand ( Commands . OPEN_LOGS ) ;
3743 }
3844 } ) ;
39- return CloseAction . DoNotRestart ;
45+ return {
46+ action : CloseAction . DoNotRestart
47+ } ;
4048 }
4149
4250 logger . error ( `The ${ this . name } server crashed and will restart.` ) ;
4351 this . restarts . shift ( ) ;
44- return CloseAction . Restart ;
52+ return {
53+ action : CloseAction . Restart
54+ } ;
4555 }
4656 }
4757}
0 commit comments