microsoft / vscode-languageserver-node

Language server protocol implementation for VSCode. This allows implementing language services in JS/TS running on node.js
MIT License
1.47k stars 324 forks source link

Allow "The x server has crashed y times in the last z minutes" message/buttons to be overridden #1578

Open DanTup opened 1 week ago

DanTup commented 1 week ago

This message is not currently very useful for users:

Image

"Go to output" goes here:

Image

(I've no idea what this "true" is, but there's not a lot of useful info here, and the message references itself).

While I hope this situation doesn't happen a lot, there's always the possibility of the process terminating unexpectedly, so it would be nice if we could replace the text and button here to provide something more specific to this server (such as opening a page on the website with some troubleshooting instructions and/or the GitHub issue tracker).

dbaeumer commented 1 week ago

You can do this by providing a corresponding error handler. In the returned result you can signal a handled which will suppress the generic dialog. https://github.com/microsoft/vscode-languageserver-node/blob/main/client/src/common/client.ts#L192

Let me know how it goes.

DanTup commented 1 week ago

Ah, nice! I will try it out soon and let you know if I hit any issues. Thanks!