#653 - Filter items based on the buffer number for signs
This commit is contained in:
@@ -104,11 +104,15 @@ function! ale#sign#FindCurrentSigns(buffer) abort
|
||||
endfunction
|
||||
|
||||
" Given a loclist, group the List into with one List per line.
|
||||
function! s:GroupLoclistItems(loclist) abort
|
||||
function! s:GroupLoclistItems(buffer, loclist) abort
|
||||
let l:grouped_items = []
|
||||
let l:last_lnum = -1
|
||||
|
||||
for l:obj in a:loclist
|
||||
if l:obj.bufnr != a:buffer
|
||||
continue
|
||||
endif
|
||||
|
||||
" Create a new sub-List when we hit a new line.
|
||||
if l:obj.lnum != l:last_lnum
|
||||
call add(l:grouped_items, [])
|
||||
@@ -231,11 +235,11 @@ function! s:PlaceNewSigns(buffer, grouped_items, current_sign_offset) abort
|
||||
endfunction
|
||||
|
||||
" Get items grouped by any current sign IDs they might have.
|
||||
function! s:GetItemsWithSignIDs(loclist) abort
|
||||
function! s:GetItemsWithSignIDs(buffer, loclist) abort
|
||||
let l:items_by_sign_id = {}
|
||||
|
||||
for l:item in a:loclist
|
||||
if has_key(l:item, 'sign_id')
|
||||
if l:item.bufnr == a:buffer && has_key(l:item, 'sign_id')
|
||||
if !has_key(l:items_by_sign_id, l:item.sign_id)
|
||||
let l:items_by_sign_id[l:item.sign_id] = []
|
||||
endif
|
||||
@@ -273,14 +277,14 @@ function! ale#sign#SetSigns(buffer, loclist) abort
|
||||
" Find the current markers
|
||||
let l:current_sign_list = ale#sign#FindCurrentSigns(a:buffer)
|
||||
" Get a mapping from sign IDs to current loclist items which have them.
|
||||
let l:items_by_sign_id = s:GetItemsWithSignIDs(a:loclist)
|
||||
let l:items_by_sign_id = s:GetItemsWithSignIDs(a:buffer, a:loclist)
|
||||
|
||||
" Use sign information to update the line numbers for the loclist items.
|
||||
call s:UpdateLineNumbers(l:current_sign_list, l:items_by_sign_id)
|
||||
" Sort items again, as the line numbers could have changed.
|
||||
call sort(a:loclist, 'ale#util#LocItemCompare')
|
||||
|
||||
let l:grouped_items = s:GroupLoclistItems(a:loclist)
|
||||
let l:grouped_items = s:GroupLoclistItems(a:buffer, a:loclist)
|
||||
|
||||
" Set the dummy sign if we need to.
|
||||
" This keeps the sign gutter open while we remove things, etc.
|
||||
|
||||
Reference in New Issue
Block a user