Close #3003 - Show ignored linters in :ALEInfo

This commit is contained in:
w0rp 2020-09-08 22:19:13 +01:00
parent 7d90ff56d9
commit 6a367e44aa
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
4 changed files with 51 additions and 7 deletions

View File

@ -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

View File

@ -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('')

View File

@ -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

View File

@ -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