Display warnings only when there are no errors messages.

In large code base, typically there will lot of warnings because the
file has been changed by many people and not everyone bothered to follow
coding conventions. So its more useful to show the errors first. Once
all errors have been fixed, we can focus on warnings.
This commit is contained in:
Kannan Rajah 2014-10-12 17:38:06 -07:00
parent 0bc3a21116
commit 84c242a27d

View File

@ -20,12 +20,24 @@ function! airline#extensions#eclim#get_warnings()
if !empty(eclimList) if !empty(eclimList)
" Remove any non-eclim signs (see eclim#display#signs#Update) " Remove any non-eclim signs (see eclim#display#signs#Update)
call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\|info\\|warning\\)$"') " First check for just errors since they are more important.
" If there are no errors, then check for warnings.
let errorList = filter(copy(eclimList), 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\)$"')
if (empty(errorList))
" use the warnings
call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(info\\|warning\\)$"')
let type = 'W'
else
" Use the errors
let eclimList = errorList
let type = 'E'
endif
if !empty(eclimList) if !empty(eclimList)
let errorsLine = eclimList[0]['line'] let errorsLine = eclimList[0]['line']
let errorsNumber = len(eclimList) let errorsNumber = len(eclimList)
let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]" let errors = "[Eclim:" . type . " line:".string(errorsLine)." (".string(errorsNumber).")]"
if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == ''
return errors.(g:airline_symbols.space) return errors.(g:airline_symbols.space)
endif endif