Fix #741 - Set highlights for entire lines when signs are disabled
This commit is contained in:
parent
22ec81e1de
commit
5635b3c864
@ -91,6 +91,22 @@ function! ale#highlight#UpdateHighlights() abort
|
|||||||
\ 'matchaddpos(l:group, v:val)'
|
\ 'matchaddpos(l:group, v:val)'
|
||||||
\)
|
\)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
" If highlights are enabled and signs are not enabled, we should still
|
||||||
|
" offer line highlights by adding a separate set of highlights.
|
||||||
|
if !g:ale_set_signs
|
||||||
|
for l:item in l:item_list
|
||||||
|
if l:item.type is# 'W'
|
||||||
|
let l:group = 'ALEWarningLine'
|
||||||
|
elseif l:item.type is# 'I'
|
||||||
|
let l:group = 'ALEInfoLine'
|
||||||
|
else
|
||||||
|
let l:group = 'ALEErrorLine'
|
||||||
|
endif
|
||||||
|
|
||||||
|
call matchaddpos(l:group, [l:item.lnum])
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#highlight#BufferHidden(buffer) abort
|
function! ale#highlight#BufferHidden(buffer) abort
|
||||||
|
26
doc/ale.txt
26
doc/ale.txt
@ -1149,6 +1149,17 @@ g:ale_set_highlights *g:ale_set_highlights*
|
|||||||
|ALEStyleError| - Items with `'type': 'E'` and `'sub_type': 'style'`
|
|ALEStyleError| - Items with `'type': 'E'` and `'sub_type': 'style'`
|
||||||
|ALEStyleWarning| - Items with `'type': 'W'` and `'sub_type': 'style'`
|
|ALEStyleWarning| - Items with `'type': 'W'` and `'sub_type': 'style'`
|
||||||
|
|
||||||
|
When |g:ale_set_signs| is set to `0`, the following highlights for entire
|
||||||
|
lines will be set.
|
||||||
|
|
||||||
|
|ALEErrorLine| - All items with `'type': 'E'`
|
||||||
|
|ALEWarningLine| - All items with `'type': 'W'`
|
||||||
|
|ALEInfoLine| - All items with `'type': 'I'`
|
||||||
|
|
||||||
|
Vim can only highlight the characters up to the last column in a buffer for
|
||||||
|
match highlights, whereas the line highlights when signs are enabled will
|
||||||
|
run to the edge of the screen.
|
||||||
|
|
||||||
|
|
||||||
g:ale_set_loclist *g:ale_set_loclist*
|
g:ale_set_loclist *g:ale_set_loclist*
|
||||||
|
|
||||||
@ -1366,7 +1377,10 @@ ALEErrorLine *ALEErrorLine*
|
|||||||
|
|
||||||
Default: Undefined
|
Default: Undefined
|
||||||
|
|
||||||
The highlight for lines where error signs appear. See |g:ale_set_signs|.
|
The highlight for an entire line where errors appear. Only the first
|
||||||
|
line for a problem will be highlighted.
|
||||||
|
|
||||||
|
See |g:ale_set_signs| and |g:ale_set_highlights|.
|
||||||
|
|
||||||
|
|
||||||
ALEErrorSign *ALEErrorSign*
|
ALEErrorSign *ALEErrorSign*
|
||||||
@ -1394,7 +1408,10 @@ ALEInfoLine *ALEInfoLine*
|
|||||||
|
|
||||||
Default: Undefined
|
Default: Undefined
|
||||||
|
|
||||||
The highlight for lines where info signs appear. See |g:ale_set_signs|.
|
The highlight for entire lines where info messages appear. Only the first
|
||||||
|
line for a problem will be highlighted.
|
||||||
|
|
||||||
|
See |g:ale_set_signs| and |g:ale_set_highlights|.
|
||||||
|
|
||||||
|
|
||||||
ALEStyleError *ALEStyleError*
|
ALEStyleError *ALEStyleError*
|
||||||
@ -1436,7 +1453,10 @@ ALEWarningLine *ALEWarningLine*
|
|||||||
|
|
||||||
Default: Undefined
|
Default: Undefined
|
||||||
|
|
||||||
The highlight for lines where warning signs appear. See |g:ale_set_signs|.
|
The highlight for entire lines where warnings appear. Only the first line
|
||||||
|
for a problem will be highlighted.
|
||||||
|
|
||||||
|
See |g:ale_set_signs| and |g:ale_set_highlights|.
|
||||||
|
|
||||||
|
|
||||||
ALEWarningSign *ALEWarningSign*
|
ALEWarningSign *ALEWarningSign*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
Before:
|
Before:
|
||||||
Save g:ale_enabled
|
Save g:ale_enabled
|
||||||
|
Save g:ale_set_signs
|
||||||
|
|
||||||
function! GenerateResults(buffer, output)
|
function! GenerateResults(buffer, output)
|
||||||
return [
|
return [
|
||||||
@ -258,3 +259,23 @@ Execute(Highlights should be cleared when ALE is disabled):
|
|||||||
call ale#highlight#UpdateHighlights()
|
call ale#highlight#UpdateHighlights()
|
||||||
|
|
||||||
AssertEqual [], GetMatchesWithoutIDs()
|
AssertEqual [], GetMatchesWithoutIDs()
|
||||||
|
|
||||||
|
Execute(Line highlights should be set when signs are disabled):
|
||||||
|
let g:ale_set_signs = 0
|
||||||
|
|
||||||
|
call ale#highlight#SetHighlights(bufnr(''), [
|
||||||
|
\ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1},
|
||||||
|
\ {'bufnr': bufnr(''), 'type': 'W', 'lnum': 2, 'col': 1},
|
||||||
|
\ {'bufnr': bufnr(''), 'type': 'I', 'lnum': 3, 'col': 1},
|
||||||
|
\])
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {'group': 'ALEError', 'priority': 10, 'pos1': [1, 1, 1]},
|
||||||
|
\ {'group': 'ALEWarning', 'priority': 10, 'pos1': [2, 1, 1]},
|
||||||
|
\ {'group': 'ALEInfo', 'priority': 10, 'pos1': [3, 1, 1]},
|
||||||
|
\ {'group': 'ALEErrorLine', 'priority': 10, 'pos1': [1]},
|
||||||
|
\ {'group': 'ALEWarningLine', 'priority': 10, 'pos1': [2]},
|
||||||
|
\ {'group': 'ALEInfoLine', 'priority': 10, 'pos1': [3]},
|
||||||
|
\ ],
|
||||||
|
\ GetMatchesWithoutIDs()
|
||||||
|
Loading…
Reference in New Issue
Block a user