summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-29 12:00:32 +0100
committerw0rp <devw0rp@gmail.com>2017-06-29 12:00:32 +0100
commit518f99b480d02a444ad44f8bc109cdf593f3f86b (patch)
treef66c5d918305864da246352ee7680cc7058cdb56
parent79e8e063af1cf7a72ec42075f4eed30aa69607e8 (diff)
downloadale-518f99b480d02a444ad44f8bc109cdf593f3f86b.zip
Fix #706 - Skip fixers with jobs that return empty output, in case they have failed
-rw-r--r--autoload/ale/fix.vim9
1 files changed, 8 insertions, 1 deletions
diff --git a/autoload/ale/fix.vim b/autoload/ale/fix.vim
index b4fd3e1a..9ecacd12 100644
--- a/autoload/ale/fix.vim
+++ b/autoload/ale/fix.vim
@@ -102,9 +102,15 @@ function! s:HandleExit(job_id, exit_code) abort
let l:job_info.output = readfile(l:job_info.file_to_read)
endif
+ " Use the output of the job for changing the file if it isn't empty,
+ " otherwise skip this job and use the input from before.
+ let l:input = !empty(l:job_info.output)
+ \ ? l:job_info.output
+ \ : l:job_info.input
+
call s:RunFixer({
\ 'buffer': l:job_info.buffer,
- \ 'input': l:job_info.output,
+ \ 'input': l:input,
\ 'callback_list': l:job_info.callback_list,
\ 'callback_index': l:job_info.callback_index + 1,
\})
@@ -172,6 +178,7 @@ function! s:RunJob(options) abort
let l:job_info = {
\ 'buffer': l:buffer,
+ \ 'input': l:input,
\ 'output': [],
\ 'callback_list': a:options.callback_list,
\ 'callback_index': a:options.callback_index,