x/tools/gopls: gopls --remote=auto can sometimes exit 2 during nvim shutdown (Client 1 quit with exit code 2 and signal 0) #51252
Labels
gopls
Issues related to the Go language server, gopls.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
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 thegopls
daemon 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
gopls
exited non-zero and reporting it so the issue is thatgopls
is exiting2
for some reason. Curiously:gopls
exiting0
(no message), but closing nvim 1 consistently hasgopls
exiting2
(message)gopls
exiting2
and then closing nvim 2 consistently hasgopls
exit2
gopls
consistently exit with2
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
lspconfig.gopls.setup {}
)WORKAROUND: while I don't care for this since IME the fix should be in
gopls
and the workaround affects all lsp servers, not justgopls
, 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
.Build info
The text was updated successfully, but these errors were encountered: