summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-09-08 22:19:13 +0100
committerw0rp <devw0rp@gmail.com>2020-09-08 22:19:13 +0100
commit6a367e44aa0feddd63b0e6d9505e21ca4442247e (patch)
treedde33e4215fdcd0848c170fc4eeffb9ac851693a
parent7d90ff56d96d601478f00895e009ae63a7d8b4bb (diff)
downloadale-6a367e44aa0feddd63b0e6d9505e21ca4442247e.zip
Close #3003 - Show ignored linters in :ALEInfo
-rw-r--r--autoload/ale.vim8
-rw-r--r--autoload/ale/debugging.vim13
-rw-r--r--autoload/ale/linter.vim10
-rw-r--r--test/test_ale_info.vader27
4 files changed, 51 insertions, 7 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim
index 5ec22f57..84003993 100644
--- a/autoload/ale.vim
+++ b/autoload/ale.vim
@@ -100,13 +100,7 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort
" Use the filetype from the buffer
let l:filetype = getbufvar(a:buffer, '&filetype')
let l:linters = ale#linter#Get(l:filetype)
-
- " Apply ignore lists for linters only if needed.
- let l:ignore_config = ale#Var(a:buffer, 'linters_ignore')
- let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp')
- let l:linters = !empty(l:ignore_config) || l:disable_lsp
- \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config, l:disable_lsp)
- \ : l:linters
+ let l:linters = ale#linter#RemoveIgnored(a:buffer, l:filetype, l:linters)
" Tell other sources that they can start checking the buffer now.
let g:ale_want_results_buffer = a:buffer
diff --git a/autoload/ale/debugging.vim b/autoload/ale/debugging.vim
index 4e134f8c..5e6d5906 100644
--- a/autoload/ale/debugging.vim
+++ b/autoload/ale/debugging.vim
@@ -8,6 +8,7 @@ let s:global_variable_list = [
\ 'ale_completion_delay',
\ 'ale_completion_enabled',
\ 'ale_completion_max_suggestions',
+\ 'ale_disable_lsp',
\ 'ale_echo_cursor',
\ 'ale_echo_msg_error_str',
\ 'ale_echo_msg_format',
@@ -28,6 +29,7 @@ let s:global_variable_list = [
\ 'ale_linter_aliases',
\ 'ale_linters',
\ 'ale_linters_explicit',
+\ 'ale_linters_ignore',
\ 'ale_list_vertical',
\ 'ale_list_window_size',
\ 'ale_loclist_msg_format',
@@ -196,6 +198,7 @@ function! s:EchoLSPErrorMessages(all_linter_names) abort
endfunction
function! ale#debugging#Info() abort
+ let l:buffer = bufnr('')
let l:filetype = &filetype
" We get the list of enabled linters for free by the above function.
@@ -222,10 +225,20 @@ function! ale#debugging#Info() abort
let l:fixers = uniq(sort(l:fixers[0] + l:fixers[1]))
let l:fixers_string = join(map(copy(l:fixers), '"\n " . v:val'), '')
+ let l:non_ignored_names = map(
+ \ copy(ale#linter#RemoveIgnored(l:buffer, l:filetype, l:enabled_linters)),
+ \ 'v:val[''name'']',
+ \)
+ let l:ignored_names = filter(
+ \ copy(l:enabled_names),
+ \ 'index(l:non_ignored_names, v:val) < 0'
+ \)
+
call s:Echo(' Current Filetype: ' . l:filetype)
call s:Echo('Available Linters: ' . string(l:all_names))
call s:EchoLinterAliases(l:all_linters)
call s:Echo(' Enabled Linters: ' . string(l:enabled_names))
+ call s:Echo(' Ignored Linters: ' . string(l:ignored_names))
call s:Echo(' Suggested Fixers: ' . l:fixers_string)
call s:Echo(' Linter Variables:')
call s:Echo('')
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim
index b483fc19..645c25f9 100644
--- a/autoload/ale/linter.vim
+++ b/autoload/ale/linter.vim
@@ -394,6 +394,16 @@ function! ale#linter#Get(original_filetypes) abort
return reverse(l:combined_linters)
endfunction
+function! ale#linter#RemoveIgnored(buffer, filetype, linters) abort
+ " Apply ignore lists for linters only if needed.
+ let l:ignore_config = ale#Var(a:buffer, 'linters_ignore')
+ let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp')
+
+ return !empty(l:ignore_config) || l:disable_lsp
+ \ ? ale#engine#ignore#Exclude(a:filetype, a:linters, l:ignore_config, l:disable_lsp)
+ \ : a:linters
+endfunction
+
" Given a buffer and linter, get the executable String for the linter.
function! ale#linter#GetExecutable(buffer, linter) abort
let l:Executable = a:linter.executable
diff --git a/test/test_ale_info.vader b/test/test_ale_info.vader
index 2bc8c635..895ed2a7 100644
--- a/test/test_ale_info.vader
+++ b/test/test_ale_info.vader
@@ -6,6 +6,7 @@ Before:
Save g:ale_completion_delay
Save g:ale_completion_enabled
Save g:ale_completion_max_suggestions
+ Save g:ale_disable_lsp
Save g:ale_echo_cursor
Save g:ale_echo_msg_error_str
Save g:ale_echo_msg_format
@@ -24,6 +25,7 @@ Before:
Save g:ale_lint_on_text_changed
Save g:ale_linters
Save g:ale_linters_explicit
+ Save g:ale_linters_ignore
Save g:ale_list_vertical
Save g:ale_list_window_size
Save g:ale_loclist_msg_format
@@ -64,6 +66,7 @@ Before:
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = 50
+ let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
@@ -80,6 +83,7 @@ Before:
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linters_explicit = 0
+ let g:ale_linters_ignore = {'python': ['pyright']}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
@@ -138,6 +142,7 @@ Before:
\ 'let g:ale_completion_delay = 100',
\ 'let g:ale_completion_enabled = 0',
\ 'let g:ale_completion_max_suggestions = 50',
+ \ 'let g:ale_disable_lsp = 0',
\ 'let g:ale_echo_cursor = 1',
\ 'let g:ale_echo_msg_error_str = ''Error''',
\ 'let g:ale_echo_msg_format = ''%code: %%s''',
@@ -158,6 +163,7 @@ Before:
\ 'let g:ale_linter_aliases = {}',
\ 'let g:ale_linters = {}',
\ 'let g:ale_linters_explicit = 0',
+ \ 'let g:ale_linters_ignore = {''python'': [''pyright'']}',
\ 'let g:ale_list_vertical = 0',
\ 'let g:ale_list_window_size = 10',
\ 'let g:ale_loclist_msg_format = ''%code: %%s''',
@@ -243,6 +249,7 @@ Execute (ALEInfo with no linters should return the right output):
\ ' Current Filetype: nolintersft',
\ 'Available Linters: []',
\ ' Enabled Linters: []',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -265,6 +272,7 @@ Execute (ALEInfo should return buffer-local global ALE settings):
\ ' Current Filetype: ',
\ 'Available Linters: []',
\ ' Enabled Linters: []',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -279,6 +287,7 @@ Execute (ALEInfo with no filetype should return the right output):
\ ' Current Filetype: ',
\ 'Available Linters: []',
\ ' Enabled Linters: []',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -295,6 +304,7 @@ Execute (ALEInfo with a single linter should return the right output):
\ ' Current Filetype: testft',
\ 'Available Linters: [''testlinter1'']',
\ ' Enabled Linters: [''testlinter1'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -312,6 +322,7 @@ Execute (ALEInfo with two linters should return the right output):
\ ' Current Filetype: testft',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -333,6 +344,7 @@ Execute (ALEInfo should calculate enabled linters correctly):
\ ' Current Filetype: testft',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -350,6 +362,7 @@ Execute (ALEInfo should only return linters for current filetype):
\ ' Current Filetype: testft',
\ 'Available Linters: [''testlinter1'']',
\ ' Enabled Linters: [''testlinter1'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -367,6 +380,7 @@ Execute (ALEInfo with compound filetypes should return linters for both of them)
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -389,6 +403,7 @@ Execute (ALEInfo should return appropriately named global variables):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + [
@@ -420,6 +435,7 @@ Execute (ALEInfoToFile should write to a file correctly):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + [
@@ -447,6 +463,7 @@ Execute (ALEInfo should buffer-local linter variables):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + [
@@ -478,6 +495,7 @@ Execute (ALEInfo should output linter aliases):
\ '''testlinter1'' -> [''testftalias1'', ''testftalias2'']',
\ '''testlinter2'' -> [''testftalias3'', ''testftalias4'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + [
@@ -505,6 +523,7 @@ Execute (ALEInfo should return command history):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -532,6 +551,7 @@ Execute (ALEInfo command history should print exit codes correctly):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -580,6 +600,7 @@ Execute (ALEInfo command history should print command output if logging is on):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -618,6 +639,7 @@ Execute (ALEInfo should include executable checks in the history):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'']',
\ ' Enabled Linters: [''testlinter1'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -647,6 +669,7 @@ Execute (The option for caching failing executable checks should work):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'']',
\ ' Enabled Linters: [''testlinter1'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -669,6 +692,7 @@ Execute (LSP errors for a linter should be outputted):
\ ' Current Filetype: testft',
\ 'Available Linters: [''testlinter1'']',
\ ' Enabled Linters: [''testlinter1'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -693,6 +717,7 @@ Execute (LSP errors for other linters shouldn't appear):
\ ' Current Filetype: testft',
\ 'Available Linters: [''testlinter1'']',
\ ' Enabled Linters: [''testlinter1'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -715,6 +740,7 @@ Execute (ALEInfo should include linter global options):
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines
@@ -740,6 +766,7 @@ Execute (ALEInfo should include linter global options for enabled linters):
\ ' Current Filetype: testft',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'']',
+ \ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
\ + g:variables_lines