Fix #2415 - Mark tsserver and LSP linters inactive again
This commit is contained in:
parent
fa18195e34
commit
711de2c1be
4 changed files with 55 additions and 6 deletions
|
@ -39,8 +39,8 @@ function! ale#engine#MarkLinterActive(info, linter) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#engine#MarkLinterInactive(info, linter) abort
|
||||
call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter.name')
|
||||
function! ale#engine#MarkLinterInactive(info, linter_name) abort
|
||||
call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter_name')
|
||||
endfunction
|
||||
|
||||
function! ale#engine#ResetExecutableCache() abort
|
||||
|
@ -195,7 +195,7 @@ function! s:HandleExit(job_info, buffer, output, data) abort
|
|||
let l:next_chain_index = a:job_info.next_chain_index
|
||||
|
||||
" Remove this job from the list.
|
||||
call ale#engine#MarkLinterInactive(l:buffer_info, l:linter)
|
||||
call ale#engine#MarkLinterInactive(l:buffer_info, l:linter.name)
|
||||
|
||||
" Stop here if we land in the handle for a job completing if we're in
|
||||
" a sandbox.
|
||||
|
|
|
@ -27,12 +27,15 @@ function! s:HandleLSPDiagnostics(conn_id, response) abort
|
|||
let l:linter_name = s:lsp_linter_map[a:conn_id]
|
||||
let l:filename = ale#path#FromURI(a:response.params.uri)
|
||||
let l:buffer = bufnr(l:filename)
|
||||
let l:info = get(g:ale_buffer_info, l:buffer, {})
|
||||
|
||||
if s:ShouldIgnore(l:buffer, l:linter_name)
|
||||
if empty(l:info)
|
||||
return
|
||||
endif
|
||||
|
||||
if l:buffer <= 0
|
||||
call ale#engine#MarkLinterInactive(l:info, l:linter_name)
|
||||
|
||||
if s:ShouldIgnore(l:buffer, l:linter_name)
|
||||
return
|
||||
endif
|
||||
|
||||
|
@ -50,6 +53,8 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
|
|||
return
|
||||
endif
|
||||
|
||||
call ale#engine#MarkLinterInactive(l:info, l:linter_name)
|
||||
|
||||
if s:ShouldIgnore(l:buffer, l:linter_name)
|
||||
return
|
||||
endif
|
||||
|
|
|
@ -5,12 +5,15 @@ Before:
|
|||
let g:ale_buffer_info = {}
|
||||
|
||||
unlet! g:ale_lsp_error_messages
|
||||
unlet! b:ale_linters
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_linters
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#lsp_linter#ClearLSPData()
|
||||
|
@ -162,6 +165,47 @@ Execute(tsserver semantic error responses should be handled correctly):
|
|||
\ ],
|
||||
\ ale#test#GetLoclistWithoutModule()
|
||||
|
||||
Execute(tsserver errors should mark tsserver no longer active):
|
||||
let b:ale_linters = ['tsserver']
|
||||
runtime ale_linters/typescript/tsserver.vim
|
||||
call ale#test#SetFilename('filename.ts')
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
let g:ale_buffer_info[bufnr('')].active_linter_list = ale#linter#Get('typescript')
|
||||
Assert !empty(g:ale_buffer_info[bufnr('')].active_linter_list)
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, {
|
||||
\ 'seq': 0,
|
||||
\ 'type': 'event',
|
||||
\ 'event': 'semanticDiag',
|
||||
\ 'body': {
|
||||
\ 'file': g:dir . '/filename.ts',
|
||||
\ 'diagnostics':[],
|
||||
\ },
|
||||
\})
|
||||
|
||||
AssertEqual [], g:ale_buffer_info[bufnr('')].active_linter_list
|
||||
|
||||
Execute(LSP errors should mark linters no longer active):
|
||||
let b:ale_linters = ['pyls']
|
||||
runtime ale_linters/python/pyls.vim
|
||||
call ale#test#SetFilename('filename.py')
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
call ale#lsp_linter#SetLSPLinterMap({1: 'pyls'})
|
||||
|
||||
let g:ale_buffer_info[bufnr('')].active_linter_list = ale#linter#Get('python')
|
||||
Assert !empty(g:ale_buffer_info[bufnr('')].active_linter_list)
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, {
|
||||
\ 'method': 'textDocument/publishDiagnostics',
|
||||
\ 'params': {
|
||||
\ 'uri': ale#path#ToURI(g:dir . '/filename.py'),
|
||||
\ 'diagnostics': [],
|
||||
\ },
|
||||
\})
|
||||
|
||||
AssertEqual [], g:ale_buffer_info[bufnr('')].active_linter_list
|
||||
|
||||
Execute(LSP errors should be logged in the history):
|
||||
call ale#lsp_linter#SetLSPLinterMap({'347': 'foobar'})
|
||||
call ale#lsp_linter#HandleLSPResponse(347, {
|
||||
|
|
|
@ -42,7 +42,7 @@ Before:
|
|||
|
||||
runtime autoload/ale/engine.vim
|
||||
|
||||
let g:ale_buffer_info = {bufnr(''): {'loclist': []}}
|
||||
let g:ale_buffer_info = {bufnr(''): {'loclist': [], 'active_linter_list': []}}
|
||||
let g:ale_handle_loclist_called = 0
|
||||
|
||||
function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort
|
||||
|
|
Reference in a new issue