summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-09-18 17:43:17 +0100
committerw0rp <devw0rp@gmail.com>2018-09-18 17:43:17 +0100
commit213a901ccd237903c7decb00696418e1abc930c9 (patch)
tree2219e3fac3cd1812e3b58f10eff7b8b189ad1a56 /autoload
parentddb3e6d57acfc9081f8c6846d896542014e3024b (diff)
downloadale-213a901ccd237903c7decb00696418e1abc930c9.zip
Stop tsserver from causing errors to be rendered redundantly
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/lsp_linter.vim16
1 files changed, 15 insertions, 1 deletions
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim
index 8fbad12f..a11c76bc 100644
--- a/autoload/ale/lsp_linter.vim
+++ b/autoload/ale/lsp_linter.vim
@@ -55,16 +55,29 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endif
let l:thislist = ale#lsp#response#ReadTSServerDiagnostics(a:response)
+ let l:no_changes = 0
" tsserver sends syntax and semantic errors in separate messages, so we
" have to collect the messages separately for each buffer and join them
" back together again.
if a:error_type is# 'syntax'
+ if len(l:thislist) is 0 && len(get(l:info, 'syntax_loclist', [])) is 0
+ let l:no_changes = 1
+ endif
+
let l:info.syntax_loclist = l:thislist
else
+ if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0
+ let l:no_changes = 1
+ endif
+
let l:info.semantic_loclist = l:thislist
endif
+ if l:no_changes
+ return
+ endif
+
let l:loclist = get(l:info, 'semantic_loclist', [])
\ + get(l:info, 'syntax_loclist', [])
@@ -99,9 +112,10 @@ endfunction
function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
let l:method = get(a:response, 'method', '')
- let l:linter_name = get(s:lsp_linter_map, a:conn_id, '')
if get(a:response, 'jsonrpc', '') is# '2.0' && has_key(a:response, 'error')
+ let l:linter_name = get(s:lsp_linter_map, a:conn_id, '')
+
call s:HandleLSPErrorMessage(l:linter_name, a:response)
elseif l:method is# 'textDocument/publishDiagnostics'
call s:HandleLSPDiagnostics(a:conn_id, a:response)