Fix #3294 - Fix hover off by 1, handle LSP server crashes

This commit is contained in:
w0rp
2020-08-18 01:48:07 +01:00
parent bc6304bdb0
commit 4df352eee5
3 changed files with 18 additions and 1 deletions

View File

@@ -264,7 +264,10 @@ function! s:OnReady(line, column, opt, linter, lsp_details) abort
" hover position probably won't make sense.
call ale#lsp#NotifyForChanges(l:id, l:buffer)
let l:column = min([a:column, len(getbufline(l:buffer, a:line)[0])])
let l:column = max([
\ min([a:column, len(getbufline(l:buffer, a:line)[0])]),
\ 1,
\])
let l:message = ale#lsp#message#Hover(l:buffer, a:line, l:column)
endif

View File

@@ -64,6 +64,9 @@ endfunction
" Used only in tests.
function! ale#lsp#GetConnections() abort
" This command will throw from the sandbox.
let &l:equalprg=&l:equalprg
return s:connections
endfunction
@@ -449,6 +452,7 @@ function! ale#lsp#StartProgram(conn_id, executable, command) abort
endif
if l:started && !l:conn.is_tsserver
let l:conn.initialized = 0
call s:SendInitMessage(l:conn)
endif