Add style highlights for virtualtext and document all of them

This commit is contained in:
w0rp
2018-11-14 16:44:53 +00:00
parent f64f9aba16
commit dd7b2188ab
2 changed files with 81 additions and 22 deletions

View File

@@ -8,12 +8,24 @@ let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10)
let s:cursor_timer = -1
let s:last_pos = [0, 0, 0]
if !hlexists('ALEVirtualTextError')
highlight link ALEVirtualTextError ALEError
endif
if !hlexists('ALEVirtualTextStyleError')
highlight link ALEVirtualTextStyleError ALEVirtualTextError
endif
if !hlexists('ALEVirtualTextWarning')
highlight link ALEVirtualTextWarning ALEWarning
endif
if !hlexists('ALEVirtualTextError')
highlight link ALEVirtualTextError ALEError
if !hlexists('ALEVirtualTextStyleWarning')
highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning
endif
if !hlexists('ALEVirtualTextInfo')
highlight link ALEVirtualTextInfo ALEVirtualTextWarning
endif
function! ale#virtualtext#Clear() abort
@@ -67,13 +79,21 @@ function! ale#virtualtext#ShowCursorWarning(...) abort
if !empty(l:loc)
let l:msg = get(l:loc, 'detail', l:loc.text)
let l:hl_group = 'ALEInfo'
let l:hl_group = 'ALEVirtualTextInfo'
let l:type = get(l:loc, 'type', 'E')
if l:type is# 'E'
let l:hl_group = 'ALEVirtualTextError'
if get(l:loc, 'sub_type', '') is# 'style'
let l:hl_group = 'ALEVirtualTextStyleError'
else
let l:hl_group = 'ALEVirtualTextError'
endif
elseif l:type is# 'W'
let l:hl_group = 'ALEVirtualTextWarning'
if get(l:loc, 'sub_type', '') is# 'style'
let l:hl_group = 'ALEVirtualTextStyleWarning'
else
let l:hl_group = 'ALEVirtualTextWarning'
endif
endif
call ale#virtualtext#ShowMessage(l:msg, l:hl_group)