Fix highlighting of errors.
Syntastic by default adds a sign, which is shown in the gutter of the buffer. Signs also add a style to the entire line, and this can be used to style the line containing an error. However, it also shows a sign in the gutter, which I did not want. This commit adds a match style to the line, without requiring a sign to be shown in the gutter.
This commit is contained in:
parent
edb217bc0f
commit
aae033e210
2 changed files with 7 additions and 4 deletions
|
@ -39,9 +39,10 @@ function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2
|
|||
for item in issues
|
||||
let group = 'Syntastic' . get(item, 'subtype', '') . ( item['type'] ==? 'E' ? 'Error' : 'Warning' )
|
||||
|
||||
call matchaddpos(group . 'Line', [item['lnum']])
|
||||
|
||||
" The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is
|
||||
" used to override default highlighting.
|
||||
call matchaddpos(group . 'Line', [item['lnum']])
|
||||
if has_key(item, 'hl')
|
||||
call matchadd(group, '\%' . item['lnum'] . 'l' . item['hl'])
|
||||
elseif get(item, 'col', 0)
|
||||
|
|
|
@ -103,10 +103,12 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
|
|||
if i['lnum'] > 0 && !has_key(seen, i['lnum'])
|
||||
let seen[i['lnum']] = 1
|
||||
|
||||
let severity = i['type'] ==? 'W' ? 'Warning' : 'Error'
|
||||
let type = 'Syntastic' . severity
|
||||
let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error'
|
||||
let sign_subtype = get(i, 'subtype', '')
|
||||
let sign_type = 'Syntastic' . sign_subtype . sign_severity
|
||||
|
||||
call matchaddpos(type, [i['lnum']], 400000)
|
||||
execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr']
|
||||
call add(self._bufSignIds(), s:next_sign_id)
|
||||
let s:next_sign_id += 1
|
||||
endif
|
||||
endfor
|
||||
|
|
Loading…
Add table
Reference in a new issue