summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-04-17 18:12:25 +0100
committerw0rp <devw0rp@gmail.com>2019-04-17 18:12:50 +0100
commitfcc2c3ba71afa2a7965f3c1e9ec8c03381178180 (patch)
treed5b7d8d10cbb7f2934c9a9a0d2b7c636443d2bb5 /test
parent2eb68f6d23f51c33f3d64a15172c869e71d7829b (diff)
downloadale-fcc2c3ba71afa2a7965f3c1e9ec8c03381178180.zip
Fix #2415 - Mark tsserver and LSP linters inactive again
Diffstat (limited to 'test')
-rw-r--r--test/test_engine_lsp_response_handling.vader44
-rw-r--r--test/test_redundant_tsserver_rendering_avoided.vader2
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