diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-15 20:57:51 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-15 21:01:00 +0100 |
commit | d3ed1e52ba33375c445353a0395b0caf9bd662f6 (patch) | |
tree | 7993f8c42807fb01b6fc25bb3a4a9fdf0d39fae5 | |
parent | 72f002de941fb28bc454ad6417de63690ad54233 (diff) | |
download | ale-d3ed1e52ba33375c445353a0395b0caf9bd662f6.zip |
Fix #1687 - Parse highlights when verbose > 0
-rw-r--r-- | autoload/ale/sign.vim | 30 | ||||
-rw-r--r-- | test/sign/test_sign_column_highlighting.vader | 15 |
2 files changed, 28 insertions, 17 deletions
diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim index 31663721..a0dde359 100644 --- a/autoload/ale/sign.vim +++ b/autoload/ale/sign.vim @@ -45,25 +45,23 @@ if !hlexists('ALESignColumnWithErrors') highlight link ALESignColumnWithErrors error endif -if !hlexists('ALESignColumnWithoutErrors') - function! s:SetSignColumnWithoutErrorsHighlight() abort - redir => l:output - silent highlight SignColumn - redir end - - let l:highlight_syntax = join(split(l:output)[2:]) +function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort + redir => l:output + 0verbose silent highlight SignColumn + redir end - let l:match = matchlist(l:highlight_syntax, '\vlinks to (.+)$') + let l:highlight_syntax = 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] - elseif l:highlight_syntax isnot# 'cleared' - execute 'highlight ALESignColumnWithoutErrors ' . l:highlight_syntax - endif - endfunction + if !empty(l:match) + execute 'highlight link ALESignColumnWithoutErrors ' . l:match[1] + elseif l:highlight_syntax isnot# 'cleared' + execute 'highlight ALESignColumnWithoutErrors ' . l:highlight_syntax + endif +endfunction - call s:SetSignColumnWithoutErrorsHighlight() - delfunction s:SetSignColumnWithoutErrorsHighlight +if !hlexists('ALESignColumnWithoutErrors') + call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() endif " Signs show up on the left for error markers. diff --git a/test/sign/test_sign_column_highlighting.vader b/test/sign/test_sign_column_highlighting.vader index 4457a45c..0b506fa7 100644 --- a/test/sign/test_sign_column_highlighting.vader +++ b/test/sign/test_sign_column_highlighting.vader @@ -1,12 +1,13 @@ Before: Save g:ale_change_sign_column_color + Save &verbose function! ParseHighlight(name) abort redir => l:output silent execute 'highlight ' . a:name redir end - return join(split(l:output)[2:]) + return substitute(join(split(l:output)[2:]), ' Last set.*', '', '') endfunction function! SetHighlight(name, syntax) abort @@ -53,3 +54,15 @@ Execute(The SignColumn highlight should be set and reset): call ale#sign#SetSigns(bufnr(''), []) 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') |