diff options
-rw-r--r-- | autoload/ale/highlight.vim | 14 | ||||
-rw-r--r-- | test/test_highlight_placement.vader | 6 | ||||
-rw-r--r-- | test/test_linting_updates_loclist.vader | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/autoload/ale/highlight.vim b/autoload/ale/highlight.vim index 60ae393e..2240c595 100644 --- a/autoload/ale/highlight.vim +++ b/autoload/ale/highlight.vim @@ -55,9 +55,9 @@ function! s:GetCurrentMatchIDs(loclist) abort let l:current_id_map = {} for l:item in a:loclist - if has_key(l:item, 'match_id') - let l:current_id_map[l:item.match_id] = 1 - endif + for l:id in get(l:item, 'match_id_list', []) + let l:current_id_map[l:id] = 1 + endfor endfor return l:current_id_map @@ -85,7 +85,7 @@ function! ale#highlight#UpdateHighlights() abort endif " Remove anything with a current match_id - call filter(l:loclist, '!has_key(v:val, ''match_id'')') + call filter(l:loclist, '!has_key(v:val, ''match_id_list'')') " Restore items from the map of hidden items, " if we don't have some new items to set already. @@ -117,7 +117,7 @@ function! ale#highlight#UpdateHighlights() abort " Rememeber the match ID for the item. " This ID will be used to preserve loclist items which are set " many times. - let l:item.match_id = matchaddpos(l:group, [[l:line, l:col, l:size]]) + let l:item.match_id_list = [matchaddpos(l:group, [[l:line, l:col, l:size]])] endfor endif endfunction @@ -130,8 +130,8 @@ function! ale#highlight#BufferHidden(buffer) abort " Remove match_ids, as they must be re-calculated when buffers are " shown again. for l:item in l:loclist - if has_key(l:item, 'match_id') - call remove(l:item, 'match_id') + if has_key(l:item, 'match_id_list') + call remove(l:item, 'match_id_list') endif endfor diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader index 454f6209..a728fce0 100644 --- a/test/test_highlight_placement.vader +++ b/test/test_highlight_placement.vader @@ -55,15 +55,15 @@ Execute(Highlights should be set when a linter runs): \ ], \ getmatches() - AssertEqual [4, 5, 6], map(copy(g:ale_buffer_info[bufnr('')].loclist), 'v:val.match_id') + AssertEqual [[4], [5], [6]], map(copy(g:ale_buffer_info[bufnr('')].loclist), 'v:val.match_id_list') Execute(Existing highlights should be kept): call matchaddpos('ALEError', [[1, 2, 1]], 10, 347) call matchaddpos('ALEWarning', [[2, 2, 1]], 10, 348) call ale#highlight#SetHighlights(bufnr('%'), [ - \ {'bufnr': bufnr('%'), 'match_id': 347, 'type': 'E', 'lnum': 1, 'col': 2}, - \ {'bufnr': bufnr('%'), 'match_id': 348, 'type': 'W', 'lnum': 2, 'col': 2}, + \ {'bufnr': bufnr('%'), 'match_id_list': [347], 'type': 'E', 'lnum': 1, 'col': 2}, + \ {'bufnr': bufnr('%'), 'match_id_list': [348], 'type': 'W', 'lnum': 2, 'col': 2}, \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2}, \ {'bufnr': bufnr('%'), 'type': 'W', 'lnum': 4, 'col': 1}, \]) diff --git a/test/test_linting_updates_loclist.vader b/test/test_linting_updates_loclist.vader index b8a938a0..009a4537 100644 --- a/test/test_linting_updates_loclist.vader +++ b/test/test_linting_updates_loclist.vader @@ -66,7 +66,7 @@ Execute(The loclist should be updated after linting is done): AssertEqual ['' . bufnr('%')], keys(g:ale_buffer_info) - let g:expected_data[0].match_id = getmatches()[0].id - let g:expected_data[1].match_id = getmatches()[1].id + let g:expected_data[0].match_id_list = [getmatches()[0].id] + let g:expected_data[1].match_id_list = [getmatches()[1].id] AssertEqual g:expected_data, g:ale_buffer_info[bufnr('%')].loclist |