Decodetalkers / neocmakelsp

Another cmake lsp
MIT License
150 stars 13 forks source link

server should return null response for "shutdown" request #80

Open yangyingchao opened 5 days ago

yangyingchao commented 5 days ago

This is documented in LSP specification: https://microsoft.github.io/language-server-protocol/specification#shutdown

Shutdown Request (:leftwards_arrow_with_hook:)
The shutdown request is sent from the client to the server. It asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client). There is a separate exit notification that asks the server to exit. Clients must not send any notifications other than exit or requests to a server to which they have sent a shutdown request. Clients should also wait with sending the exit notification until they have received a response from the shutdown request.

If a server receives requests after a shutdown request those requests should error with InvalidRequest.

Request:

method: ‘shutdown’
params: none
Response:

result: null
error: code and message set in case an exception happens during shutdown request.

But nc does not respond to this request at all. This causes EGLOT of emacs to raise a timeout error while waiting for a response.

I tried to debug nc, and it seems impl LanguageServer for Backend: shutdown (https://github.com/Decodetalkers/neocmakelsp/blob/3d3f79c36b2a183d90a3e2f2fd69029cdfc3172f/src/languageserver.rs#L252) is never called.

Not sure if this is a misuse of tower-lsp or if it is an issue with tower-lsp itself.

yangyingchao commented 5 days ago

I started a disscussion here: https://github.com/ebkalderon/tower-lsp/discussions/422