Only keep "valid" entries in the error count.

The location list returned by getloclist() may contain entries that are
not errorformat matches. By "definition", (see :help getqflist), matched
lines have the attribute "valid": 1 set, so only keep those lines in
error/warning list to avoid erroneous counts and strange behaviors.

Signed-off-by: Florent Bruneau <florent.bruneau@intersec.com>
This commit is contained in:
Florent Bruneau 2012-03-26 22:43:56 +02:00
parent 0fab9ef09d
commit 999d3c1bb3

View File

@ -185,6 +185,8 @@ function! s:CacheErrors()
for ft in split(fts, '\.') for ft in split(fts, '\.')
if s:Checkable(ft) if s:Checkable(ft)
let errors = SyntaxCheckers_{ft}_GetLocList() let errors = SyntaxCheckers_{ft}_GetLocList()
"keep only lines that effectively match an error/warning
let errors = s:FilterLocList({'valid': 1}, errors)
"make errors have type "E" by default "make errors have type "E" by default
call SyntasticAddToErrors(errors, {'type': 'E'}) call SyntasticAddToErrors(errors, {'type': 'E'})
call extend(s:LocList(), errors) call extend(s:LocList(), errors)