|
let handlerResult: CloseHandlerResult = { action: CloseAction.DoNotRestart }; |
|
if (this.$state !== ClientState.Stopping) { |
|
try { |
|
handlerResult = await this._clientOptions.errorHandler!.closed(); |
|
} catch (error) { |
|
// Ignore errors coming from the error handler. |
|
} |
|
} |
|
this._connection = undefined; |
|
if (handlerResult.action === CloseAction.DoNotRestart) { |
|
this.error(handlerResult.message ?? 'Connection to server got closed. Server will not be restarted.', undefined, handlerResult.handled === true ? false : 'force'); |
I am developing a language server with an external dependency so I want to start/stop it myself. Unfortunately, if the dependency goes missing then the "Connection to server got closed. Server will not be restarted." message will appear if this.$state === ClientState.Stopping because I can't use the this._clientOptions.errorHandler to try to suppress it. Now when the dependency comes back the language server will restart even though the notification claimed that it "will not be restarted".
Essentially, I do not want the vscode-languageclient to popup any errors about the server being dead because I want to control everything myself but I can't avoid this particular notification (there may be others I have not encountered yet...?) because of this if statement.
vscode-languageserver-node/client/src/common/client.ts
Lines 1793 to 1803 in dadd73f
I am developing a language server with an external dependency so I want to start/stop it myself. Unfortunately, if the dependency goes missing then the "Connection to server got closed. Server will not be restarted." message will appear if
this.$state === ClientState.Stoppingbecause I can't use thethis._clientOptions.errorHandlerto try to suppress it. Now when the dependency comes back the language server will restart even though the notification claimed that it "will not be restarted".Essentially, I do not want the
vscode-languageclientto popup any errors about the server being dead because I want to control everything myself but I can't avoid this particular notification (there may be others I have not encountered yet...?) because of thisifstatement.