mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 21:12:31 +08:00
#254 Capture command exit codes in the history
This commit is contained in:
@@ -270,7 +270,23 @@ function! ale#engine#SetResults(buffer, loclist) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:HandleExitNeoVim(job, data, event) abort
|
||||
function! s:SetExitCode(job, exit_code) abort
|
||||
let l:job_id = s:GetJobID(a:job)
|
||||
|
||||
if !has_key(s:job_info_map, l:job_id)
|
||||
return
|
||||
endif
|
||||
|
||||
let l:buffer = s:job_info_map[l:job_id].buffer
|
||||
|
||||
call ale#history#SetExitCode(l:buffer, l:job_id, a:exit_code)
|
||||
endfunction
|
||||
|
||||
function! s:HandleExitNeoVim(job, exit_code, event) abort
|
||||
if g:ale_history_enabled
|
||||
call s:SetExitCode(a:job, a:exit_code)
|
||||
endif
|
||||
|
||||
call s:HandleExit(a:job)
|
||||
endfunction
|
||||
|
||||
@@ -278,6 +294,12 @@ function! s:HandleExitVim(channel) abort
|
||||
call s:HandleExit(ch_getjob(a:channel))
|
||||
endfunction
|
||||
|
||||
" Vim returns the exit status with one callback,
|
||||
" and the channel will close later in another callback.
|
||||
function! s:HandleExitStatusVim(job, exit_code) abort
|
||||
call s:SetExitCode(a:job, a:exit_code)
|
||||
endfunction
|
||||
|
||||
function! s:FixLocList(buffer, loclist) abort
|
||||
" Some errors have line numbers beyond the end of the file,
|
||||
" so we need to adjust them so they set the error at the last line
|
||||
@@ -415,6 +437,12 @@ function! s:RunJob(options) abort
|
||||
\ 'close_cb': function('s:HandleExitVim'),
|
||||
\}
|
||||
|
||||
if g:ale_history_enabled
|
||||
" We only need to capture the exit status if we are going to
|
||||
" save it in the history. Otherwise, we don't care.
|
||||
let l:job_options.exit_cb = function('s:HandleExitStatusVim')
|
||||
endif
|
||||
|
||||
if l:output_stream ==# 'stderr'
|
||||
" Read from stderr instead of stdout.
|
||||
let l:job_options.err_cb = function('s:GatherOutputVim')
|
||||
|
||||
Reference in New Issue
Block a user