Reduce sign column juttering by waiting for all jobs to complete before updating everything.
This commit is contained in:
parent
f44756f347
commit
cb410927d1
@ -30,8 +30,8 @@ function! ale#Lint(...) abort
|
|||||||
" Initialise the buffer information if needed.
|
" Initialise the buffer information if needed.
|
||||||
call ale#engine#InitBufferInfo(l:buffer)
|
call ale#engine#InitBufferInfo(l:buffer)
|
||||||
|
|
||||||
" Set a variable telling us to clear the loclist later.
|
" Clear the new loclist again, so we will work with all new items.
|
||||||
let g:ale_buffer_info[l:buffer].should_reset = 1
|
let g:ale_buffer_info[l:buffer].new_loclist = []
|
||||||
|
|
||||||
for l:linter in l:linters
|
for l:linter in l:linters
|
||||||
" Check if a given linter has a program which can be executed.
|
" Check if a given linter has a program which can be executed.
|
||||||
|
@ -22,11 +22,15 @@ endfunction
|
|||||||
|
|
||||||
function! ale#engine#InitBufferInfo(buffer) abort
|
function! ale#engine#InitBufferInfo(buffer) abort
|
||||||
if !has_key(g:ale_buffer_info, a:buffer)
|
if !has_key(g:ale_buffer_info, a:buffer)
|
||||||
|
" job_list will hold the list of jobs
|
||||||
|
" dummy_sign_set will tell us if we previously created a dummy sign.
|
||||||
|
" loclist holds the loclist items after all jobs have completed.
|
||||||
|
" new_loclist holds loclist items while jobs are being run.
|
||||||
let g:ale_buffer_info[a:buffer] = {
|
let g:ale_buffer_info[a:buffer] = {
|
||||||
\ 'job_list': [],
|
\ 'job_list': [],
|
||||||
\ 'should_reset': 1,
|
|
||||||
\ 'dummy_sign_set': 0,
|
\ 'dummy_sign_set': 0,
|
||||||
\ 'loclist': [],
|
\ 'loclist': [],
|
||||||
|
\ 'new_loclist': [],
|
||||||
\}
|
\}
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -118,20 +122,23 @@ function! s:HandleExit(job) abort
|
|||||||
let l:item.linter_name = l:linter.name
|
let l:item.linter_name = l:linter.name
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
if g:ale_buffer_info[l:buffer].should_reset
|
|
||||||
" Set the flag for resetting the loclist to 0 again, so we won't
|
|
||||||
" empty the list later.
|
|
||||||
let g:ale_buffer_info[l:buffer].should_reset = 0
|
|
||||||
let g:ale_buffer_info[l:buffer].loclist = []
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Add the loclist items from the linter.
|
" Add the loclist items from the linter.
|
||||||
call extend(g:ale_buffer_info[l:buffer].loclist, l:linter_loclist)
|
call extend(g:ale_buffer_info[l:buffer].new_loclist, l:linter_loclist)
|
||||||
|
|
||||||
|
if !empty(g:ale_buffer_info[l:buffer].job_list)
|
||||||
|
" Wait for all jobs to complete before doing anything else.
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
" Sort the loclist again.
|
" Sort the loclist again.
|
||||||
" We need a sorted list so we can run a binary search against it
|
" We need a sorted list so we can run a binary search against it
|
||||||
" for efficient lookup of the messages in the cursor handler.
|
" for efficient lookup of the messages in the cursor handler.
|
||||||
call sort(g:ale_buffer_info[l:buffer].loclist, 'ale#util#LocItemCompare')
|
call sort(g:ale_buffer_info[l:buffer].new_loclist, 'ale#util#LocItemCompare')
|
||||||
|
|
||||||
|
" Now swap the old and new loclists, after we have collected everything
|
||||||
|
" and sorted the list again.
|
||||||
|
let g:ale_buffer_info[l:buffer].loclist = g:ale_buffer_info[l:buffer].new_loclist
|
||||||
|
let g:ale_buffer_info[l:buffer].new_loclist = []
|
||||||
|
|
||||||
if g:ale_set_loclist
|
if g:ale_set_loclist
|
||||||
call setloclist(0, g:ale_buffer_info[l:buffer].loclist)
|
call setloclist(0, g:ale_buffer_info[l:buffer].loclist)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user