Close #3368 - Supercharge :ALEInfo

Make a series of sweeping changes to make :ALEInfo more useful.

1. Deprecate :ALEInfoToClipboard and support :ALEInfo -clipboard
2. Permit :ALEInfo -clip as a shorthand for :ALEInfo -clipboard
3. Support :ALEInfo -preview to render in the preview window
4. Support :ALEInfo -echo for the classic :ALEInfo mode
5. Change the default mode to 'preview', and make it configurable
6. Add syntax highlighting for ALEInfo in preview mode
7. Add a convenience to look up documentatation that explains itself
8. Don't show an empty 'Linter Variables' section
This commit is contained in:
w0rp 2023-09-06 00:21:58 +01:00
parent 551fbcfb09
commit 14350dbb0d
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
9 changed files with 225 additions and 103 deletions

View File

@ -42,7 +42,7 @@ Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](
### :ALEInfo ### :ALEInfo
<details> <details>
<summary>Expand</summary> <summary>Expand</summary>
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard --> <!-- Paste the output of :ALEInfo here. Try :ALEInfo -clipboard -->
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. --> <!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
<!-- Read the output. You might figure out what went wrong yourself. --> <!-- Read the output. You might figure out what went wrong yourself. -->
</details> </details>

View File

@ -1,6 +1,8 @@
" Author: w0rp <devw0rp@gmail.com> " Author: w0rp <devw0rp@gmail.com>
" Description: This file implements debugging information for ALE " Description: This file implements debugging information for ALE
let g:ale_info_default_mode = get(g:, 'ale_info_default_mode', 'preview')
let s:global_variable_list = [ let s:global_variable_list = [
\ 'ale_cache_executable_check_failures', \ 'ale_cache_executable_check_failures',
\ 'ale_change_sign_column_color', \ 'ale_change_sign_column_color',
@ -18,6 +20,7 @@ let s:global_variable_list = [
\ 'ale_fix_on_save', \ 'ale_fix_on_save',
\ 'ale_fixers', \ 'ale_fixers',
\ 'ale_history_enabled', \ 'ale_history_enabled',
\ 'ale_info_default_mode',
\ 'ale_history_log_output', \ 'ale_history_log_output',
\ 'ale_keep_list_window_open', \ 'ale_keep_list_window_open',
\ 'ale_lint_delay', \ 'ale_lint_delay',
@ -199,7 +202,10 @@ function! s:EchoLSPErrorMessages(all_linter_names) abort
endfor endfor
endfunction endfunction
function! ale#debugging#Info() abort function! ale#debugging#Info(...) abort
let l:options = (a:0 > 0) ? a:1 : {}
let l:show_preview_info = get(l:options, 'preview')
let l:buffer = bufnr('') let l:buffer = bufnr('')
let l:filetype = &filetype let l:filetype = &filetype
@ -241,13 +247,31 @@ function! ale#debugging#Info() abort
call s:EchoLinterAliases(l:all_linters) call s:EchoLinterAliases(l:all_linters)
call s:Echo(' Enabled Linters: ' . string(l:enabled_names)) call s:Echo(' Enabled Linters: ' . string(l:enabled_names))
call s:Echo(' Ignored Linters: ' . string(l:ignored_names)) call s:Echo(' Ignored Linters: ' . string(l:ignored_names))
call s:Echo(' Suggested Fixers: ' . l:fixers_string) call s:Echo(' Suggested Fixers:' . l:fixers_string)
call s:Echo(' Linter Variables:') " We use this line with only a space to know where to end highlights.
call s:Echo('') call s:Echo(' ')
call s:EchoLinterVariables(l:variable_list)
" Only show Linter Variables directive if there are any.
if !empty(l:variable_list)
call s:Echo(' Linter Variables:')
if l:show_preview_info
call s:Echo('" Press Space to read :help for a setting')
endif
call s:EchoLinterVariables(l:variable_list)
" We use this line with only a space to know where to end highlights.
call s:Echo(' ')
endif
call s:Echo(' Global Variables:') call s:Echo(' Global Variables:')
call s:Echo('')
if l:show_preview_info
call s:Echo('" Press Space to read :help for a setting')
endif
call s:EchoGlobalVariables() call s:EchoGlobalVariables()
call s:Echo(' ')
call s:EchoLSPErrorMessages(l:all_names) call s:EchoLSPErrorMessages(l:all_names)
call s:Echo(' Command History:') call s:Echo(' Command History:')
call s:Echo('') call s:Echo('')
@ -275,3 +299,41 @@ function! ale#debugging#InfoToFile(filename) abort
call writefile(split(l:output, "\n"), l:expanded_filename) call writefile(split(l:output, "\n"), l:expanded_filename)
call s:Echo('ALEInfo written to ' . l:expanded_filename) call s:Echo('ALEInfo written to ' . l:expanded_filename)
endfunction endfunction
function! ale#debugging#InfoToPreview() abort
let l:output = execute('call ale#debugging#Info({''preview'': 1})')
call ale#preview#Show(split(l:output, "\n"), {
\ 'filetype': 'ale-info',
\})
endfunction
function! ale#debugging#InfoCommand(...) abort
if len(a:000) > 1
" no-custom-checks
echom 'Invalid ALEInfo arguments!'
return
endif
" Get 'echo' from '-echo', if there's an argument.
let l:mode = get(a:000, '')[1:]
if empty(l:mode)
let l:mode = ale#Var(bufnr(''), 'info_default_mode')
endif
if l:mode is# 'echo'
call ale#debugging#Info()
elseif l:mode is# 'clip' || l:mode is# 'clipboard'
call ale#debugging#InfoToClipboard()
else
call ale#debugging#InfoToPreview()
endif
endfunction
function! ale#debugging#InfoToClipboardDeprecatedCommand() abort
" no-custom-checks
echom 'ALEInfoToClipboard is deprecated. Use ALEInfo -clipboard instead.'
call ale#debugging#InfoToClipboard()
endfunction

View File

@ -1345,6 +1345,15 @@ g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview*
hover messages. hover messages.
g:ale_info_default_mode *g:ale_info_default_mode*
*b:ale_info_default_mode*
Type: |String|
Default: `'preview'`
Changes the default mode used for |ALEInfo|. See documentation for |ALEInfo|
for more information.
g:ale_keep_list_window_open *g:ale_keep_list_window_open* g:ale_keep_list_window_open *g:ale_keep_list_window_open*
*b:ale_keep_list_window_open* *b:ale_keep_list_window_open*
Type: |Number| Type: |Number|
@ -3836,7 +3845,7 @@ ALEDetail *ALEDetail*
*:ALEInfo* *:ALEInfo*
ALEInfo *ALEInfo* ALEInfo *ALEInfo*
ALEInfoToClipboard *ALEInfoToClipboard* *ALEInfoToFile*
Print runtime information about ALE, including the values of global and Print runtime information about ALE, including the values of global and
buffer-local settings for ALE, the linters that are enabled, the commands buffer-local settings for ALE, the linters that are enabled, the commands
@ -3848,8 +3857,17 @@ ALEInfoToClipboard *ALEInfoToClipboard*
|g:ale_history_log_output| to `1` to enable logging of output for commands. |g:ale_history_log_output| to `1` to enable logging of output for commands.
ALE will only log the output captured for parsing problems, etc. ALE will only log the output captured for parsing problems, etc.
The command `:ALEInfoToClipboard` can be used to output ALEInfo directly to You can pass options to the command to control how ALE displays the
your clipboard. This might not work on every machine. information, such as `:ALEInfo -echo`, etc. >
-preview Show the info in a preview window.
-clip OR -clipboard Copy the information to your clipboard.
-echo echo all of the information with :echo
<
The default mode can be configured with |g:ale_info_default_mode|.
When shown in a preview window, syntax highlights can be defined for the
`ale-info` filetype.
`:ALEInfoToFile` will write the ALE runtime information to a given filename. `:ALEInfoToFile` will write the ALE runtime information to a given filename.
The filename works just like |:w|. The filename works just like |:w|.

16
ftplugin/ale-info.vim Normal file
View File

@ -0,0 +1,16 @@
" Close the ALEInfo preview window with the q key.
noremap <buffer> q :q!<CR>
" Explicitly use the default synmaxcol for ale-info.
setlocal synmaxcol=3000
function! ALEInfoOpenHelp() abort
let l:variable = matchstr(getline('.'), '\v[gb]:ale_[a-z0-9_]+')
if !empty(l:variable)
execute('help ' . l:variable)
endif
endfunction
" Press space to open :help for an ALE Variable
nnoremap <buffer> <silent> <space> :call ALEInfoOpenHelp()<CR>

View File

@ -252,9 +252,9 @@ command! -bar ALEPopulateQuickfix :call ale#list#ForcePopulateErrorList(1)
command! -bar ALEPopulateLocList :call ale#list#ForcePopulateErrorList(0) command! -bar ALEPopulateLocList :call ale#list#ForcePopulateErrorList(0)
" Define a command to get information about current filetype. " Define a command to get information about current filetype.
command! -bar ALEInfo :call ale#debugging#Info() command! -bar -nargs=* ALEInfo :call ale#debugging#InfoCommand(<f-args>)
" The same, but copy output to your clipboard. " Deprecated and scheduled for removal in 4.0.0.
command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboard() command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboardDeprecatedCommand()
" Copy ALE information to a file. " Copy ALE information to a file.
command! -bar -nargs=1 ALEInfoToFile :call ale#debugging#InfoToFile(<f-args>) command! -bar -nargs=1 ALEInfoToFile :call ale#debugging#InfoToFile(<f-args>)
@ -352,6 +352,10 @@ nnoremap <silent> <Plug>(ale_rename) :ALERename<Return>
nnoremap <silent> <Plug>(ale_filerename) :ALEFileRename<Return> nnoremap <silent> <Plug>(ale_filerename) :ALEFileRename<Return>
nnoremap <silent> <Plug>(ale_code_action) :ALECodeAction<Return> nnoremap <silent> <Plug>(ale_code_action) :ALECodeAction<Return>
nnoremap <silent> <Plug>(ale_repeat_selection) :ALERepeatSelection<Return> nnoremap <silent> <Plug>(ale_repeat_selection) :ALERepeatSelection<Return>
nnoremap <silent> <Plug>(ale_info) :ALEInfo<Return>
nnoremap <silent> <Plug>(ale_info_echo) :ALEInfo -echo<Return>
nnoremap <silent> <Plug>(ale_info_clipboard) :ALEInfo -clipboard<Return>
nnoremap <silent> <Plug>(ale_info_preview) :ALEInfo -preview<Return>
" Set up autocmd groups now. " Set up autocmd groups now.
call ale#events#Init() call ale#events#Init()

View File

@ -3,7 +3,7 @@ if exists('b:current_syntax')
endif endif
syn match aleFixerComment /^.*$/ syn match aleFixerComment /^.*$/
syn match aleFixerName /\(^\|, \)'[^']*'/ syn match aleFixerName /\(^ *\|, \)'[^']*'/
syn match aleFixerHelp /^See :help ale-fix-configuration/ syn match aleFixerHelp /^See :help ale-fix-configuration/
hi def link aleFixerComment Comment hi def link aleFixerComment Comment

30
syntax/ale-info.vim Normal file
View File

@ -0,0 +1,30 @@
if exists('b:current_syntax')
finish
endif
" Exhaustively list different ALE Info directives to match here.
" This should hopefully avoid matching too eagerly.
syn match aleInfoDirective /^ *Current Filetype:/
syn match aleInfoDirective /^ *Available Linters:/
syn match aleInfoDirective /^ *Enabled Linters:/
syn match aleInfoDirective /^ *Ignored Linters:/
syn match aleInfoDirective /^ *Suggested Fixers:/
syn match aleInfoDirective /^ *Command History:/
syn match aleCommandNoOutput /^<<<NO OUTPUT RETURNED>>>$/
hi def link aleInfoDirective Title
hi def link aleInfoDirective Title
hi def link aleCommandNoOutput Comment
" Use Vim syntax highlighting for Vim options.
unlet! b:current_syntax
syntax include @srcVim syntax/vim.vim
syntax region aleInfoVimRegionLinter matchgroup=aleInfoDirective start="^ *Linter Variables:$" end="^ $" contains=@srcVim
syntax region aleInfoVimRegionGlobal matchgroup=aleInfoDirective start="^ *Global Variables:$" end="^ $" contains=@srcVim
unlet! b:current_syntax
syntax include @srcAleFixSuggest syntax/ale-fix-suggest.vim
syntax region aleInfoFixSuggestRegion matchgroup=aleInfoDirective start="^ *Suggested Fixers:$" end="^ $" contains=@srcAleFixSuggest
let b:current_syntax = 'ale-info'

View File

@ -16,6 +16,7 @@ Before:
Save g:ale_fixers Save g:ale_fixers
Save g:ale_history_enabled Save g:ale_history_enabled
Save g:ale_history_log_output Save g:ale_history_log_output
Save g:ale_info_default_mode
Save g:ale_keep_list_window_open Save g:ale_keep_list_window_open
Save g:ale_lint_delay Save g:ale_lint_delay
Save g:ale_lint_on_enter Save g:ale_lint_on_enter
@ -76,6 +77,8 @@ Before:
let g:ale_fix_on_save = 0 let g:ale_fix_on_save = 0
let g:ale_history_enabled = 1 let g:ale_history_enabled = 1
let g:ale_history_log_output = 1 let g:ale_history_log_output = 1
" This needs to be set to echo for this series of tests.
let g:ale_info_default_mode = 'echo'
let g:ale_keep_list_window_open = 0 let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200 let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1 let g:ale_lint_on_enter = 1
@ -128,74 +131,72 @@ Before:
let g:ale_linter_aliases = {} let g:ale_linter_aliases = {}
let g:ale_buffer_info = {} let g:ale_buffer_info = {}
let g:fixer_lines = [ let g:fixer_lines = [
\ ' Suggested Fixers: ', \ ' Suggested Fixers:',
\ ' ''foo'' - Fix things the foo way', \ ' ''foo'' - Fix things the foo way',
\] \ ' ',
let g:variables_lines = [
\ ' Linter Variables:',
\ '',
\] \]
let g:globals_lines = [ let g:globals_lines = [
\ ' Global Variables:', \ ' Global Variables:',
\ '', \ 'let g:ale_cache_executable_check_failures = 0',
\ 'let g:ale_cache_executable_check_failures = 0', \ 'let g:ale_change_sign_column_color = 0',
\ 'let g:ale_change_sign_column_color = 0', \ 'let g:ale_command_wrapper = ''''',
\ 'let g:ale_command_wrapper = ''''', \ 'let g:ale_completion_delay = 100',
\ 'let g:ale_completion_delay = 100', \ 'let g:ale_completion_enabled = 0',
\ 'let g:ale_completion_enabled = 0', \ 'let g:ale_completion_max_suggestions = 50',
\ 'let g:ale_completion_max_suggestions = 50', \ 'let g:ale_disable_lsp = 0',
\ 'let g:ale_disable_lsp = 0', \ 'let g:ale_echo_cursor = 1',
\ 'let g:ale_echo_cursor = 1', \ 'let g:ale_echo_msg_error_str = ''Error''',
\ 'let g:ale_echo_msg_error_str = ''Error''', \ 'let g:ale_echo_msg_format = ''%code: %%s''',
\ 'let g:ale_echo_msg_format = ''%code: %%s''', \ 'let g:ale_echo_msg_info_str = ''Info''',
\ 'let g:ale_echo_msg_info_str = ''Info''', \ 'let g:ale_echo_msg_warning_str = ''Warning''',
\ 'let g:ale_echo_msg_warning_str = ''Warning''', \ 'let g:ale_enabled = 1',
\ 'let g:ale_enabled = 1', \ 'let g:ale_fix_on_save = 0',
\ 'let g:ale_fix_on_save = 0', \ 'let g:ale_fixers = {}',
\ 'let g:ale_fixers = {}', \ 'let g:ale_history_enabled = 1',
\ 'let g:ale_history_enabled = 1', \ 'let g:ale_info_default_mode = ''echo''',
\ 'let g:ale_history_log_output = 1', \ 'let g:ale_history_log_output = 1',
\ 'let g:ale_keep_list_window_open = 0', \ 'let g:ale_keep_list_window_open = 0',
\ 'let g:ale_lint_delay = 200', \ 'let g:ale_lint_delay = 200',
\ 'let g:ale_lint_on_enter = 1', \ 'let g:ale_lint_on_enter = 1',
\ 'let g:ale_lint_on_filetype_changed = 1', \ 'let g:ale_lint_on_filetype_changed = 1',
\ 'let g:ale_lint_on_insert_leave = 1', \ 'let g:ale_lint_on_insert_leave = 1',
\ 'let g:ale_lint_on_save = 1', \ 'let g:ale_lint_on_save = 1',
\ 'let g:ale_lint_on_text_changed = ''normal''', \ 'let g:ale_lint_on_text_changed = ''normal''',
\ 'let g:ale_linter_aliases = {}', \ 'let g:ale_linter_aliases = {}',
\ 'let g:ale_linters = {}', \ 'let g:ale_linters = {}',
\ 'let g:ale_linters_explicit = 0', \ 'let g:ale_linters_explicit = 0',
\ 'let g:ale_linters_ignore = {''python'': [''pyright'']}', \ 'let g:ale_linters_ignore = {''python'': [''pyright'']}',
\ 'let g:ale_list_vertical = 0', \ 'let g:ale_list_vertical = 0',
\ 'let g:ale_list_window_size = 10', \ 'let g:ale_list_window_size = 10',
\ 'let g:ale_loclist_msg_format = ''%code: %%s''', \ 'let g:ale_loclist_msg_format = ''%code: %%s''',
\ 'let g:ale_max_buffer_history_size = 20', \ 'let g:ale_max_buffer_history_size = 20',
\ 'let g:ale_max_signs = -1', \ 'let g:ale_max_signs = -1',
\ 'let g:ale_maximum_file_size = 0', \ 'let g:ale_maximum_file_size = 0',
\ 'let g:ale_open_list = 0', \ 'let g:ale_open_list = 0',
\ 'let g:ale_pattern_options = {}', \ 'let g:ale_pattern_options = {}',
\ 'let g:ale_pattern_options_enabled = 0', \ 'let g:ale_pattern_options_enabled = 0',
\ 'let g:ale_root = {}', \ 'let g:ale_root = {}',
\ 'let g:ale_set_balloons = 0', \ 'let g:ale_set_balloons = 0',
\ 'let g:ale_set_highlights = 1', \ 'let g:ale_set_highlights = 1',
\ 'let g:ale_set_loclist = 1', \ 'let g:ale_set_loclist = 1',
\ 'let g:ale_set_quickfix = 0', \ 'let g:ale_set_quickfix = 0',
\ 'let g:ale_set_signs = 1', \ 'let g:ale_set_signs = 1',
\ 'let g:ale_sign_column_always = 0', \ 'let g:ale_sign_column_always = 0',
\ 'let g:ale_sign_error = ''>>''', \ 'let g:ale_sign_error = ''>>''',
\ 'let g:ale_sign_info = ''--''', \ 'let g:ale_sign_info = ''--''',
\ 'let g:ale_sign_offset = 1000000', \ 'let g:ale_sign_offset = 1000000',
\ 'let g:ale_sign_style_error = ''>>''', \ 'let g:ale_sign_style_error = ''>>''',
\ 'let g:ale_sign_style_warning = ''--''', \ 'let g:ale_sign_style_warning = ''--''',
\ 'let g:ale_sign_warning = ''--''', \ 'let g:ale_sign_warning = ''--''',
\ 'let g:ale_sign_highlight_linenrs = 0', \ 'let g:ale_sign_highlight_linenrs = 0',
\ 'let g:ale_statusline_format = [''%d error(s)'', ''%d warning(s)'', ''OK'']', \ 'let g:ale_statusline_format = [''%d error(s)'', ''%d warning(s)'', ''OK'']',
\ 'let g:ale_type_map = {}', \ 'let g:ale_type_map = {}',
\ 'let g:ale_use_neovim_diagnostics_api = 0', \ 'let g:ale_use_neovim_diagnostics_api = 0',
\ 'let g:ale_use_global_executables = v:null', \ 'let g:ale_use_global_executables = v:null',
\ 'let g:ale_virtualtext_cursor = ''disabled''', \ 'let g:ale_virtualtext_cursor = ''disabled''',
\ 'let g:ale_warn_about_trailing_blank_lines = 1', \ 'let g:ale_warn_about_trailing_blank_lines = 1',
\ 'let g:ale_warn_about_trailing_whitespace = 1', \ 'let g:ale_warn_about_trailing_whitespace = 1',
\ ' ',
\] \]
let g:command_header = [ let g:command_header = [
\ ' Command History:', \ ' Command History:',
@ -255,7 +256,6 @@ Execute (ALEInfo with no linters should return the right output):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -278,7 +278,6 @@ Execute (ALEInfo should return buffer-local global ALE settings):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -293,7 +292,6 @@ Execute (ALEInfo with no filetype should return the right output):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -310,7 +308,6 @@ Execute (ALEInfo with a single linter should return the right output):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -328,7 +325,6 @@ Execute (ALEInfo with two linters should return the right output):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -350,7 +346,6 @@ Execute (ALEInfo should calculate enabled linters correctly):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -368,7 +363,6 @@ Execute (ALEInfo should only return linters for current filetype):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -386,7 +380,6 @@ Execute (ALEInfo with compound filetypes should return linters for both of them)
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -411,11 +404,11 @@ Execute (ALEInfo should return appropriately named global variables):
\ + g:fixer_lines \ + g:fixer_lines
\ + [ \ + [
\ ' Linter Variables:', \ ' Linter Variables:',
\ '',
\ 'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}', \ 'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}',
\ 'let g:ale_testft2_testlinter2_foo = 123', \ 'let g:ale_testft2_testlinter2_foo = 123',
\ 'let g:ale_testft_testlinter1_bar = [''abc'']', \ 'let g:ale_testft_testlinter1_bar = [''abc'']',
\ 'let g:ale_testft_testlinter1_foo = ''abc''', \ 'let g:ale_testft_testlinter1_foo = ''abc''',
\ ' ',
\ ] \ ]
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
@ -443,11 +436,11 @@ Execute (ALEInfoToFile should write to a file correctly):
\ + g:fixer_lines \ + g:fixer_lines
\ + [ \ + [
\ ' Linter Variables:', \ ' Linter Variables:',
\ '',
\ 'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}', \ 'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}',
\ 'let g:ale_testft2_testlinter2_foo = 123', \ 'let g:ale_testft2_testlinter2_foo = 123',
\ 'let g:ale_testft_testlinter1_bar = [''abc'']', \ 'let g:ale_testft_testlinter1_bar = [''abc'']',
\ 'let g:ale_testft_testlinter1_foo = ''abc''', \ 'let g:ale_testft_testlinter1_foo = ''abc''',
\ ' ',
\ ] \ ]
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header, \ + g:command_header,
@ -471,9 +464,9 @@ Execute (ALEInfo should buffer-local linter variables):
\ + g:fixer_lines \ + g:fixer_lines
\ + [ \ + [
\ ' Linter Variables:', \ ' Linter Variables:',
\ '',
\ 'let g:ale_testft2_testlinter2_foo = 123', \ 'let g:ale_testft2_testlinter2_foo = 123',
\ 'let b:ale_testft2_testlinter2_foo = 456', \ 'let b:ale_testft2_testlinter2_foo = 456',
\ ' ',
\ ] \ ]
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
@ -503,9 +496,9 @@ Execute (ALEInfo should output linter aliases):
\ + g:fixer_lines \ + g:fixer_lines
\ + [ \ + [
\ ' Linter Variables:', \ ' Linter Variables:',
\ '',
\ 'let g:ale_testft2_testlinter2_foo = 123', \ 'let g:ale_testft2_testlinter2_foo = 123',
\ 'let b:ale_testft2_testlinter2_foo = 456', \ 'let b:ale_testft2_testlinter2_foo = 456',
\ ' ',
\ ] \ ]
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
@ -529,7 +522,6 @@ Execute (ALEInfo should return command history):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\ + [ \ + [
@ -557,7 +549,6 @@ Execute (ALEInfo command history should print exit codes correctly):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\ + [ \ + [
@ -606,7 +597,6 @@ Execute (ALEInfo command history should print command output if logging is on):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\ + [ \ + [
@ -645,7 +635,6 @@ Execute (ALEInfo should include executable checks in the history):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\ + [ \ + [
@ -658,7 +647,10 @@ Execute (ALEInfo should include executable checks in the history):
Execute (The option for caching failing executable checks should work): Execute (The option for caching failing executable checks should work):
let g:ale_cache_executable_check_failures = 1 let g:ale_cache_executable_check_failures = 1
let g:globals_lines[2] = 'let g:ale_cache_executable_check_failures = 1' " Replace output for the variable we have to modify above.
call map(g:globals_lines, {
\ _, val -> val =~ 'ale_cache_executable_check_failures' ? 'let g:ale_cache_executable_check_failures = 1' : val
\})
call ale#linter#Define('testft', g:testlinter1) call ale#linter#Define('testft', g:testlinter1)
@ -675,7 +667,6 @@ Execute (The option for caching failing executable checks should work):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\ + [ \ + [
@ -698,7 +689,6 @@ Execute (LSP errors for a linter should be outputted):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + [ \ + [
\ ' LSP Error Messages:', \ ' LSP Error Messages:',
@ -723,7 +713,6 @@ Execute (LSP errors for other linters shouldn't appear):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)
@ -736,7 +725,11 @@ Execute (ALEInfo should include linter global options):
" eg: like g:c_build_dir_names " eg: like g:c_build_dir_names
let g:ale_testft_build_dir_names = ['build', 'bin'] let g:ale_testft_build_dir_names = ['build', 'bin']
call add(g:variables_lines, 'let g:ale_testft_build_dir_names = [''build'', ''bin'']') let g:variables_lines = [
\ ' Linter Variables:',
\ 'let g:ale_testft_build_dir_names = [''build'', ''bin'']',
\ ' ',
\]
call CheckInfo( call CheckInfo(
\ [ \ [
@ -772,7 +765,6 @@ Execute (ALEInfo should include linter global options for enabled linters):
\ ' Ignored Linters: []', \ ' Ignored Linters: []',
\ ] \ ]
\ + g:fixer_lines \ + g:fixer_lines
\ + g:variables_lines
\ + g:globals_lines \ + g:globals_lines
\ + g:command_header \ + g:command_header
\) \)

View File

@ -1,14 +1,14 @@
After: After:
unlet! g:output unlet! g:output
Execute(ALEInfoToClipboard should that clipboard support is required): Execute(ALEInfo -clipboard should that clipboard support is required):
" When run in the Docker image, there's no clipboard support, so this test " When run in the Docker image, there's no clipboard support, so this test
" will actually run. " will actually run.
if !has('clipboard') if !has('clipboard')
let g:output = '' let g:output = ''
redir => g:output redir => g:output
:ALEInfoToClipboard :ALEInfo -clipboard
redir END redir END
AssertEqual 'clipboard not available. Try :ALEInfoToFile instead.', join(split(g:output)) AssertEqual 'clipboard not available. Try :ALEInfoToFile instead.', join(split(g:output))