From 5810d7faa0fe1fe8ae91c6bceb7dde518646a387 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 30 Jul 2017 22:17:29 +0100 Subject: [PATCH] Add some error message handling for LSP, for test purposes --- autoload/ale/engine.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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'