Fix #1687 - Parse highlights when verbose > 0

This commit is contained in:
w0rp 2018-07-15 20:57:51 +01:00
parent ab2b181012
commit d29e32d42d
No known key found for this signature in database
GPG key ID: 0FC1ECAA8C81CD83
2 changed files with 30 additions and 19 deletions

View file

@ -45,14 +45,12 @@ if !hlexists('ALESignColumnWithErrors')
highlight link ALESignColumnWithErrors error highlight link ALESignColumnWithErrors error
endif endif
if !hlexists('ALESignColumnWithoutErrors') function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort
function! s:SetSignColumnWithoutErrorsHighlight() abort
redir => l:output redir => l:output
silent highlight SignColumn 0verbose silent highlight SignColumn
redir end redir end
let l:highlight_syntax = join(split(l:output)[2:]) let l:highlight_syntax = join(split(l:output)[2:])
let l:match = matchlist(l:highlight_syntax, '\vlinks to (.+)$') let l:match = matchlist(l:highlight_syntax, '\vlinks to (.+)$')
if !empty(l:match) if !empty(l:match)
@ -62,8 +60,8 @@ if !hlexists('ALESignColumnWithoutErrors')
endif endif
endfunction endfunction
call s:SetSignColumnWithoutErrorsHighlight() if !hlexists('ALESignColumnWithoutErrors')
delfunction s:SetSignColumnWithoutErrorsHighlight call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight()
endif endif
" Signs show up on the left for error markers. " Signs show up on the left for error markers.

View file

@ -1,12 +1,13 @@
Before: Before:
Save g:ale_change_sign_column_color Save g:ale_change_sign_column_color
Save &verbose
function! ParseHighlight(name) abort function! ParseHighlight(name) abort
redir => l:output redir => l:output
silent execute 'highlight ' . a:name silent execute 'highlight ' . a:name
redir end redir end
return join(split(l:output)[2:]) return substitute(join(split(l:output)[2:]), ' Last set.*', '', '')
endfunction endfunction
function! SetHighlight(name, syntax) abort function! SetHighlight(name, syntax) abort
@ -53,3 +54,15 @@ Execute(The SignColumn highlight should be set and reset):
call ale#sign#SetSigns(bufnr(''), []) call ale#sign#SetSigns(bufnr(''), [])
AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn') AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn')
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')