mirror of
https://github.com/dense-analysis/ale
synced 2024-12-25 23:52:22 +00:00
Fix #572 - Link to whatever SignColumn links to for ALESignColumnWithoutErrors
This commit is contained in:
parent
c8ce15d9f1
commit
71bf2bfb94
@ -34,8 +34,15 @@ if !hlexists('ALESignColumnWithoutErrors')
|
|||||||
silent highlight SignColumn
|
silent highlight SignColumn
|
||||||
redir end
|
redir end
|
||||||
|
|
||||||
execute 'highlight ALESignColumnWithoutErrors '
|
let l:highlight_syntax = join(split(l:output)[2:])
|
||||||
\ . join(split(l:output)[2:])
|
|
||||||
|
let l:match = matchlist(l:highlight_syntax, '\vlinks to (.+)$')
|
||||||
|
|
||||||
|
if !empty(l:match)
|
||||||
|
execute 'highlight link ALESignColumnWithoutErrors ' . l:match[1]
|
||||||
|
else
|
||||||
|
execute 'highlight ALESignColumnWithoutErrors ' . l:highlight_syntax
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:SetSignColumnWithoutErrorsHighlight()
|
call s:SetSignColumnWithoutErrorsHighlight()
|
||||||
|
@ -1,22 +1,42 @@
|
|||||||
Before:
|
Before:
|
||||||
function! ParseSignColumnHighlight() abort
|
function! ParseHighlight(name) abort
|
||||||
redir => l:output
|
redir => l:output
|
||||||
silent highlight SignColumn
|
silent execute 'highlight ' . a:name
|
||||||
redir end
|
redir end
|
||||||
|
|
||||||
return join(split(l:output)[2:])
|
return join(split(l:output)[2:])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let g:sign_highlight = ParseSignColumnHighlight()
|
function! SetHighlight(name, syntax) abort
|
||||||
|
let l:match = matchlist(a:syntax, '\vlinks to (.+)$')
|
||||||
|
|
||||||
|
if !empty(l:match)
|
||||||
|
execute 'highlight link ' . a:name . ' ' . l:match[1]
|
||||||
|
else
|
||||||
|
execute 'highlight ' . a:name . ' ' a:syntax
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let g:sign_highlight = ParseHighlight('SignColumn')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
delfunction ParseSignColumnHighlight
|
delfunction ParseHighlight
|
||||||
execute 'highlight SignColumn ' . g:sign_highlight
|
call SetHighlight('SignColumn', g:sign_highlight)
|
||||||
|
delfunction SetHighlight
|
||||||
unlet! g:sign_highlight
|
unlet! g:sign_highlight
|
||||||
|
|
||||||
Execute(The SignColumn highlight should be set and reset):
|
Execute(The SignColumn highlight should be set and reset):
|
||||||
call ale#sign#SetSignColumnHighlight(1)
|
call ale#sign#SetSignColumnHighlight(1)
|
||||||
AssertEqual 'links to ALESignColumnWithErrors', ParseSignColumnHighlight()
|
AssertEqual 'links to ALESignColumnWithErrors', ParseHighlight('SignColumn')
|
||||||
|
|
||||||
call ale#sign#SetSignColumnHighlight(0)
|
call ale#sign#SetSignColumnHighlight(0)
|
||||||
AssertEqual 'links to ALESignColumnWithoutErrors', ParseSignColumnHighlight()
|
AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn')
|
||||||
|
|
||||||
|
Execute(ALESignColumnWithoutErrors should link to what SignColumn links to):
|
||||||
|
highlight clear SignColumn
|
||||||
|
highlight link SignColumn LineNr
|
||||||
|
highlight clear ALESignColumnWithoutErrors
|
||||||
|
|
||||||
|
runtime 'autoload/ale/sign.vim'
|
||||||
|
|
||||||
|
AssertEqual 'links to LineNr', ParseHighlight('ALESignColumnWithoutErrors')
|
||||||
|
Loading…
Reference in New Issue
Block a user