diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_engine_lsp_response_handling.vader | 44 | ||||
-rw-r--r-- | test/test_redundant_tsserver_rendering_avoided.vader | 2 |
2 files changed, 45 insertions, 1 deletions
diff --git a/test/test_engine_lsp_response_handling.vader b/test/test_engine_lsp_response_handling.vader index 04f12ad6..84febe39 100644 --- a/test/test_engine_lsp_response_handling.vader +++ b/test/test_engine_lsp_response_handling.vader @@ -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, { diff --git a/test/test_redundant_tsserver_rendering_avoided.vader b/test/test_redundant_tsserver_rendering_avoided.vader index a292b014..6e0b2d30 100644 --- a/test/test_redundant_tsserver_rendering_avoided.vader +++ b/test/test_redundant_tsserver_rendering_avoided.vader @@ -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 |