Minor cleanup.

Warning signs should not overwrite error ones.
Use buffers instead of file names when placing signs.
Other minor changes.
This commit is contained in:
LCD 47 2013-04-10 13:40:03 +03:00
parent 31b654301b
commit 11380c2d51
4 changed files with 18 additions and 21 deletions

View File

@ -101,17 +101,15 @@ function! s:UpdateErrors(auto_invoked, ...)
endif
end
call s:notifiers.refresh(g:SyntasticLoclist.Current())
let loclist = g:SyntasticLoclist.Current()
if g:syntastic_always_populate_loc_list && loclist.hasErrorsOrWarningsToDisplay()
call setloclist(0, loclist.filteredRaw())
endif
call s:notifiers.refresh(loclist)
if g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay()
if (g:syntastic_always_populate_loc_list || g:syntastic_auto_jump) && loclist.hasErrorsOrWarningsToDisplay()
call setloclist(0, loclist.filteredRaw())
if g:syntastic_auto_jump
silent! ll
endif
endif
endfunction
"clear the loc list for the buffer

View File

@ -31,6 +31,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist)
endfunction
function! g:SyntasticCursorNotifier.reset(loclist)
unlet b:syntastic_messages
let b:oldLine = -1
endfunction

View File

@ -47,6 +47,10 @@ function! g:SyntasticLoclist.filteredRaw()
return copy(self._quietWarnings ? self.errors() : self._rawLoclist)
endfunction
function! g:SyntasticLoclist.quietWarnings()
return self._quietWarnings
endfunction
function! g:SyntasticLoclist.isEmpty()
return empty(self._rawLoclist)
endfunction

View File

@ -103,24 +103,18 @@ function! g:SyntasticSignsNotifier._signErrors(loclist)
let loclist = a:loclist
if loclist.hasErrorsOrWarningsToDisplay()
let lfilter = {'bufnr': bufnr('')}
if g:syntastic_quiet_warnings
let lfilter['type'] = 'E'
endif
let errors = loclist.filter(lfilter)
let buf = bufnr('')
let errors = loclist.quietWarnings() ? [] : loclist.warnings()
call extend(errors, loclist.errors())
call filter(errors, 'v:val["bufnr"] == buf')
for i in errors
let sign_severity = 'Error'
let sign_subtype = ''
if has_key(i,'subtype')
let sign_subtype = i['subtype']
endif
if i['type'] ==? 'w'
let sign_severity = 'Warning'
endif
let sign_severity = i['type'] ==? 'w' ? 'Warning' : 'Error'
let sign_subtype = has_key(i,'subtype') ? i['subtype'] : ''
let sign_type = 'Syntastic' . sign_subtype . sign_severity
if !self._warningMasksError(i, errors)
exec "sign place ". s:next_sign_id ." line=". i['lnum'] ." name=". sign_type ." file=". expand("%:p")
exec "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr']
call add(self._bufSignIds(), s:next_sign_id)
let s:next_sign_id += 1
endif