mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 13:02:28 +08:00
Refactor history management functions into their own file
This commit is contained in:
@@ -9,30 +9,6 @@
|
||||
" output: The array of lines for the output of the job.
|
||||
let s:job_info_map = {}
|
||||
|
||||
function! ale#engine#AddToHistory(buffer, status, job_id, command) abort
|
||||
if g:ale_max_buffer_history_size <= 0
|
||||
" Don't save anything if the history isn't a positive number.
|
||||
let g:ale_buffer_info[a:buffer].history = []
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
let l:history = g:ale_buffer_info[a:buffer].history
|
||||
|
||||
" Remove the first item if we hit the max history size.
|
||||
if len(l:history) >= g:ale_max_buffer_history_size
|
||||
let l:history = l:history[1:]
|
||||
endif
|
||||
|
||||
call add(l:history, {
|
||||
\ 'status': a:status,
|
||||
\ 'job_id': a:job_id,
|
||||
\ 'command': a:command,
|
||||
\})
|
||||
|
||||
let g:ale_buffer_info[a:buffer].history = l:history
|
||||
endfunction
|
||||
|
||||
function! s:GetJobID(job) abort
|
||||
if has('nvim')
|
||||
"In NeoVim, job values are just IDs.
|
||||
@@ -471,7 +447,7 @@ function! s:RunJob(options) abort
|
||||
" Add the job to the list of jobs, so we can track them.
|
||||
call add(g:ale_buffer_info[l:buffer].job_list, l:job)
|
||||
|
||||
let l:status = 'ran'
|
||||
let l:status = 'started'
|
||||
let l:job_id = s:GetJobID(l:job)
|
||||
" Store the ID for the job in the map to read back again.
|
||||
let s:job_info_map[l:job_id] = {
|
||||
@@ -482,7 +458,7 @@ function! s:RunJob(options) abort
|
||||
\}
|
||||
endif
|
||||
|
||||
call ale#engine#AddToHistory(l:buffer, l:status, l:job_id, l:command)
|
||||
call ale#history#Add(l:buffer, l:status, l:job_id, l:command)
|
||||
endfunction
|
||||
|
||||
" Determine which commands to run for a link in a command chain, or
|
||||
|
||||
Reference in New Issue
Block a user