Fix #604 - Support highlights spanning many lines

This commit is contained in:
w0rp
2017-05-31 13:14:39 +01:00
parent 676a4049b3
commit ab50b3a88a
5 changed files with 100 additions and 27 deletions

View File

@@ -31,6 +31,8 @@ Before:
highlight link SomeOtherGroup SpellBad
After:
unlet! g:items
delfunction GenerateResults
call ale#linter#Reset()
let g:ale_buffer_info = {}
@@ -173,3 +175,27 @@ Execute(Higlight end columns should set an appropriate size):
\ {'group': 'ALEInfo', 'id': 23, 'priority': 10, 'pos1': [7, 1, 1]},
\ ],
\ getmatches()
Execute(Highlighting should support errors spanning many lines):
let g:items = [
\ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1, 'end_lnum': 10, 'end_col': 3},
\]
call ale#highlight#SetHighlights(bufnr(''), g:items)
" We should set 2 highlights for the item, as we can only add 8 at a time.
AssertEqual
\ [
\ {
\ 'group': 'ALEError', 'id': 24, 'priority': 10, 'pos1': [1, 1, 1073741824],
\ 'pos2': [2], 'pos3': [3], 'pos4': [4], 'pos5': [5], 'pos6': [6],
\ 'pos7': [7], 'pos8': [8],
\ },
\ {
\ 'group': 'ALEError', 'id': 25, 'priority': 10,
\ 'pos1': [9], 'pos2': [10, 1, 3]
\ },
\ ],
\ getmatches()
AssertEqual [[24, 25]], map(copy(g:items), 'v:val.match_id_list')