Make fixing ignore empty output better
This commit is contained in:
parent
796fb651d6
commit
074a011b08
@ -114,9 +114,11 @@ function! s:HandleExit(job_id, exit_code) abort
|
|||||||
" otherwise skip this job and use the input from before.
|
" otherwise skip this job and use the input from before.
|
||||||
"
|
"
|
||||||
" We'll use the input from before for chained commands.
|
" We'll use the input from before for chained commands.
|
||||||
let l:input = l:chain_callback is v:null && !empty(l:job_info.output)
|
if l:chain_callback is v:null && !empty(split(join(l:job_info.output)))
|
||||||
\ ? l:job_info.output
|
let l:input = l:job_info.output
|
||||||
\ : l:job_info.input
|
else
|
||||||
|
let l:input = l:job_info.input
|
||||||
|
endif
|
||||||
|
|
||||||
let l:next_index = l:chain_callback is v:null
|
let l:next_index = l:chain_callback is v:null
|
||||||
\ ? l:job_info.callback_index + 1
|
\ ? l:job_info.callback_index + 1
|
||||||
|
@ -105,6 +105,11 @@ Before:
|
|||||||
return {'command': ''}
|
return {'command': ''}
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" echo will output a single blank line, and we should ingore it.
|
||||||
|
function! IgnoredEmptyOutput(buffer, output)
|
||||||
|
return {'command': 'echo'}
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! SetUpLinters()
|
function! SetUpLinters()
|
||||||
call ale#linter#Define('testft', {
|
call ale#linter#Define('testft', {
|
||||||
\ 'name': 'testlinter',
|
\ 'name': 'testlinter',
|
||||||
@ -149,6 +154,7 @@ After:
|
|||||||
delfunction ChainEndSkipped
|
delfunction ChainEndSkipped
|
||||||
delfunction SetUpLinters
|
delfunction SetUpLinters
|
||||||
delfunction GetLastMessage
|
delfunction GetLastMessage
|
||||||
|
delfunction IgnoredEmptyOutput
|
||||||
|
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
@ -568,3 +574,12 @@ Expect(The lines should be the same):
|
|||||||
a
|
a
|
||||||
b
|
b
|
||||||
c
|
c
|
||||||
|
|
||||||
|
Execute(Empty output should be ignored):
|
||||||
|
let g:ale_fixers.testft = ['IgnoredEmptyOutput']
|
||||||
|
ALEFix
|
||||||
|
|
||||||
|
Expect(The lines should be the same):
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
Loading…
Reference in New Issue
Block a user