diff options
author | Horacio Sanson <hsanson@gmail.com> | 2021-05-23 21:58:13 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-23 21:58:13 +0900 |
commit | 93f80ea7677df8584246262c67dd8575bd98dbeb (patch) | |
tree | b30b13e126c0ddd03e487a42f67940a9de733393 | |
parent | bee8eccb421968d1f2628c15e9f2bfcc3d0418aa (diff) | |
download | ale-93f80ea7677df8584246262c67dd8575bd98dbeb.zip |
Fix 3524 - parse buffer signs with getplaced() function (#3648)
Co-authored-by: Horacio Sanson <horacio@allm.inc>
-rw-r--r-- | autoload/ale/sign.vim | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim index 2864f39b..e796f0f0 100644 --- a/autoload/ale/sign.vim +++ b/autoload/ale/sign.vim @@ -203,6 +203,27 @@ function! ale#sign#ParsePattern() abort return l:pattern endfunction +" Given a buffer number, return a List of placed signs [line, id, group] +function! ale#sign#ParseSignsWithGetPlaced(buffer) abort + let l:signs = sign_getplaced(a:buffer, { 'group': s:supports_sign_groups ? 'ale' : '' })[0].signs + let l:result = [] + let l:is_dummy_sign_set = 0 + + for l:sign in l:signs + if l:sign['name'] is# 'ALEDummySign' + let l:is_dummy_sign_set = 1 + else + call add(l:result, [ + \ str2nr(l:sign['lnum']), + \ str2nr(l:sign['id']), + \ l:sign['name'], + \]) + endif + endfor + + return [l:is_dummy_sign_set, l:result] +endfunction + " Given a list of lines for sign output, return a List of [line, id, group] function! ale#sign#ParseSigns(line_list) abort let l:pattern =ale#sign#ParsePattern() @@ -229,9 +250,13 @@ function! ale#sign#ParseSigns(line_list) abort endfunction function! ale#sign#FindCurrentSigns(buffer) abort - let l:line_list = ale#sign#ReadSigns(a:buffer) + if exists('*sign_getplaced') + return ale#sign#ParseSignsWithGetPlaced(a:buffer) + else + let l:line_list = ale#sign#ReadSigns(a:buffer) - return ale#sign#ParseSigns(l:line_list) + return ale#sign#ParseSigns(l:line_list) + endif endfunction " Given a loclist, group the List into with one List per line. |