summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-30 22:17:29 +0100
committerw0rp <devw0rp@gmail.com>2017-07-30 22:17:29 +0100
commit5810d7faa0fe1fe8ae91c6bceb7dde518646a387 (patch)
treed75711bf2bac703761abca1120bd537ed3aefb34 /autoload
parent84af543907e222dd6035a37f7a7b9a99b9fd11ad (diff)
downloadale-5810d7faa0fe1fe8ae91c6bceb7dde518646a387.zip
Add some error message handling for LSP, for test purposes
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/engine.vim13
1 files changed, 12 insertions, 1 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index d66126ab..455772f3 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -225,10 +225,21 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
call s:HandleLoclist('tsserver', l:buffer, l:loclist)
endfunction
+function! s:HandleLSPErrorMessage(error_message) abort
+ echoerr 'Error from LSP:'
+
+ for l:line in split(a:error_message, "\n")
+ echoerr l:line
+ endfor
+endfunction
+
function! ale#engine#HandleLSPResponse(response) abort
let l:method = get(a:response, 'method', '')
- if l:method ==# 'textDocument/publishDiagnostics'
+ if get(a:response, 'jsonrpc', '') ==# '2.0' && has_key(a:response, 'error')
+ " Uncomment this line to print LSP error messages.
+ " call s:HandleLSPErrorMessage(a:response.error.message)
+ elseif l:method ==# 'textDocument/publishDiagnostics'
call s:HandleLSPDiagnostics(a:response)
elseif get(a:response, 'type', '') ==# 'event'
\&& get(a:response, 'event', '') ==# 'semanticDiag'