summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/engine.vim26
1 files changed, 15 insertions, 11 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index a21eecdd..9ef3ba39 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -145,35 +145,39 @@ function! s:GatherOutput(job_id, line) abort
endfunction
function! s:HandleLoclist(linter_name, buffer, loclist) abort
- let l:buffer_info = get(g:ale_buffer_info, a:buffer, {})
+ let l:info = get(g:ale_buffer_info, a:buffer, {})
- if empty(l:buffer_info)
+ if empty(l:info)
return
endif
" Remove this linter from the list of active linters.
" This may have already been done when the job exits.
- call filter(l:buffer_info.active_linter_list, 'v:val isnot# a:linter_name')
+ call filter(l:info.active_linter_list, 'v:val isnot# a:linter_name')
" Make some adjustments to the loclists to fix common problems, and also
" to set default values for loclist items.
let l:linter_loclist = ale#engine#FixLocList(a:buffer, a:linter_name, a:loclist)
" Remove previous items for this linter.
- call filter(g:ale_buffer_info[a:buffer].loclist, 'v:val.linter_name isnot# a:linter_name')
- " Add the new items.
- call extend(g:ale_buffer_info[a:buffer].loclist, l:linter_loclist)
+ call filter(l:info.loclist, 'v:val.linter_name isnot# a:linter_name')
- " Sort the loclist again.
- " We need a sorted list so we can run a binary search against it
- " for efficient lookup of the messages in the cursor handler.
- call sort(g:ale_buffer_info[a:buffer].loclist, 'ale#util#LocItemCompare')
+ " We don't need to add items or sort the list when this list is empty.
+ if !empty(l:linter_loclist)
+ " Add the new items.
+ call extend(l:info.loclist, l:linter_loclist)
+
+ " Sort the loclist again.
+ " We need a sorted list so we can run a binary search against it
+ " for efficient lookup of the messages in the cursor handler.
+ call sort(l:info.loclist, 'ale#util#LocItemCompare')
+ endif
if ale#ShouldDoNothing(a:buffer)
return
endif
- call ale#engine#SetResults(a:buffer, g:ale_buffer_info[a:buffer].loclist)
+ call ale#engine#SetResults(a:buffer, l:info.loclist)
endfunction
function! s:HandleExit(job_id, exit_code) abort