diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-22 12:01:21 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-22 12:01:21 +0000 |
commit | 074a011b0831f89252f62c3ab498c9337d4651a2 (patch) | |
tree | a2d7718629629d27817cde502ced7f623c91e4e2 | |
parent | 796fb651d646b3cc34a397c08daa3b85465929d3 (diff) | |
download | ale-074a011b0831f89252f62c3ab498c9337d4651a2.zip |
Make fixing ignore empty output better
-rw-r--r-- | autoload/ale/fix.vim | 8 | ||||
-rw-r--r-- | test/test_ale_fix.vader | 15 |
2 files changed, 20 insertions, 3 deletions
diff --git a/autoload/ale/fix.vim b/autoload/ale/fix.vim index c4143aa1..76cd1355 100644 --- a/autoload/ale/fix.vim +++ b/autoload/ale/fix.vim @@ -114,9 +114,11 @@ function! s:HandleExit(job_id, exit_code) abort " otherwise skip this job and use the input from before. " " We'll use the input from before for chained commands. - let l:input = l:chain_callback is v:null && !empty(l:job_info.output) - \ ? l:job_info.output - \ : l:job_info.input + if l:chain_callback is v:null && !empty(split(join(l:job_info.output))) + let l:input = l:job_info.output + else + let l:input = l:job_info.input + endif let l:next_index = l:chain_callback is v:null \ ? l:job_info.callback_index + 1 diff --git a/test/test_ale_fix.vader b/test/test_ale_fix.vader index ac6427ab..c5deabb4 100644 --- a/test/test_ale_fix.vader +++ b/test/test_ale_fix.vader @@ -105,6 +105,11 @@ Before: return {'command': ''} endfunction + " echo will output a single blank line, and we should ingore it. + function! IgnoredEmptyOutput(buffer, output) + return {'command': 'echo'} + endfunction + function! SetUpLinters() call ale#linter#Define('testft', { \ 'name': 'testlinter', @@ -149,6 +154,7 @@ After: delfunction ChainEndSkipped delfunction SetUpLinters delfunction GetLastMessage + delfunction IgnoredEmptyOutput call ale#test#RestoreDirectory() @@ -568,3 +574,12 @@ Expect(The lines should be the same): a b c + +Execute(Empty output should be ignored): + let g:ale_fixers.testft = ['IgnoredEmptyOutput'] + ALEFix + +Expect(The lines should be the same): + a + b + c |