#2132 Use an on-init callback for all LSP logic

This commit is contained in:
w0rp
2019-02-13 00:31:33 +00:00
parent e88243687a
commit 1ee56713b8
14 changed files with 181 additions and 192 deletions

View File

@@ -34,16 +34,19 @@ Before:
\ })
let g:ale_linters = {'foobar': ['dummy_linter']}
function! ale#lsp_linter#StartLSP(buffer, linter) abort
function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {})
call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer)
return {
let l:details = {
\ 'buffer': a:buffer,
\ 'connection_id': g:conn_id,
\ 'project_root': '/foo/bar',
\ 'language_id': 'foobar',
\}
call a:Callback(a:linter, l:details)
return 1
endfunction
" Replace the Send function for LSP, so we can monitor calls to it.
@@ -61,6 +64,7 @@ After:
unlet! b:ale_enabled
unlet! b:ale_linters
unlet! g:message_list
unlet! b:ale_save_event_fired
delfunction LanguageCallback
delfunction ProjectRootCallback

View File

@@ -24,6 +24,7 @@ Execute(Command formatting should be applied correctly for LSP linters):
\ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': '%e --foo',
\ },
\ {-> 0}
\)
if has('win32')

View File

@@ -10,7 +10,7 @@ Before:
\ 'config': {},
\ 'callback_list': [],
\ 'message_queue': [],
\ 'capabilities_queue': [],
\ 'init_queue': [],
\ 'capabilities': {
\ 'hover': 0,
\ 'references': 0,