diff options
author | w0rp <devw0rp@gmail.com> | 2017-08-13 16:30:46 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-08-13 16:30:46 +0100 |
commit | 2d02de33d4ac8b90437b13467956530b8df32bf1 (patch) | |
tree | 1c783022bd822dd0f3b51c64a7738166171688bb /autoload | |
parent | ea124c49d015743d2437f5c500c1d05229a4d677 (diff) | |
download | ale-2d02de33d4ac8b90437b13467956530b8df32bf1.zip |
#653 - Filter items based on the buffer number for signs
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/sign.vim | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim index 0652f4f1..f9f13f50 100644 --- a/autoload/ale/sign.vim +++ b/autoload/ale/sign.vim @@ -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. |