LanguageServer.jl icon indicating copy to clipboard operation
LanguageServer.jl copied to clipboard

Warning: Client 1 quit with exit code 1 and signal 0

Open codemeleon opened this issue 3 years ago • 7 comments

Hi ,

I get "Warning: Client 1 quit with exit code 1 and signal 0" and then Auto-completion/LSP stops working. I am using Neovim-0.8 and using default lsp configuration from https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#julials .

Please help to fix this issue.

Thank you

codemeleon avatar Oct 22 '22 22:10 codemeleon

You need to provide something to work with. What did you do when it exited? What is in the log file?

fredrikekre avatar Oct 26 '22 08:10 fredrikekre

It exits at the first auto-completion of the code. Please find attached log file. lsp.log

codemeleon avatar Oct 26 '22 13:10 codemeleon

The error is

ERROR: Unknown method completionItem/resolve.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::JSONRPC.MsgDispatcher, msg::
Dict{String, Any})
   @ JSONRPC ~/.julia/packages/JSONRPC/P0G1p/src/
typed.jl:81
 [3] run(server::LanguageServerInstance)
   @ LanguageServer ~/.julia/packages/LanguageServer/0vsx2/src/languageserverinstance.jl:382
 [4] top-level scope
   @ none:31

fredrikekre avatar Oct 26 '22 14:10 fredrikekre

@fredrikekre How can I fix the issue? Any recommendation?

codemeleon avatar Oct 26 '22 14:10 codemeleon

What is your completion setup? LanguageServer.jl does not provide this method, and the client should therefore not request it, see https://github.com/julia-vscode/LanguageServer.jl/blob/1af37e28315872c21654a67c0805f547d81cf51f/src/requests/init.jl#L12 and https://github.com/julia-vscode/LanguageServer.jl/blob/1af37e28315872c21654a67c0805f547d81cf51f/src/protocol/completion.jl#L64-L65

fredrikekre avatar Oct 26 '22 14:10 fredrikekre

I think the underlying problem was already extensively discussed in #1155 - without any real solution.

Now with this example from Neovim there is apparently another client which doesn't check server capabilities. Yes, ultimately it is the client to blame here, but there would be an absolutely trivial solution to this problem, preventing future issue reports of this kind, vastly improving user experience by not crashing anymore, and requiring only a single line change in JSONRPC.jl:

diff --git a/src/typed.jl b/src/typed.jl
index 34cfe3b..5335dba 100644
--- a/src/typed.jl
+++ b/src/typed.jl
@@ -78,7 +78,7 @@ function dispatch_msg(x::JSONRPCEndpoint, dispatcher::MsgDispatcher, msg)
                 end
             end
         else
-            error("Unknown method $method_name.")
+            send_error_response(x, msg, -32601, "Unknown method $method_name.", nothing)
         end
     finally
         dispatcher._currentlyHandlingMsg = false

:upside_down_face:

Edit: Actually still need to add a check in the suggested change above, whether the original message has an id, to only send the error response on unknown requests and not on notifications.

jwortmann avatar Oct 26 '22 19:10 jwortmann

Neovim is very strict in checking capabilities and I have never seen this error before (or any other error where neovim sends unsupported requests, most likely this is something specific to the completion setup by @codemeleon .

fredrikekre avatar Oct 26 '22 20:10 fredrikekre