diff options
author | w0rp <devw0rp@gmail.com> | 2019-05-10 13:42:41 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-05-10 13:42:41 +0100 |
commit | 79e42fed14b35767d53d7d443a644a037e012b89 (patch) | |
tree | 9c9c1bef9cda93deeea57506f021a9054632f511 /test/test_ignoring_linters.vader | |
parent | f444abdfe66696505cb891889b18c4144d12d4ea (diff) | |
download | ale-79e42fed14b35767d53d7d443a644a037e012b89.zip |
#2403 - Make ale_disable_lsp apply consistently, and document it better
Diffstat (limited to 'test/test_ignoring_linters.vader')
-rw-r--r-- | test/test_ignoring_linters.vader | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/test/test_ignoring_linters.vader b/test/test_ignoring_linters.vader index 2d9c67de..f2e9e5c9 100644 --- a/test/test_ignoring_linters.vader +++ b/test/test_ignoring_linters.vader @@ -300,3 +300,98 @@ Execute(Buffer ignore lists should be applied for LSP linters): call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) AssertEqual [], g:loclist + +Execute(ale_disable_lsp should be applied for tsserver): + call ale#test#SetFilename('filename.ts') + call ale#engine#InitBufferInfo(bufnr('')) + + let g:lsp_message = { + \ 'seq': 0, + \ 'type': 'event', + \ 'event': 'syntaxDiag', + \ 'body': { + \ 'file': g:dir . '/filename.ts', + \ 'diagnostics':[ + \ { + \ 'start': { + \ 'line':2, + \ 'offset':14, + \ }, + \ 'end': { + \ 'line':2, + \ 'offset':15, + \ }, + \ 'text': ''','' expected.', + \ "code":1005 + \ }, + \ ], + \ }, + \} + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual + \ [ + \ { + \ 'lnum': 2, + \ 'col': 14, + \ 'nr': 1005, + \ 'code': '1005', + \ 'type': 'E', + \ 'end_col': 15, + \ 'end_lnum': 2, + \ 'text': ''','' expected.', + \ }, + \ ], + \ g:loclist + + let g:loclist = [] + let b:ale_disable_lsp = 1 + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual [], g:loclist + +Execute(ale_disable_lsp should be applied for LSP linters): + call ale#test#SetFilename('filename.py') + call ale#engine#InitBufferInfo(bufnr('')) + call ale#lsp_linter#SetLSPLinterMap({'347': 'lsplinter'}) + + let g:lsp_message = { + \ 'jsonrpc': '2.0', + \ 'method': 'textDocument/publishDiagnostics', + \ 'params': { + \ 'uri': ale#path#ToURI(expand('%:p')), + \ 'diagnostics': [ + \ { + \ 'severity': 1, + \ 'message': 'x', + \ 'range': { + \ 'start': {'line': 0, 'character': 9}, + \ 'end': {'line': 0, 'character': 9}, + \ }, + \ } + \ ], + \ }, + \} + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 10, + \ 'type': 'E', + \ 'end_col': 9, + \ 'end_lnum': 1, + \ 'text': 'x', + \ } + \ ], + \ g:loclist + + let b:ale_disable_lsp = 1 + let g:loclist = [] + + call ale#lsp_linter#HandleLSPResponse(347, g:lsp_message) + + AssertEqual [], g:loclist |