From 11380c2d51dfc50eef462822d319f364318358f4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 10 Apr 2013 13:40:03 +0300 Subject: [PATCH] Minor cleanup. Warning signs should not overwrite error ones. Use buffers instead of file names when placing signs. Other minor changes. --- plugin/syntastic.vim | 12 +++++------- plugin/syntastic/cursor.vim | 1 + plugin/syntastic/loclist.vim | 4 ++++ plugin/syntastic/signer.vim | 22 ++++++++-------------- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b1e37dac..d3aaca87 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -101,16 +101,14 @@ 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()) - silent! ll + if g:syntastic_auto_jump + silent! ll + endif endif endfunction diff --git a/plugin/syntastic/cursor.vim b/plugin/syntastic/cursor.vim index 50864fd7..92273a5b 100644 --- a/plugin/syntastic/cursor.vim +++ b/plugin/syntastic/cursor.vim @@ -31,6 +31,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) endfunction function! g:SyntasticCursorNotifier.reset(loclist) + unlet b:syntastic_messages let b:oldLine = -1 endfunction diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 710cc246..0559aca0 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -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 diff --git a/plugin/syntastic/signer.vim b/plugin/syntastic/signer.vim index 9bbf9386..9c5dfc64 100644 --- a/plugin/syntastic/signer.vim +++ b/plugin/syntastic/signer.vim @@ -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