summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-05-21 19:22:48 +0100
committerw0rp <devw0rp@gmail.com>2017-05-21 19:22:48 +0100
commit23ee0d0992c876c605555a3a667cc84c52382ed4 (patch)
treee04f2a30d1a4dbca20d28d48939fc9766e3f916b /autoload
parent57ad32f98656eebdc8c903d670c92cf458b31dce (diff)
downloadale-23ee0d0992c876c605555a3a667cc84c52382ed4.zip
#149 - Set different highlights for info, style error, and style warning problems
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/highlight.vim28
1 files changed, 27 insertions, 1 deletions
diff --git a/autoload/ale/highlight.vim b/autoload/ale/highlight.vim
index 4ac1d1e4..60ae393e 100644
--- a/autoload/ale/highlight.vim
+++ b/autoload/ale/highlight.vim
@@ -6,10 +6,22 @@ if !hlexists('ALEError')
highlight link ALEError SpellBad
endif
+if !hlexists('ALEStyleError')
+ highlight link ALEStyleError ALEError
+endif
+
if !hlexists('ALEWarning')
highlight link ALEWarning SpellCap
endif
+if !hlexists('ALEStyleWarning')
+ highlight link ALEStyleWarning ALEWarning
+endif
+
+if !hlexists('ALEInfo')
+ highlight link ALEInfo ALEWarning
+endif
+
" This map holds highlights to be set when buffers are opened.
" We can only set highlights for whatever the current buffer is, so we will
" wait until the buffer is entered again to show the highlights, unless
@@ -84,7 +96,21 @@ function! ale#highlight#UpdateHighlights() abort
if g:ale_enabled
for l:item in l:loclist
let l:col = l:item.col
- let l:group = l:item.type ==# 'E' ? 'ALEError' : 'ALEWarning'
+
+ if l:item.type ==# 'W'
+ if get(l:item, 'sub_type', '') ==# 'style'
+ let l:group = 'ALEStyleWarning'
+ else
+ let l:group = 'ALEWarning'
+ endif
+ elseif l:item.type ==# 'I'
+ let l:group = 'ALEInfo'
+ elseif get(l:item, 'sub_type', '') ==# 'style'
+ let l:group = 'ALEStyleError'
+ else
+ let l:group = 'ALEError'
+ endif
+
let l:line = l:item.lnum
let l:size = has_key(l:item, 'end_col') ? l:item.end_col - l:col + 1 : 1