From 8e997ac2319efac06f7ca6b0912ca00a47ba26d1 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sat, 27 May 2017 19:23:13 +0100 Subject: [PATCH] Fix #584 - Fix Neovim line handling issues --- autoload/ale/job.vim | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/autoload/ale/job.vim b/autoload/ale/job.vim index 96f2ad4c..aeef5796 100644 --- a/autoload/ale/job.vim +++ b/autoload/ale/job.vim @@ -42,25 +42,33 @@ function! ale#job#JoinNeovimOutput(job, last_line, data, callback) abort endfunction function! s:NeoVimCallback(job, data, event) abort - let l:job_info = s:job_map[a:job] + let l:info = s:job_map[a:job] if a:event ==# 'stdout' - let l:job_info.out_cb_line = ale#job#JoinNeovimOutput( + let l:info.out_cb_line = ale#job#JoinNeovimOutput( \ a:job, - \ l:job_info.out_cb_line, + \ l:info.out_cb_line, \ a:data, - \ ale#util#GetFunction(l:job_info.out_cb), + \ ale#util#GetFunction(l:info.out_cb), \) elseif a:event ==# 'stderr' - let l:job_info.err_cb_line = ale#job#JoinNeovimOutput( + let l:info.err_cb_line = ale#job#JoinNeovimOutput( \ a:job, - \ l:job_info.err_cb_line, + \ l:info.err_cb_line, \ a:data, - \ ale#util#GetFunction(l:job_info.err_cb), + \ ale#util#GetFunction(l:info.err_cb), \) else + if has_key(l:info, 'out_cb') && !empty(l:info.out_cb_line) + call ale#util#GetFunction(l:info.out_cb)(a:job, l:info.out_cb_line) + endif + + if has_key(l:info, 'err_cb') && !empty(l:info.err_cb_line) + call ale#util#GetFunction(l:info.err_cb)(a:job, l:info.err_cb_line) + endif + try - call ale#util#GetFunction(l:job_info.exit_cb)(a:job, a:data) + call ale#util#GetFunction(l:info.exit_cb)(a:job, a:data) finally " Automatically forget about the job after it's done. if has_key(s:job_map, a:job)