SyntasticChecker: extract out the highlight regex population code

This commit is contained in:
Martin Grenfell 2013-03-18 10:00:49 +00:00
parent 0906a5c5d1
commit fd90fdf9f4

View File

@ -37,16 +37,7 @@ endfunction
function! g:SyntasticChecker.getLocList()
let list = self._locListFunc()
if !empty(self._highlightRegexFunc)
for i in range(0, len(list)-1)
if list[i]['valid']
let term = self._highlightRegexFunc(list[i])
if len(term) > 0
let list[i]['hl'] = term
endif
endif
endfor
endif
call self._populateHighlightRegexes(list)
return g:SyntasticLoclist.New(list)
endfunction
@ -62,4 +53,19 @@ function! g:SyntasticChecker.isAvailable()
return self._isAvailableFunc()
endfunction
function! g:SyntasticChecker._populateHighlightRegexes(list)
let list = a:list
if !empty(self._highlightRegexFunc)
for i in range(0, len(list)-1)
if list[i]['valid']
let term = self._highlightRegexFunc(list[i])
if len(term) > 0
let list[i]['hl'] = term
endif
endif
endfor
endif
return list
endfunction
" vim: set sw=4 sts=4 et fdm=marker: