summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2023-09-06 00:21:58 +0100
committerw0rp <devw0rp@gmail.com>2023-09-06 00:21:58 +0100
commit14350dbb0d265ef87d1c7d420d89fb4165a2b131 (patch)
treeee157f9d69298646b44f3033f6e9ad8745303c74
parent551fbcfb0905629dcc2afc0db53dcca21994cca3 (diff)
downloadale-14350dbb0d265ef87d1c7d420d89fb4165a2b131.zip
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
-rw-r--r--.github/ISSUE_TEMPLATE/report-a-bug.md2
-rw-r--r--autoload/ale/debugging.vim74
-rw-r--r--doc/ale.txt24
-rw-r--r--ftplugin/ale-info.vim16
-rw-r--r--plugin/ale.vim10
-rw-r--r--syntax/ale-fix-suggest.vim2
-rw-r--r--syntax/ale-info.vim30
-rw-r--r--test/test_ale_info.vader166
-rw-r--r--test/test_ale_info_to_clipboard.vader4
9 files changed, 225 insertions, 103 deletions
diff --git a/.github/ISSUE_TEMPLATE/report-a-bug.md b/.github/ISSUE_TEMPLATE/report-a-bug.md
index cf92f330..c8fa5792 100644
--- a/.github/ISSUE_TEMPLATE/report-a-bug.md
+++ b/.github/ISSUE_TEMPLATE/report-a-bug.md
@@ -42,7 +42,7 @@ Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](
### :ALEInfo
<details>
<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. -->
<!-- Read the output. You might figure out what went wrong yourself. -->
</details>
diff --git a/autoload/ale/debugging.vim b/autoload/ale/debugging.vim
index c100d6e6..8b2a386f 100644
--- a/autoload/ale/debugging.vim
+++ b/autoload/ale/debugging.vim
@@ -1,6 +1,8 @@
" Author: w0rp <devw0rp@gmail.com>
" 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 = [
\ 'ale_cache_executable_check_failures',
\ 'ale_change_sign_column_color',
@@ -18,6 +20,7 @@ let s:global_variable_list = [
\ 'ale_fix_on_save',
\ 'ale_fixers',
\ 'ale_history_enabled',
+\ 'ale_info_default_mode',
\ 'ale_history_log_output',
\ 'ale_keep_list_window_open',
\ 'ale_lint_delay',
@@ -199,7 +202,10 @@ function! s:EchoLSPErrorMessages(all_linter_names) abort
endfor
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:filetype = &filetype
@@ -241,13 +247,31 @@ function! ale#debugging#Info() abort
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('')
- call s:EchoLinterVariables(l:variable_list)
+ call s:Echo(' Suggested Fixers:' . l:fixers_string)
+ " We use this line with only a space to know where to end highlights.
+ call s:Echo(' ')
+
+ " 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('')
+
+ if l:show_preview_info
+ call s:Echo('" Press Space to read :help for a setting')
+ endif
+
call s:EchoGlobalVariables()
+ call s:Echo(' ')
call s:EchoLSPErrorMessages(l:all_names)
call s:Echo(' Command History:')
call s:Echo('')
@@ -275,3 +299,41 @@ function! ale#debugging#InfoToFile(filename) abort
call writefile(split(l:output, "\n"), l:expanded_filename)
call s:Echo('ALEInfo written to ' . l:expanded_filename)
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
diff --git a/doc/ale.txt b/doc/ale.txt
index 189839cf..4f4cb9c7 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -1345,6 +1345,15 @@ g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview*
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*
*b:ale_keep_list_window_open*
Type: |Number|
@@ -3836,7 +3845,7 @@ ALEDetail *ALEDetail*
*:ALEInfo*
ALEInfo *ALEInfo*
-ALEInfoToClipboard *ALEInfoToClipboard*
+ *ALEInfoToFile*
Print runtime information about ALE, including the values of global and
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.
ALE will only log the output captured for parsing problems, etc.
- The command `:ALEInfoToClipboard` can be used to output ALEInfo directly to
- your clipboard. This might not work on every machine.
+ You can pass options to the command to control how ALE displays the
+ 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.
The filename works just like |:w|.
diff --git a/ftplugin/ale-info.vim b/ftplugin/ale-info.vim
new file mode 100644
index 00000000..65913a76
--- /dev/null
+++ b/ftplugin/ale-info.vim
@@ -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>
diff --git a/plugin/ale.vim b/plugin/ale.vim
index d926bcfe..e239f233 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -252,9 +252,9 @@ command! -bar ALEPopulateQuickfix :call ale#list#ForcePopulateErrorList(1)
command! -bar ALEPopulateLocList :call ale#list#ForcePopulateErrorList(0)
" Define a command to get information about current filetype.
-command! -bar ALEInfo :call ale#debugging#Info()
-" The same, but copy output to your clipboard.
-command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboard()
+command! -bar -nargs=* ALEInfo :call ale#debugging#InfoCommand(<f-args>)
+" Deprecated and scheduled for removal in 4.0.0.
+command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboardDeprecatedCommand()
" Copy ALE information to a file.
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_code_action) :ALECodeAction<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.
call ale#events#Init()
diff --git a/syntax/ale-fix-suggest.vim b/syntax/ale-fix-suggest.vim
index b112f5b5..19734f4c 100644
--- a/syntax/ale-fix-suggest.vim
+++ b/syntax/ale-fix-suggest.vim
@@ -3,7 +3,7 @@ if exists('b:current_syntax')
endif
syn match aleFixerComment /^.*$/
-syn match aleFixerName /\(^\|, \)'[^']*'/
+syn match aleFixerName /\(^ *\|, \)'[^']*'/
syn match aleFixerHelp /^See :help ale-fix-configuration/
hi def link aleFixerComment Comment
diff --git a/syntax/ale-info.vim b/syntax/ale-info.vim
new file mode 100644
index 00000000..d47b58b8
--- /dev/null
+++ b/syntax/ale-info.vim
@@ -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'
diff --git a/test/test_ale_info.vader b/test/test_ale_info.vader
index 4cedccc2..7b9e189e 100644
--- a/test/test_ale_info.vader
+++ b/test/test_ale_info.vader
@@ -16,6 +16,7 @@ Before:
Save g:ale_fixers
Save g:ale_history_enabled
Save g:ale_history_log_output
+ Save g:ale_info_default_mode
Save g:ale_keep_list_window_open
Save g:ale_lint_delay
Save g:ale_lint_on_enter
@@ -76,6 +77,8 @@ Before:
let g:ale_fix_on_save = 0
let g:ale_history_enabled = 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_lint_delay = 200
let g:ale_lint_on_enter = 1
@@ -128,74 +131,72 @@ Before:
let g:ale_linter_aliases = {}
let g:ale_buffer_info = {}
let g:fixer_lines = [
- \ ' Suggested Fixers: ',
+ \ ' Suggested Fixers:',
\ ' ''foo'' - Fix things the foo way',
- \]
- let g:variables_lines = [
- \ ' Linter Variables:',
- \ '',
+ \ ' ',
\]
let g:globals_lines = [
- \ ' Global Variables:',
- \ '',
- \ 'let g:ale_cache_executable_check_failures = 0',
- \ 'let g:ale_change_sign_column_color = 0',
- \ 'let g:ale_command_wrapper = ''''',
- \ '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''',
- \ 'let g:ale_echo_msg_info_str = ''Info''',
- \ 'let g:ale_echo_msg_warning_str = ''Warning''',
- \ 'let g:ale_enabled = 1',
- \ 'let g:ale_fix_on_save = 0',
- \ 'let g:ale_fixers = {}',
- \ 'let g:ale_history_enabled = 1',
- \ 'let g:ale_history_log_output = 1',
- \ 'let g:ale_keep_list_window_open = 0',
- \ 'let g:ale_lint_delay = 200',
- \ 'let g:ale_lint_on_enter = 1',
- \ 'let g:ale_lint_on_filetype_changed = 1',
- \ 'let g:ale_lint_on_insert_leave = 1',
- \ 'let g:ale_lint_on_save = 1',
- \ 'let g:ale_lint_on_text_changed = ''normal''',
- \ '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''',
- \ 'let g:ale_max_buffer_history_size = 20',
- \ 'let g:ale_max_signs = -1',
- \ 'let g:ale_maximum_file_size = 0',
- \ 'let g:ale_open_list = 0',
- \ 'let g:ale_pattern_options = {}',
- \ 'let g:ale_pattern_options_enabled = 0',
- \ 'let g:ale_root = {}',
- \ 'let g:ale_set_balloons = 0',
- \ 'let g:ale_set_highlights = 1',
- \ 'let g:ale_set_loclist = 1',
- \ 'let g:ale_set_quickfix = 0',
- \ 'let g:ale_set_signs = 1',
- \ 'let g:ale_sign_column_always = 0',
- \ 'let g:ale_sign_error = ''>>''',
- \ 'let g:ale_sign_info = ''--''',
- \ 'let g:ale_sign_offset = 1000000',
- \ 'let g:ale_sign_style_error = ''>>''',
- \ 'let g:ale_sign_style_warning = ''--''',
- \ 'let g:ale_sign_warning = ''--''',
- \ 'let g:ale_sign_highlight_linenrs = 0',
- \ 'let g:ale_statusline_format = [''%d error(s)'', ''%d warning(s)'', ''OK'']',
- \ 'let g:ale_type_map = {}',
- \ 'let g:ale_use_neovim_diagnostics_api = 0',
- \ 'let g:ale_use_global_executables = v:null',
- \ 'let g:ale_virtualtext_cursor = ''disabled''',
- \ 'let g:ale_warn_about_trailing_blank_lines = 1',
- \ 'let g:ale_warn_about_trailing_whitespace = 1',
+ \ ' Global Variables:',
+ \ 'let g:ale_cache_executable_check_failures = 0',
+ \ 'let g:ale_change_sign_column_color = 0',
+ \ 'let g:ale_command_wrapper = ''''',
+ \ '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''',
+ \ 'let g:ale_echo_msg_info_str = ''Info''',
+ \ 'let g:ale_echo_msg_warning_str = ''Warning''',
+ \ 'let g:ale_enabled = 1',
+ \ 'let g:ale_fix_on_save = 0',
+ \ 'let g:ale_fixers = {}',
+ \ 'let g:ale_history_enabled = 1',
+ \ 'let g:ale_info_default_mode = ''echo''',
+ \ 'let g:ale_history_log_output = 1',
+ \ 'let g:ale_keep_list_window_open = 0',
+ \ 'let g:ale_lint_delay = 200',
+ \ 'let g:ale_lint_on_enter = 1',
+ \ 'let g:ale_lint_on_filetype_changed = 1',
+ \ 'let g:ale_lint_on_insert_leave = 1',
+ \ 'let g:ale_lint_on_save = 1',
+ \ 'let g:ale_lint_on_text_changed = ''normal''',
+ \ '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''',
+ \ 'let g:ale_max_buffer_history_size = 20',
+ \ 'let g:ale_max_signs = -1',
+ \ 'let g:ale_maximum_file_size = 0',
+ \ 'let g:ale_open_list = 0',
+ \ 'let g:ale_pattern_options = {}',
+ \ 'let g:ale_pattern_options_enabled = 0',
+ \ 'let g:ale_root = {}',
+ \ 'let g:ale_set_balloons = 0',
+ \ 'let g:ale_set_highlights = 1',
+ \ 'let g:ale_set_loclist = 1',
+ \ 'let g:ale_set_quickfix = 0',
+ \ 'let g:ale_set_signs = 1',
+ \ 'let g:ale_sign_column_always = 0',
+ \ 'let g:ale_sign_error = ''>>''',
+ \ 'let g:ale_sign_info = ''--''',
+ \ 'let g:ale_sign_offset = 1000000',
+ \ 'let g:ale_sign_style_error = ''>>''',
+ \ 'let g:ale_sign_style_warning = ''--''',
+ \ 'let g:ale_sign_warning = ''--''',
+ \ 'let g:ale_sign_highlight_linenrs = 0',
+ \ 'let g:ale_statusline_format = [''%d error(s)'', ''%d warning(s)'', ''OK'']',
+ \ 'let g:ale_type_map = {}',
+ \ 'let g:ale_use_neovim_diagnostics_api = 0',
+ \ 'let g:ale_use_global_executables = v:null',
+ \ 'let g:ale_virtualtext_cursor = ''disabled''',
+ \ 'let g:ale_warn_about_trailing_blank_lines = 1',
+ \ 'let g:ale_warn_about_trailing_whitespace = 1',
+ \ ' ',
\]
let g:command_header = [
\ ' Command History:',
@@ -255,7 +256,6 @@ Execute (ALEInfo with no linters should return the right output):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -278,7 +278,6 @@ Execute (ALEInfo should return buffer-local global ALE settings):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -293,7 +292,6 @@ Execute (ALEInfo with no filetype should return the right output):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -310,7 +308,6 @@ Execute (ALEInfo with a single linter should return the right output):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -328,7 +325,6 @@ Execute (ALEInfo with two linters should return the right output):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -350,7 +346,6 @@ Execute (ALEInfo should calculate enabled linters correctly):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -368,7 +363,6 @@ Execute (ALEInfo should only return linters for current filetype):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -386,7 +380,6 @@ Execute (ALEInfo with compound filetypes should return linters for both of them)
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -411,11 +404,11 @@ Execute (ALEInfo should return appropriately named global variables):
\ + g:fixer_lines
\ + [
\ ' Linter Variables:',
- \ '',
\ 'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}',
\ 'let g:ale_testft2_testlinter2_foo = 123',
\ 'let g:ale_testft_testlinter1_bar = [''abc'']',
\ 'let g:ale_testft_testlinter1_foo = ''abc''',
+ \ ' ',
\ ]
\ + g:globals_lines
\ + g:command_header
@@ -443,11 +436,11 @@ Execute (ALEInfoToFile should write to a file correctly):
\ + g:fixer_lines
\ + [
\ ' Linter Variables:',
- \ '',
\ 'let g:ale_testft2_testlinter2_bar = {''x'': ''y''}',
\ 'let g:ale_testft2_testlinter2_foo = 123',
\ 'let g:ale_testft_testlinter1_bar = [''abc'']',
\ 'let g:ale_testft_testlinter1_foo = ''abc''',
+ \ ' ',
\ ]
\ + g:globals_lines
\ + g:command_header,
@@ -471,9 +464,9 @@ Execute (ALEInfo should buffer-local linter variables):
\ + g:fixer_lines
\ + [
\ ' Linter Variables:',
- \ '',
\ 'let g:ale_testft2_testlinter2_foo = 123',
\ 'let b:ale_testft2_testlinter2_foo = 456',
+ \ ' ',
\ ]
\ + g:globals_lines
\ + g:command_header
@@ -503,9 +496,9 @@ Execute (ALEInfo should output linter aliases):
\ + g:fixer_lines
\ + [
\ ' Linter Variables:',
- \ '',
\ 'let g:ale_testft2_testlinter2_foo = 123',
\ 'let b:ale_testft2_testlinter2_foo = 456',
+ \ ' ',
\ ]
\ + g:globals_lines
\ + g:command_header
@@ -529,7 +522,6 @@ Execute (ALEInfo should return command history):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\ + [
@@ -557,7 +549,6 @@ Execute (ALEInfo command history should print exit codes correctly):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\ + [
@@ -606,7 +597,6 @@ Execute (ALEInfo command history should print command output if logging is on):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\ + [
@@ -645,7 +635,6 @@ Execute (ALEInfo should include executable checks in the history):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + 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):
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)
@@ -675,7 +667,6 @@ Execute (The option for caching failing executable checks should work):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\ + [
@@ -698,7 +689,6 @@ Execute (LSP errors for a linter should be outputted):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + [
\ ' LSP Error Messages:',
@@ -723,7 +713,6 @@ Execute (LSP errors for other linters shouldn't appear):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
@@ -736,7 +725,11 @@ Execute (ALEInfo should include linter global options):
" eg: like g:c_build_dir_names
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(
\ [
@@ -772,7 +765,6 @@ Execute (ALEInfo should include linter global options for enabled linters):
\ ' Ignored Linters: []',
\ ]
\ + g:fixer_lines
- \ + g:variables_lines
\ + g:globals_lines
\ + g:command_header
\)
diff --git a/test/test_ale_info_to_clipboard.vader b/test/test_ale_info_to_clipboard.vader
index 2014a310..9881f367 100644
--- a/test/test_ale_info_to_clipboard.vader
+++ b/test/test_ale_info_to_clipboard.vader
@@ -1,14 +1,14 @@
After:
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
" will actually run.
if !has('clipboard')
let g:output = ''
redir => g:output
- :ALEInfoToClipboard
+ :ALEInfo -clipboard
redir END
AssertEqual 'clipboard not available. Try :ALEInfoToFile instead.', join(split(g:output))