2017-05-21 21:42:27 +00:00
|
|
|
Before:
|
2017-05-22 08:34:25 +00:00
|
|
|
function! ParseHighlight(name) abort
|
2017-05-21 21:42:27 +00:00
|
|
|
redir => l:output
|
2017-05-22 08:34:25 +00:00
|
|
|
silent execute 'highlight ' . a:name
|
2017-05-21 21:42:27 +00:00
|
|
|
redir end
|
|
|
|
|
|
|
|
return join(split(l:output)[2:])
|
|
|
|
endfunction
|
|
|
|
|
2017-05-22 08:34:25 +00:00
|
|
|
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')
|
2017-05-21 21:42:27 +00:00
|
|
|
|
|
|
|
After:
|
2017-05-22 08:34:25 +00:00
|
|
|
delfunction ParseHighlight
|
|
|
|
call SetHighlight('SignColumn', g:sign_highlight)
|
|
|
|
delfunction SetHighlight
|
2017-05-21 21:42:27 +00:00
|
|
|
unlet! g:sign_highlight
|
|
|
|
|
|
|
|
Execute(The SignColumn highlight should be set and reset):
|
|
|
|
call ale#sign#SetSignColumnHighlight(1)
|
2017-05-22 08:34:25 +00:00
|
|
|
AssertEqual 'links to ALESignColumnWithErrors', ParseHighlight('SignColumn')
|
2017-05-21 21:42:27 +00:00
|
|
|
|
|
|
|
call ale#sign#SetSignColumnHighlight(0)
|
2017-05-22 08:34:25 +00:00
|
|
|
AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn')
|