Closed manuEbg closed 3 years ago
As a reference, you can have a look at the implementation in my test project.
The additional challenge is to do this in two steps: shutdown()
should only stop the server from sending anything other than information messages, and only when the server receives the exit()
call it should actually exit.
@IlmarB This issue has not received any updates in the last week. What is your status?
I have not fixed this yet. In fact I also thought about splitting this issue into sub-issues where one of them is reviewing your test project.
right now the server removes the client gracefully but does not stop which should be fixed next.
Two thoughts on this:
shutdown()
call has been issued. However, this should only happen after exit()
has been called. Otherwise this might lead to errors on the client side, because the client either does not receive an answer to the shutdown request or is unable to send the exit request.Let me summarize the plan we agreed on at the beginning of the sprint again:
Exit
and Shutdown Server
Exit
Command just disconnects the Client from the Server in a gracefull way and terminates the ClientProcessYes, that sums it up nicely. I just would rename the Exit
command to something like Disconnect
, so that the name is more telling of what the command actually does and there is no name confusion with the LSP commands shutdown
and exit
.
What I was getting at with my second point was the fact that I am not sure whether you can prevent a standard LSP client like the vscode implementation from sending LSP shutdown
commands. All the shutdown and cleanup is done in a function called client.stop()
which both sends shutdown
and exit
via LSP. In order to use the setup that you posted, we would have to disentangle this and manually cleanup the resources in the vscode client without calling client.stop()
when we use the Disconnect
action.
Maybe you should clarify what use cases you want to cover with the multi-client feature. Should something like the following be possible?
shutdown
and then exit
)If not, what about this scenario?
shutdown
and then exit
)Both in the first and in the second scenario you have the issue that stopping a vscode client is synonymous with sending shutdown
and exit
, but in the current setup that you posted, sending shutdown
disables the server from working with any of the other potentially still connected clients and/or future clients that want to connect to the server instance. If you want to neither support the first nor the second scenario then what is the point of the multi-client feature? Should only the console client be allowed as an "extra" client next to a vscode client?
As I understand it, stopping a client does not imply sending the shutdown and exit command
Done - 2 Options are now available 9: Exit - Shutdown server (for a full shutdown) 10: Exit - Disconnect (Client stops, server continues running)
As I understand it, stopping a client does not imply sending the shutdown and exit command
Not in LSP4J, but in vscode-languageserver-node you have the stop()
method as the only available top-level way of disconnecting from a server and cleaning up resources. As you can see, it calls shutdown and exit on the connection object.
I just leave this here...