Add option "syntastic_aggregate_errors".

This commit is contained in:
LCD 47 2013-08-05 09:25:33 +03:00
parent e380a86180
commit de9d56121b
2 changed files with 30 additions and 4 deletions

View File

@ -177,6 +177,15 @@ variable to 0. >
let g:syntastic_check_on_wq=0
<
*'syntastic_aggregate_errors'*
Default: 0
When enabled, |:SyntasticCheck| runs all checkers that apply, then aggregates
errors found by all checkers and displays them. When disabled,
|:SyntasticCheck| runs each checker in turn, and stops to display the results
the first time a checker finds any errors. >
let g:syntastic_aggregate_errors=1
<
*'syntastic_echo_current_error'*
Default: 1
If enabled, syntastic will echo the error associated with the current line to
@ -295,7 +304,7 @@ The option should be set to something like: >
"mode" can be mapped to one of two values - "active" or "passive". When set to
active, syntastic does automatic checking whenever a buffer is saved or
initially opened. When set to "passive" syntastic only checks when the user
calls :SyntasticCheck.
calls |:SyntasticCheck|.
The exceptions to these rules are defined with "active_filetypes" and
"passive_filetypes". In passive mode, automatic checks are still done

View File

@ -44,6 +44,10 @@ if !exists("g:syntastic_check_on_wq")
let g:syntastic_check_on_wq = 1
endif
if !exists("g:syntastic_aggregate_errors")
let g:syntastic_aggregate_errors = 0
endif
if !exists("g:syntastic_loc_list_height")
let g:syntastic_loc_list_height = 10
endif
@ -176,6 +180,7 @@ function! s:CacheErrors(...)
let checkers = s:registry.getActiveCheckers(ft)
endif
let names = []
for checker in checkers
let active_checkers += 1
call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName())
@ -184,14 +189,26 @@ function! s:CacheErrors(...)
if !loclist.isEmpty()
let newLoclist = newLoclist.extend(loclist)
call newLoclist.setName( checker.getName() . ' ('. checker.getFiletype() . ')' )
call add(names, [checker.getName(), checker.getFiletype()])
"only get errors from one checker at a time
break
if !(exists('b:syntastic_aggregate_errors') ? b:syntastic_aggregate_errors : g:syntastic_aggregate_errors)
break
endif
endif
endfor
endfor
if !empty(names)
if len(syntastic#util#unique(map(copy(names), 'v:val[1]'))) == 1
let name = join(map(names, 'v:val[0]'), ', ')
let type = names[0][1]
call newLoclist.setName( name . ' ('. type . ')' )
else
" checkers from mixed types
call newLoclist.setName(join(map(names, 'v:val[1] . "/" . v:val[0]'), ', '))
endif
endif
if !active_checkers
if a:0
call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype)