diff options
author | Horacio Sanson <hsanson@gmail.com> | 2021-01-20 20:40:44 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-20 20:40:44 +0900 |
commit | 783cf4ab8295ef5ff5b443c045dcdfee6f6dbac7 (patch) | |
tree | 3a62aaa90c0e92dec26e4c746acd56093b3c63a7 /autoload | |
parent | bfc412a77ba108b1529f48548def8b0ab56e95a1 (diff) | |
parent | 81d16823a7ff5972d2a352831053f3cd6922b6c3 (diff) | |
download | ale-783cf4ab8295ef5ff5b443c045dcdfee6f6dbac7.zip |
Merge pull request #3362 from daliusd/tsserver_hints
Show tsserver hints/suggestions in Ale.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/lsp_linter.vim | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim index dcd76e8f..628dde78 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,10 @@ 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' + \&& get(g:, 'ale_lsp_suggestions', '1') == 1 + call s:HandleTSServerDiagnostics(a:response, 'suggestion') endif endfunction |