From b9cf450684fda2a10dcc65bb09ef11b10469363f Mon Sep 17 00:00:00 2001 From: w0rp Date: Sat, 26 Aug 2017 17:23:20 +0100 Subject: Set the end column for some Vint problems --- ale_linters/vim/vint.vim | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'ale_linters') 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', \}) -- cgit v1.2.3