diff options
Diffstat (limited to 'ale_linters/vim/vint.vim')
-rw-r--r-- | ale_linters/vim/vint.vim | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim index 18ae2e4c..adf2b4ab 100644 --- a/ale_linters/vim/vint.vim +++ b/ale_linters/vim/vint.vim @@ -36,6 +36,32 @@ function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort \ . ' %t' endfunction +let s:word_regex_list = [ +\ '\v^Undefined variable: ([^ ]+)', +\ '\v^Make the scope explicit like ...([^ ]+). ', +\ '\v^.*start with a capital or contain a colon: ([^ ]+)', +\ '\v.*instead of .(\=[=~]).', +\] + +function! ale_linters#vim#vint#Handle(buffer, lines) abort + let l:loclist = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines) + + for l:item in l:loclist + let l:match = [] + + for l:regex in s:word_regex_list + let l:match = matchlist(l:item.text, l:regex) + + if !empty(l:match) + let l:item.end_col = l:item.col + len(l:match[1]) - 1 + break + endif + endfor + endfor + + return l:loclist +endfunction + call ale#linter#Define('vim', { \ 'name': 'vint', \ 'executable': 'vint', @@ -43,5 +69,5 @@ call ale#linter#Define('vim', { \ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'}, \ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'}, \ ], -\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', +\ 'callback': 'ale_linters#vim#vint#Handle', \}) |