-
Notifications
You must be signed in to change notification settings - Fork 419
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
[LSP] shutdown and exit commands throw an exception #1113
Comments
This should be fixed in the next version of the lsp library (that we have not yet updated to). @mholo65 is working on a code lens handler, and the upgrade will roll in with that. |
Thanks for that hint. I was able to figure out how it works and merge the LSP library version 0.7.7 into my own code. I have discovered a bunch of other problems, but I don't know where they should be reported. I guess in csharp-language-server-protocol? One issue is that OmniSharp.exe doesn't terminate when it receives the exit request (although it doesn't throw an exception anymore). The other is that it tells the client that it has no capabilities and I'm not sure if that is a problem with this project, the other one, or if that just never got implemented yet. |
Well, the bug with OmniSharp.exe not terminating is because @mholo65 's current code doesn't bind the server's Exit event in LanguageServerHost.cs. Since you said it was a work in progress, I'll just leave it alone for now. For the other one, I will make the issue here. |
@LoneBoco the language server library actually manages exit and shutdown for you @ https://github.com/OmniSharp/csharp-language-server-protocol/blob/master/src/Server/LanguageServer.cs#L88 |
However we did have an issue with shutdown and exit not working correctly, that has been fixed in the library, it just hasn't been merged yet. |
Is that so? Does the library forcibly kill the process when that happens? According to this, Omnisharp waits on the cancellation token when we start it up:
And here we can see that we don't send the cancellation token unless we abort in the console, or unless the host process terminates: omnisharp-roslyn/src/OmniSharp.LanguageServerProtocol/LanguageServerHost.cs Lines 198 to 218 in 7da2d94
There is nothing that actually triggers that cancellation token if we receive an exit command. For what it is worth, I added a simple block of code and it now exits for me: _server.Exit += (sender) =>
{
_cancellationTokenSource.Cancel();
}; This is because the library sends out that Exit event when it receives the exit command. |
Fixed in 1.32.10 through #1345 |
I am trying to use omnisharp-roslyn in LSP mode and I am unable to shut down the server through normal means.
I tried throwing /shutdownServer to see what would happen (it is currently listed as not supported), and I get this response:
shutdown and exit seem to be handled somewhere else. I tried briefly searching through the code of omnisharp-roslyn, but I couldn't find out where it was handled.
EDIT: I should mention that I am running Omnisharp with the -lsp and -stdio command line arguments.
The text was updated successfully, but these errors were encountered: