-
Notifications
You must be signed in to change notification settings - Fork 273
Description
It looks like if the LSP that the plugin has connected to dies for any reason, then LanguageClient-neovim does not detect this error case, and just spews "broken pipe" errors until the language support is restarted. I would instead expect the plugin to detect this error case and automatically connect to a new LSP.
I was able to reproduce this across a couple of different environments/languages. I first noticed it with an in-house language/LSP at work (which for reasons I won't go into loves to restart itself). Sadly this one is not public right now so I can't link that one, but I was able to reproduce exactly the same behaviour with rls using kilall rls to simulate a crash.
I've gone ahead and filled out the below for the nvim/rls case, though this is quite easy to reproduce.
- neovim/vim version: neovim 0.2.0
- Plugin version (git SHA): 63af88b
- Minimal vimrc:
call plug#begin()
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
call plug#end()
augroup filetype_rust
autocmd!
autocmd BufReadPost *.rs setlocal filetype=rust
augroup END
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'stable', 'rls'],
\ }
let g:LanguageClient_loggingLevel = 'DEBUG'
nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
- Language server name/link and version: rls-preview 0.124.0-stable (299a6a9 2017-12-25)
- Reproduction steps (from clean state)
- Edit any rust file, e.g.,
nvim main.rs - Press
K(hover), no error. - In another terminal,
killall rlsto simulate an LSP crash. - Press
Kagain (or any other LSP action), get onlyBroken pipe (os error 32)which the plugin fails to recover from.
- Edit any rust file, e.g.,
/tmp/LanguageServer.log: empty/tmp/LanguageClient.log: quite long, here's the relevant bit at the end (can include the whole thing if you want, though again this is quite easy to reproduce):
2018-03-03T19:03:56.569898910+00:00 INFO languageclient::vim - <= {"id": 1, "jsonrpc": "2.0", "method": "textDocument/hover", "params": {"character": 0, "handle": true, "languageId": "rust", "line": 0, "buftype": "", "filename": "/home/josh/test/src/main.rs"}}
2018-03-03T19:03:56.570657774+00:00 INFO languageclient::languageclient - Begin textDocument/hover
2018-03-03T19:03:56.570709700+00:00 INFO languageclient::languageclient - gather_args: [LanguageId, Filename, Line, Character, Handle] = [String("rust"), String("/home/josh/test/src/main.rs"), Number(0), Number(0), Bool(true)]
2018-03-03T19:03:56.571082889+00:00 DEBUG languageclient::vim - state.id: 11 ==> 12
2018-03-03T19:03:56.571376175+00:00 INFO languageclient::vim - => {"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":0,"line":0},"textDocument":{"uri":"file:///home/josh/test/src/main.rs"}},"id":12}
2018-03-03T19:03:56.572328841+00:00 INFO languageclient::vim - <= {"jsonrpc":"2.0","id":12,"result":{"contents":[],"range":null}}
2018-03-03T19:03:56.572773794+00:00 INFO languageclient::vim - => {"jsonrpc":"2.0","method":"execute","params":["echo ''"]}
2018-03-03T19:03:56.572811059+00:00 INFO languageclient::languageclient - End textDocument/hover
2018-03-03T19:03:56.572831314+00:00 INFO languageclient::vim - => {"jsonrpc":"2.0","result":{"contents":[],"range":null},"id":1}
2018-03-03T19:03:59.557818538+00:00 ERROR languageclient::languageclient - RPC-rust thread error: failed to fill whole buffer
2018-03-03T19:04:00.527327477+00:00 INFO languageclient::vim - <= {"id": 2, "jsonrpc": "2.0", "method": "textDocument/hover", "params": {"character": 0, "handle": true, "languageId": "rust", "line": 0, "buftype": "", "filename": "/home/josh/test/src/main.rs"}}
2018-03-03T19:04:00.528061035+00:00 INFO languageclient::languageclient - Begin textDocument/hover
2018-03-03T19:04:00.528092130+00:00 INFO languageclient::languageclient - gather_args: [LanguageId, Filename, Line, Character, Handle] = [String("rust"), String("/home/josh/test/src/main.rs"), Number(0), Number(0), Bool(true)]
2018-03-03T19:04:00.528332051+00:00 DEBUG languageclient::vim - state.id: 12 ==> 13
2018-03-03T19:04:00.528597770+00:00 INFO languageclient::vim - => {"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":0,"line":0},"textDocument":{"uri":"file:///home/josh/test/src/main.rs"}},"id":13}
2018-03-03T19:04:00.528786347+00:00 ERROR languageclient::vim - Error handling message. Message: {"id": 2, "jsonrpc": "2.0", "method": "textDocument/hover", "params": {"character": 0, "handle": true, "languageId": "rust", "line": 0, "buftype": "", "filename": "/home/josh/test/src/main.rs"}}. Error: Err(Error { repr: Os { code: 32, message: "Broken pipe" } })
2018-03-03T19:04:00.528811260+00:00 INFO languageclient::vim - => {"jsonrpc":"2.0","error":{"code":-32603,"message":"Broken pipe (os error 32)"},"id":2}