Fix test for echoing messages

The previous linter rule about stray echo lines has been restored, and
now all problems for custom linting rules can be ignored by adding a
comment above problem lines.
This commit is contained in:
w0rp
2022-04-01 14:35:07 +01:00
parent b3d1d6eecf
commit d3df00b898
12 changed files with 77 additions and 43 deletions

View File

@@ -776,7 +776,8 @@ function! s:OnReady(linter, lsp_details) abort
if a:linter.lsp is# 'tsserver'
if get(g:, 'ale_completion_tsserver_autoimport') is 1
execute 'echom `g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.'''
" no-custom-checks
echom '`g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.'
endif
let l:message = ale#lsp#tsserver_message#Completions(

View File

@@ -10,6 +10,12 @@ let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
let s:cursor_timer = -1
" A wrapper for echon so we can test messages we echo in Vader tests.
function! ale#cursor#Echon(message) abort
" no-custom-checks
echon a:message
endfunction
function! ale#cursor#TruncatedEcho(original_message) abort
let l:message = a:original_message
" Change tabs to spaces.
@@ -37,7 +43,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
let l:message = l:message[:&columns - 5] . '...'
endif
echon l:message
call ale#cursor#Echon(l:message)
catch /^Vim\%((\a\+)\)\=:E523/
" Fallback into manual truncate (#1987)
let l:winwidth = winwidth(0)
@@ -97,7 +103,9 @@ function! ale#cursor#EchoCursorWarning(...) abort
elseif get(l:info, 'echoed')
" We'll only clear the echoed message when moving off errors once,
" so we don't continually clear the echo line.
execute 'echo'
"
" no-custom-checks
echo
let l:info.echoed = 0
endif
endif
@@ -160,7 +168,8 @@ function! s:ShowCursorDetailForItem(loc, options) abort
" Clear the echo message if we manually displayed details.
if !l:stay_here
execute 'echo'
" no-custom-checks
echo
endif
endif
endfunction

View File

@@ -62,7 +62,8 @@ let s:global_variable_list = [
\]
function! s:Echo(message) abort
execute 'echo a:message'
" no-custom-checks
echo a:message
endfunction
function! s:GetLinterVariables(filetype, exclude_linter_names) abort

View File

@@ -77,7 +77,8 @@ function! ale#fix#ApplyFixes(buffer, output) abort
call remove(g:ale_fix_buffer_data, a:buffer)
if !l:data.ignore_file_changed_errors
execute 'echoerr ''The file was changed before fixing finished'''
" no-custom-checks
echoerr 'The file was changed before fixing finished'
endif
return
@@ -358,7 +359,8 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort
\ 'There is no fixer named `%s`. Check :ALEFixSuggest',
\ l:function_name,
\)
execute 'echom l:echo_message'
" no-custom-checks
echom l:echo_message
endif
return 0
@@ -366,7 +368,8 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort
if empty(l:callback_list)
if a:fixing_flag is# ''
execute 'echom ''No fixers have been defined. Try :ALEFixSuggest'''
" no-custom-checks
echom 'No fixers have been defined. Try :ALEFixSuggest'
endif
return 0

View File

@@ -7,7 +7,8 @@
function! ale#floating_preview#Show(lines, ...) abort
if !exists('*nvim_open_win') && !has('popupwin')
execute 'echom ''Floating windows not supported in this vim instance.'''
" no-custom-checks
echom 'Floating windows not supported in this vim instance.'
return
endif

View File

@@ -64,7 +64,8 @@ function! ale#toggle#ToggleBuffer(buffer) abort
" Disabling ALE globally removes autocmd events, so we cannot enable
" linting locally when linting is disabled globally
if l:enabled && !g:ale_enabled
execute 'echom ''ALE cannot be enabled locally when disabled globally'''
" no-custom-checks
echom 'ALE cannot be enabled locally when disabled globally'
return
endif

View File

@@ -3,7 +3,8 @@
function! s:OpenJDTLink(root, uri, line, column, options, result) abort
if has_key(a:result, 'error')
execute 'echoerr a:result.error.message'
" no-custom-checks
echoerr a:result.error.message
return
endif
@@ -11,7 +12,8 @@ function! s:OpenJDTLink(root, uri, line, column, options, result) abort
let l:contents = a:result['result']
if type(l:contents) is# type(v:null)
execute 'echoerr ''File content not found'''
" no-custom-checks
echoerr 'File content not found'
endif
" disable autocmd when opening buffer
@@ -59,7 +61,8 @@ endfunction
function! s:ReadClassFileContents(uri, result) abort
if has_key(a:result, 'error')
execute 'echoerr a:result.error.message'
" no-custom-checks
echoerr a:result.error.message
return
endif
@@ -67,7 +70,8 @@ function! s:ReadClassFileContents(uri, result) abort
let l:contents = a:result['result']
if type(l:contents) is# type(v:null)
execute 'echoerr ''File content not found'''
" no-custom-checks
echoerr 'File content not found'
endif
call setline(1, split(l:contents, '\n'))

View File

@@ -25,7 +25,8 @@ function! ale#util#ShowMessage(string, ...) abort
" We have to assume the user is using a monospace font.
if has('nvim') || (a:string !~? "\n" && len(a:string) < &columns)
execute 'echo a:string'
" no-custom-checks
echo a:string
else
call ale#preview#Show(split(a:string, "\n"), extend(
\ {