You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error handler unable to intercept and suppress error notification #1608
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.
Changing this might be a surprise for users that hook their own error handler. One idea would be to hide this behind a flag.
Hi Dirk Bäumer (@dbaeumer), for my clarity, could you rephrase what you mean by "hide this behind a flag"? Did you just mean adding adding a new boolean property to LanguageClientOptions in client/src/common/client.ts to control the new behaviour?
We are also encountering this issue in implementing a language client for our extension.
Our language server connects over websocket and we expect occasional closures, which we handle & then reconnect. But it seems we cannot prevent the error message notification that says "Restarting server failed", even though our server restarts ok in the background and is continuing to provide intellisense in the editor.
Activity
dbaeumer commentedon Feb 5, 2025
Changing this might be a surprise for users that hook their own error handler. One idea would be to hide this behind a flag.
dbaeumer commentedon Feb 5, 2025
PR as always welcome.
rcjsuen commentedon Feb 6, 2025
Hi Dirk Bäumer (@dbaeumer), for my clarity, could you rephrase what you mean by "hide this behind a flag"? Did you just mean adding adding a new
booleanproperty toLanguageClientOptionsinclient/src/common/client.tsto control the new behaviour?dbaeumer commentedon Feb 10, 2025
Yes, that is exactly what I had in mind.
noeldevelops commentedon May 16, 2025
We are also encountering this issue in implementing a language client for our extension.
Our language server connects over websocket and we expect occasional closures, which we handle & then reconnect. But it seems we cannot prevent the error message notification that says "Restarting server failed", even though our server restarts ok in the background and is continuing to provide intellisense in the editor.