Closed rsdubtso closed 5 years ago
The protocol defines 2 calls to exit, if the server is exiting after the first call and not waiting for the second then maybe we get into a weird state...
The first added check for server.status
feels like it shouldn't be necessary. The switch from call
to return
is a clear bug fix - thanks!
I think the most direct workaround is to check for the channel's existence directly rather than worrying about status on the final 'exit' notification. I've got a change that I'm hoping fixes this - if it doesn't let me know and we can investigate further.
I'm still getting
[lsc:Error] Command exited unexpectedly: cpp
after updating to 329d894f941945287e9797c42e6125838c8a2ac0. I'll try to post more info as I'm debugging this.
I'm not reopening this since while I now know what happens, I am not sure still that the issue lies within vim-lsc and not with neovim. More precisely, I am now suspecting that the latter is more likely...
The problem is that, in neovim
, when the Exit()
capture is being called, it is called with the last value of the l:server
variable in the lsc#server#exit()
function and not the one with which it was initially captured.
On other words, since I have two servers, clangd
and pyls
(in this order), the s:Kill()
is first invoked for clangd
and then for pyls
. The first call succeeds and registers the Exit()
callback and the second fails. However, when the Exit()
callback actually executes its a:server
actually points to the pyls
server.
It is as if the capture holds the reference to the variable and not to its value. This way the Exit()
callback tries to kill my second pyls
server, which is not active, and not the clang
server which is it was intended to kill. The clangd
server is never notified of the shutdown, hence the error message about unexpected exit.
This does not happen in vim
where the a:server
points to expected clangd
record.
Hope this makes sense...
Fixed in #201
The problem was I was using function
and as you discovered I should have been using funcref
- the latter points by reference, whereas function
points by name which was getting overwritten when there are multiple servers.
Hi,
I'm observing the following error messages each time I exit neovim:
I'm not sure if this is an issue with vim-lsc, and I want a second opinion :)
In my setup there are two language servers: clangd for cpp and pyls for python. I spent some time trying to debug this, and the exception is thrown when exiting from an editing session in which I only worked on cpp files and when vim-lsc is trying to send a request to the python language server. The following patch seems to fix things, although I'm not sure why
The bottom change is there to make sure that
s:Kill
actually returns a status, but the top change actually duplicates the check forstatus == 'running'
in theserver.request()
function. The issue does not happen with vim, so it may be a neovim bug.Some additional info
vim-lsc: ad9d2bd0582419e902bc402545da397634202ed0
relevant portion of my vimrc:
neovim version (this is from Ubuntu 19.04):