2017-05-21 17:42:27 -04:00
|
|
|
Before:
|
2017-09-12 16:17:54 -04:00
|
|
|
Save g:ale_change_sign_column_color
|
2018-07-15 15:57:51 -04:00
|
|
|
Save &verbose
|
2017-09-12 16:17:54 -04:00
|
|
|
|
2017-05-22 04:34:25 -04:00
|
|
|
function! ParseHighlight(name) abort
|
2017-05-21 17:42:27 -04:00
|
|
|
redir => l:output
|
2017-05-22 04:34:25 -04:00
|
|
|
silent execute 'highlight ' . a:name
|
2017-05-21 17:42:27 -04:00
|
|
|
redir end
|
|
|
|
|
2018-07-15 15:57:51 -04:00
|
|
|
return substitute(join(split(l:output)[2:]), ' Last set.*', '', '')
|
2017-05-21 17:42:27 -04:00
|
|
|
endfunction
|
|
|
|
|
2017-05-22 04:34:25 -04: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 17:42:27 -04:00
|
|
|
|
|
|
|
After:
|
2017-09-12 16:17:54 -04:00
|
|
|
Restore
|
|
|
|
|
2017-05-22 04:34:25 -04:00
|
|
|
delfunction ParseHighlight
|
|
|
|
call SetHighlight('SignColumn', g:sign_highlight)
|
|
|
|
delfunction SetHighlight
|
2017-05-21 17:42:27 -04:00
|
|
|
unlet! g:sign_highlight
|
|
|
|
|
2017-09-12 16:17:54 -04:00
|
|
|
sign unplace *
|
|
|
|
|
|
|
|
Execute(The SignColumn highlight shouldn't be changed if the option is off):
|
|
|
|
let g:ale_change_sign_column_color = 0
|
|
|
|
let b:sign_highlight = ParseHighlight('SignColumn')
|
|
|
|
|
|
|
|
call ale#sign#SetSigns(bufnr(''), [
|
|
|
|
\ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'},
|
|
|
|
\])
|
|
|
|
AssertEqual b:sign_highlight, ParseHighlight('SignColumn')
|
|
|
|
|
|
|
|
call ale#sign#SetSigns(bufnr(''), [])
|
|
|
|
AssertEqual b:sign_highlight, ParseHighlight('SignColumn')
|
|
|
|
|
2017-05-21 17:42:27 -04:00
|
|
|
Execute(The SignColumn highlight should be set and reset):
|
2017-09-12 16:17:54 -04:00
|
|
|
let g:ale_change_sign_column_color = 1
|
|
|
|
|
|
|
|
call ale#sign#SetSigns(bufnr(''), [
|
|
|
|
\ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'},
|
|
|
|
\])
|
2017-05-22 04:34:25 -04:00
|
|
|
AssertEqual 'links to ALESignColumnWithErrors', ParseHighlight('SignColumn')
|
2017-05-21 17:42:27 -04:00
|
|
|
|
2017-09-12 16:17:54 -04:00
|
|
|
call ale#sign#SetSigns(bufnr(''), [])
|
2017-05-22 04:34:25 -04:00
|
|
|
AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn')
|
2018-07-15 15:57:51 -04:00
|
|
|
|
|
|
|
Execute(The SignColumn should be correctly parsed when verbose=1):
|
|
|
|
set verbose=1
|
|
|
|
highlight SignColumn ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey
|
|
|
|
|
|
|
|
call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight()
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ has('nvim')
|
|
|
|
\ ? 'ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey'
|
|
|
|
\ : 'term=standout ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey',
|
|
|
|
\ ParseHighlight('ALESignColumnWithoutErrors')
|