summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalius Dobravolskas <daliusd@wix.com>2020-09-23 16:08:14 +0300
committerDalius Dobravolskas <dalius.dobravolskas@gmail.com>2020-11-21 15:49:41 +0200
commit2ab46d4b8e9611e25cd880ee1f4b4a71b59f0446 (patch)
treed304026ca5d9a3920de4d208b5e93f4f29cb7e16
parentd0b5909fd8cb96fa65363af44d02eb0038c6112c (diff)
downloadale-2ab46d4b8e9611e25cd880ee1f4b4a71b59f0446.zip
Show tsserver hints/suggestions in Ale.
-rw-r--r--autoload/ale/lsp_linter.vim12
1 files changed, 11 insertions, 1 deletions
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim
index dcd76e8f..6c286f9c 100644
--- a/autoload/ale/lsp_linter.vim
+++ b/autoload/ale/lsp_linter.vim
@@ -85,12 +85,18 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endif
let l:info.syntax_loclist = l:thislist
- else
+ elseif a:error_type is# 'semantic'
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
+ else
+ if len(l:thislist) is 0 && len(get(l:info, 'suggestion_loclist', [])) is 0
+ let l:no_changes = 1
+ endif
+
+ let l:info.suggestion_loclist = l:thislist
endif
if l:no_changes
@@ -98,6 +104,7 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endif
let l:loclist = get(l:info, 'semantic_loclist', [])
+ \ + get(l:info, 'suggestion_loclist', [])
\ + get(l:info, 'syntax_loclist', [])
call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist, 0)
@@ -150,6 +157,9 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
elseif get(a:response, 'type', '') is# 'event'
\&& get(a:response, 'event', '') is# 'syntaxDiag'
call s:HandleTSServerDiagnostics(a:response, 'syntax')
+ elseif get(a:response, 'type', '') is# 'event'
+ \&& get(a:response, 'event', '') is# 'suggestionDiag'
+ call s:HandleTSServerDiagnostics(a:response, 'suggestion')
endif
endfunction