diff options
author | w0rp <devw0rp@gmail.com> | 2017-07-30 23:34:58 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-07-30 23:34:58 +0100 |
commit | 2c252c0f12868c5bbe9a00bd8bc37b32ae3802c4 (patch) | |
tree | 25d7576f34e756aed31c22dadf16ec116dbba545 /autoload | |
parent | 6000d956f0a3e217c3a0563abef738616feb73e6 (diff) | |
download | ale-2c252c0f12868c5bbe9a00bd8bc37b32ae3802c4.zip |
#517 - Get the Rust language server working in a basic way
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/linter.vim | 6 | ||||
-rw-r--r-- | autoload/ale/lsp.vim | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim index 0af42af9..8fc68510 100644 --- a/autoload/ale/linter.vim +++ b/autoload/ale/linter.vim @@ -377,6 +377,12 @@ function! ale#linter#StartLSP(buffer, linter, callback) abort let l:address = '' let l:root = ale#util#GetFunction(a:linter.project_root_callback)(a:buffer) + if empty(l:root) && a:linter.lsp !=# 'tsserver' + " If there's no project root, then we can't check files with LSP, + " unless we are using tsserver, which doesn't use project roots. + return {} + endif + if a:linter.lsp ==# 'socket' let l:address = ale#linter#GetAddress(a:buffer, a:linter) let l:conn_id = ale#lsp#ConnectToAddress( diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim index 855abb11..eb66eb47 100644 --- a/autoload/ale/lsp.vim +++ b/autoload/ale/lsp.vim @@ -190,7 +190,13 @@ function! ale#lsp#HandleOtherInitializeResponses(conn, response) abort return endif - if get(a:response, 'method', '') ==# 'textDocument/publishDiagnostics' + if get(a:response, 'method', '') ==# '' + if has_key(get(a:response, 'result', {}), 'capabilities') + for [l:dir, l:project] in l:uninitialized_projects + call s:MarkProjectAsInitialized(a:conn, l:project) + endfor + endif + elseif get(a:response, 'method', '') ==# 'textDocument/publishDiagnostics' let l:filename = ale#path#FromURI(a:response.params.uri) for [l:dir, l:project] in l:uninitialized_projects @@ -237,7 +243,7 @@ function! s:HandleCommandMessage(job_id, message) abort endfunction function! s:RegisterProject(conn, project_root) abort - if !has_key(a:conn, a:project_root) + if !has_key(a:conn.projects, a:project_root) " Tools without project roots are ready right away, like tsserver. let a:conn.projects[a:project_root] = { \ 'initialized': empty(a:project_root), |