/ go Public
x/tools/gopls: gopls --remote=auto can sometimes exit 2 during nvim shutdown (Client 1 quit with exit code 2 and signal 0) #51252
Issues related to the Go language server, gopls.
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
This label describes issues relating to any tools in the x/tools repository.
ATTENTION: Please answer these questions BEFORE submitting your issue. Thanks!
What did you do?
I changed my nvim (0.6.1) lsp configuration to start gopls with
--remote=auto. If I open a go file with nvim I can see the
goplsdaemon listening and when I exit cleanly (eg, with
:q), I see the terminal prompt and the daemon goes away after 1 minute (great; this is all as per design). If instead I open two different go files in two different terminals (ie, the first starts the daemon and connects while the second connects to the daemon; so far so good), then when I close the first nvim (eg,
:q), I see:
This message is coming from https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp.lua#L854 which is simply noticing that
goplsexited non-zero and reporting it so the issue is that
2for some reason. Curiously:
0(no message), but closing nvim 1 consistently has
2and then closing nvim 2 consistently has
goplsconsistently exit with
In terms of setup, I use nvim 0.6.1 on Linux and I followed https://github.com/golang/tools/blob/master/gopls/doc/vim.md#custom-configuration with my custom setup being simply:
(before I was just using
WORKAROUND: while I don't care for this since IME the fix should be in
goplsand the workaround affects all lsp servers, not just
gopls, one can adjust
/usr/share/nvim/runtime/lua/vim/lsp.lua(adjust for your installation) to use:
What did you expect to see?
No output from nvim during a clean exit from any number of nvim connections.
What did you see instead?
With multiple open nvims to go files, usually see
Client 1 quit with exit code 2 and signal 0.
The text was updated successfully, but these errors were encountered: