Skip to content

stopLanguageServer() hangs, preventing Stop/Restart from working correctly #2

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

Closed
xeger opened this issue Jun 19, 2022 · 1 comment · Fixed by #4
Closed

stopLanguageServer() hangs, preventing Stop/Restart from working correctly #2

xeger opened this issue Jun 19, 2022 · 1 comment · Fixed by #4

Comments

@xeger
Copy link
Contributor

xeger commented Jun 19, 2022

Whenever I use the "Syntax Tree: Stop" command on my system, the await languageClient.stop() never returns. I've verified that the ruby process disappears from ps output, so it there's sort of unclean shutdown happening in the language server client (provided by VS Code).

After debugging, I isolated the root cause: the VS Code client expects a response to every RPC, including shutdown. The syntax_tree gem was abruptly terminating on shutdown requests without providing a response.

I have a proposed fix in the gem that responds to shutdown requests & verified this makes VS Code happy.

This fix reveals another issue: because Visualize registers a command every time it is constructed, VS Code throws an error if the language server is started a second time! It might be a bug for us to (re)register the command inside startLanguageServer -- we need a proxy command function that will forward to the most recently constructed instance of Visualize.

My goal is to be able to cleanly restart the language server -- because I want to add settings to the extension and ensure the LSP restarts when settings are tweaked; see #3. Seems like fixing the LSP in the gem is the first step to that, although I need to fix the command-reregistration issue too, if I'm going to make settings work.

Thoughts?

@kddnewton
Copy link
Member

In terms of fixing the visualize issue, I think it should boil down to:

  • Have the activate function register the command instead
  • Have it do nothing if the languageClient variable is null
  • Otherwise have it call the visualize instance's visualize function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants