mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Fix #3294 - Fix hover off by 1, handle LSP server crashes
This commit is contained in:
@@ -264,7 +264,10 @@ function! s:OnReady(line, column, opt, linter, lsp_details) abort
|
|||||||
" hover position probably won't make sense.
|
" hover position probably won't make sense.
|
||||||
call ale#lsp#NotifyForChanges(l:id, l:buffer)
|
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)
|
let l:message = ale#lsp#message#Hover(l:buffer, a:line, l:column)
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ endfunction
|
|||||||
|
|
||||||
" Used only in tests.
|
" Used only in tests.
|
||||||
function! ale#lsp#GetConnections() abort
|
function! ale#lsp#GetConnections() abort
|
||||||
|
" This command will throw from the sandbox.
|
||||||
|
let &l:equalprg=&l:equalprg
|
||||||
|
|
||||||
return s:connections
|
return s:connections
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -449,6 +452,7 @@ function! ale#lsp#StartProgram(conn_id, executable, command) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if l:started && !l:conn.is_tsserver
|
if l:started && !l:conn.is_tsserver
|
||||||
|
let l:conn.initialized = 0
|
||||||
call s:SendInitMessage(l:conn)
|
call s:SendInitMessage(l:conn)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -422,3 +422,13 @@ Execute(Deferred addresses should be handled correctly):
|
|||||||
Assert Start()
|
Assert Start()
|
||||||
call ale#test#FlushJobs()
|
call ale#test#FlushJobs()
|
||||||
call AssertInitSuccess('foo', 'localhost:1234', 'foobar', '/foo/bar', '')
|
call AssertInitSuccess('foo', 'localhost:1234', 'foobar', '/foo/bar', '')
|
||||||
|
|
||||||
|
Execute(Servers that have crashed should be restarted):
|
||||||
|
call ale#lsp#Register('foo', '/foo/bar', {})
|
||||||
|
call extend(ale#lsp#GetConnections()['foo:/foo/bar'], {'initialized': 1})
|
||||||
|
|
||||||
|
" Starting the program again should reset initialized to `0`.
|
||||||
|
call ale#lsp#StartProgram('foo:/foo/bar', 'foobar', 'foobar --start')
|
||||||
|
|
||||||
|
AssertEqual 0, ale#lsp#GetConnections()['foo:/foo/bar']['initialized']
|
||||||
|
AssertEqual ['initialize'], map(PopMessages(), 'v:val[''method'']')
|
||||||
|
|||||||
Reference in New Issue
Block a user