diff options
-rw-r--r-- | autoload/ale/debugging.vim | 8 | ||||
-rw-r--r-- | test/test_ale_info.vader | 42 |
2 files changed, 50 insertions, 0 deletions
diff --git a/autoload/ale/debugging.vim b/autoload/ale/debugging.vim index 60c1b37c..f42c9e82 100644 --- a/autoload/ale/debugging.vim +++ b/autoload/ale/debugging.vim @@ -51,12 +51,20 @@ endfunction function! s:EchoLinterVariables(variable_list) abort for l:key in a:variable_list echom 'let g:' . l:key . ' = ' . string(g:[l:key]) + + if has_key(b:, l:key) + echom 'let b:' . l:key . ' = ' . string(b:[l:key]) + endif endfor endfunction function! s:EchoGlobalVariables() abort for l:key in s:global_variable_list echom 'let g:' . l:key . ' = ' . string(get(g:, l:key, v:null)) + + if has_key(b:, l:key) + echom 'let b:' . l:key . ' = ' . string(b:[l:key]) + endif endfor endfunction diff --git a/test/test_ale_info.vader b/test/test_ale_info.vader index d5a8ed62..83d32cb0 100644 --- a/test/test_ale_info.vader +++ b/test/test_ale_info.vader @@ -37,6 +37,7 @@ Before: let g:command_header = "\n Command History:\n" After: + unlet! b:ale_linters unlet! g:output unlet! g:globals_string unlet! g:command_header @@ -45,6 +46,7 @@ After: unlet! g:ale_testft_testlinter1_foo unlet! g:ale_testft_testlinter1_bar unlet! g:ale_testft2_testlinter2_foo + unlet! b:ale_testft2_testlinter2_foo unlet! g:ale_testft2_testlinter2_bar Given nolintersft (Empty buffer with no linters): @@ -60,6 +62,26 @@ Execute (ALEInfo with no linters should return the right output): \" . g:globals_string . g:command_header, g:output Given (Empty buffer with no filetype): +Execute (ALEInfo should return buffer-local global ALE settings): + let b:ale_linters = {'x': ['y']} + let g:globals_string = substitute( + \ g:globals_string, + \ 'let g:ale_linters = {}', + \ "let g:ale_linters = {}\nlet b:ale_linters = {'x': ['y']}", + \ '' + \) + + redir => g:output + silent ALEInfo + redir END + AssertEqual "\n + \ Current Filetype: \n + \Available Linters: []\n + \ Enabled Linters: []\n + \ Linter Variables:\n + \" . g:globals_string . g:command_header, g:output + +Given (Empty buffer with no filetype): Execute (ALEInfo with no filetype should return the right output): redir => g:output silent ALEInfo @@ -167,6 +189,26 @@ Execute (ALEInfo should return appropriately named global variables): \ . g:globals_string . g:command_header, g:output Given testft.testft2 (Empty buffer with two filetypes): +Execute (ALEInfo should buffer-local linter variables): + let g:ale_testft2_testlinter2_foo = 123 + let b:ale_testft2_testlinter2_foo = 456 + + call ale#linter#Define('testft', g:testlinter1) + call ale#linter#Define('testft2', g:testlinter2) + redir => g:output + silent ALEInfo + redir END + AssertEqual "\n + \ Current Filetype: testft.testft2\n + \Available Linters: ['testlinter1', 'testlinter2']\n + \ Enabled Linters: ['testlinter1', 'testlinter2']\n + \ Linter Variables:\n + \\n + \let g:ale_testft2_testlinter2_foo = 123\n + \let b:ale_testft2_testlinter2_foo = 456" + \ . g:globals_string . g:command_header, g:output + +Given testft.testft2 (Empty buffer with two filetypes): Execute (ALEInfo should return command history): let g:ale_buffer_info[bufnr('%')] = { \ 'history': [ |