-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show message to the user in case of language server starting error #824
Comments
If the communication channel is NOT stdout/stdin then everything a server write to stdout/stderr is printed to the output channel. The corresponding code is here:
So in your case it looks like the server doesn't start and even capturing stderr/stdout doesn't work. |
The communication channel does use stdout/stdin (code at https://github.com/erlang-ls/vscode/blob/main/client/src/extension.ts#L19 and https://github.com/erlang-ls/vscode/blob/main/client/src/client.ts#L46). As a language server maintainer, what I'm trying to figure out is how can I improve things in the VS Code client so that eventual issues which cause the server to fail to start (e.g. due to environmental issues) can be propagated to the user via the UI. |
If the communication happens over stderr / stdout the server can't use these to write message to the console. It will interfere with the communication. The protocol defines alternative message which work in all cases. See https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#window_logMessage |
I think Roberto is talking about a scenario where the server is misconfigured, and fails to start. At the moment you just get an error saying the server did not start, and eventually reports 5 failures and stops. Perhaps we could have an option when that point is reached to display whatever the server did emit on stdout/stderr somewhere on the client. |
Alan's interpretation is correct. I'm raising this with the Emacs LSP client as well. |
FYI, rust-analyzer does a message pop-up on error starting up |
@alanz That looks promising. I can try and port that to our server. If that works it's probably worth implementing something similar in the client or, at least, in the LSP sample extension. |
@robertoaloi so in our case the process creation fails. Right? What kind of server do you have and how do you start it. |
@dbaeumer The process is an external executable, implemented in Erlang. You can see the start code here: https://github.com/erlang-ls/vscode/blob/main/client/src/extension.ts#L14-L20 https://github.com/erlang-ls/vscode/blob/main/client/src/client.ts#L13 |
Here is a workaround for this issue in Erlang LS: erlang-ls/vscode#114 |
The handler now allows to return a message that will be presented to the user with a button to open the output channel (which contains stdout) |
That's nice. Will try this asap, thanks! |
That's great! Are there any examples of a client that utilizes it? |
The LSP client itself uses it :-). Search for references. |
Starting a language server via a
client.start()
can result in an error. Usually the stdout or stderr for the server process contain hints to what the problem could be. In case of such an error while starting the server, the only message displayed to the user is something like:I wonder if there's any way to improve the situation and display the stdout/stderr from the server to the user when the language server fails to start. The
clientOptions
include aerrorHandler
that can be customized, but that doesn't seem to help, since when the issue occurs theclosed()
method does not get any arguments.Note: I'm not a Typescript / JS developer myself, so there may be something I'm missing.
The text was updated successfully, but these errors were encountered: