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,16 +101,14 @@ function! s:UpdateErrors(auto_invoked, ...)
endif endif
end end
call s:notifiers.refresh(g:SyntasticLoclist.Current())
let loclist = g:SyntasticLoclist.Current() let loclist = g:SyntasticLoclist.Current()
if g:syntastic_always_populate_loc_list && loclist.hasErrorsOrWarningsToDisplay() call s:notifiers.refresh(loclist)
call setloclist(0, loclist.filteredRaw())
endif
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()) call setloclist(0, loclist.filteredRaw())
silent! ll if g:syntastic_auto_jump
silent! ll
endif
endif endif
endfunction endfunction

View File

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

View File

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

View File

@ -103,24 +103,18 @@ function! g:SyntasticSignsNotifier._signErrors(loclist)
let loclist = a:loclist let loclist = a:loclist
if loclist.hasErrorsOrWarningsToDisplay() if loclist.hasErrorsOrWarningsToDisplay()
let lfilter = {'bufnr': bufnr('')} let buf = bufnr('')
if g:syntastic_quiet_warnings let errors = loclist.quietWarnings() ? [] : loclist.warnings()
let lfilter['type'] = 'E' call extend(errors, loclist.errors())
endif call filter(errors, 'v:val["bufnr"] == buf')
let errors = loclist.filter(lfilter)
for i in errors for i in errors
let sign_severity = 'Error' let sign_severity = i['type'] ==? 'w' ? 'Warning' : 'Error'
let sign_subtype = '' let sign_subtype = has_key(i,'subtype') ? i['subtype'] : ''
if has_key(i,'subtype')
let sign_subtype = i['subtype']
endif
if i['type'] ==? 'w'
let sign_severity = 'Warning'
endif
let sign_type = 'Syntastic' . sign_subtype . sign_severity let sign_type = 'Syntastic' . sign_subtype . sign_severity
if !self._warningMasksError(i, errors) 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) call add(self._bufSignIds(), s:next_sign_id)
let s:next_sign_id += 1 let s:next_sign_id += 1
endif endif