Skip to content
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

Correctly handle LSP shutdown/exit #2486

Merged
merged 4 commits into from Dec 14, 2021
Merged

Correctly handle LSP shutdown/exit #2486

merged 4 commits into from Dec 14, 2021

Conversation

pepeiborra
Copy link
Collaborator

@pepeiborra pepeiborra commented Dec 13, 2021

The LSP spec says:

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.

We are doing the shut down in the Exit notification handler, which is too late.

Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea if this is visible, presumably it's not easy to test that we do something sensible here.

@pepeiborra pepeiborra added the merge me Label to trigger pull request merge label Dec 13, 2021
@pepeiborra
Copy link
Collaborator Author

Before this change, the Shake profile for the last build when a test times out (using GHCIDE_BUILD_PROFILING) was a 0 bytes file because lsp-test kills the process shortly after sending the Exit notification. With this change, the last build profile is written correctly.

@mergify mergify bot merged commit b7949aa into master Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants