summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/engine.vim6
-rw-r--r--autoload/ale/highlight.vim23
2 files changed, 19 insertions, 10 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 36323354..a99eccca 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -291,11 +291,15 @@ function! ale#engine#FixLocList(buffer, linter, loclist) abort
let l:item.detail = l:old_item.detail
endif
- " Pass on a col_length key if set, used for highlights.
+ " Pass on a end_col key if set, used for highlights.
if has_key(l:old_item, 'end_col')
let l:item.end_col = str2nr(l:old_item.end_col)
endif
+ if has_key(l:old_item, 'end_lnum')
+ let l:item.end_lnum = str2nr(l:old_item.end_lnum)
+ endif
+
if has_key(l:old_item, 'sub_type')
let l:item.sub_type = l:old_item.sub_type
endif
diff --git a/autoload/ale/highlight.vim b/autoload/ale/highlight.vim
index 7807c8da..d63e7166 100644
--- a/autoload/ale/highlight.vim
+++ b/autoload/ale/highlight.vim
@@ -30,7 +30,7 @@ let s:buffer_highlights = {}
let s:buffer_restore_map = {}
" The maximum number of items for the second argument of matchaddpos()
let s:MAX_POS_VALUES = 8
-let s:MAX_COL_SIZE = 4294967296
+let s:MAX_COL_SIZE = 1073741824 " pow(2, 30)
function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort
if a:line >= a:end_line
@@ -119,8 +119,6 @@ function! ale#highlight#UpdateHighlights() abort
if g:ale_enabled
for l:item in l:loclist
- let l:col = l:item.col
-
if l:item.type ==# 'W'
if get(l:item, 'sub_type', '') ==# 'style'
let l:group = 'ALEStyleWarning'
@@ -136,12 +134,19 @@ function! ale#highlight#UpdateHighlights() abort
endif
let l:line = l:item.lnum
- let l:size = has_key(l:item, 'end_col') ? l:item.end_col - l:col + 1 : 1
-
- " 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_list = [matchaddpos(l:group, [[l:line, l:col, l:size]])]
+ let l:col = l:item.col
+ let l:end_line = get(l:item, 'end_lnum', l:line)
+ let l:end_col = get(l:item, 'end_col', l:col)
+
+ " Set all of the positions, which are chunked into Lists which
+ " are as large as will be accepted by matchaddpos.
+ "
+ " We will remember the IDs we set, so we can preserve some
+ " highlights when linting buffers after linting files.
+ let l:item.match_id_list = map(
+ \ ale#highlight#CreatePositions(l:line, l:col, l:end_line, l:end_col),
+ \ 'matchaddpos(l:group, v:val)'
+ \)
endfor
endif
endfunction