Only auto-display the loclist if there are errors, but not if there are only warnings

Signed-off-by: Martin Grenfell <martin_grenfell@msn.com>
This commit is contained in:
Tim Carey-Smith 2009-07-17 11:51:48 +08:00 committed by Martin Grenfell
parent e9c992da05
commit 33d7086c34

View File

@ -146,10 +146,21 @@ function! s:CacheErrors()
endfunction
"return true if there are cached errors for this buf
function! s:BufHasErrors()
function! s:BufHasErrorsOrWarnings()
return exists("b:syntastic_loclist") && !empty(b:syntastic_loclist)
endfunction
function! s:BufHasErrors()
if exists("b:syntastic_loclist")
for i in b:syntastic_loclist
if i['type'] == 'E'
return 1
endif
endfor
endif
return 0
endfunction
"use >> to display syntax errors in the sign column
sign define SyntasticError text=>> texthl=error
@ -163,7 +174,7 @@ let s:next_sign_id = s:first_sign_id
"place signs by all syntax errs in the buffer
function s:SignErrors()
if s:BufHasErrors()
if s:BufHasErrorsOrWarnings()
for i in b:syntastic_loclist
let sign_type = 'SyntasticError'
if i['type'] == 'W'
@ -217,7 +228,7 @@ command Errors call s:ShowLocList()
"
"return '' if no errors are cached for the buffer
function! SyntasticStatuslineFlag()
if s:BufHasErrors()
if s:BufHasErrorsOrWarnings()
let first_err_line = b:syntastic_loclist[0]['lnum']
let err_count = ""
if len(b:syntastic_loclist) > 1