diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 0538af21..f08f1126 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -224,9 +224,9 @@ function! s:UpdateErrors(auto_invoked, ...) let w:syntastic_loclist_set = 0 if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist (new)') - call setloclist(0, loclist.filteredRaw()) + call setloclist(0, loclist.getRaw()) let w:syntastic_loclist_set = 1 - if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() + if run_checks && g:syntastic_auto_jump && !loclist.isEmpty() call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: jump') silent! lrewind @@ -388,9 +388,9 @@ endfunction "return '' if no errors are cached for the buffer function! SyntasticStatuslineFlag() let loclist = g:SyntasticLoclist.current() - let issues = loclist.filteredRaw() + let issues = loclist.getRaw() let num_issues = loclist.getLength() - if loclist.hasErrorsOrWarningsToDisplay() + if !loclist.isEmpty() let errors = loclist.errors() let warnings = loclist.warnings() diff --git a/plugin/syntastic/autoloclist.vim b/plugin/syntastic/autoloclist.vim index 92e430bb..f0038e11 100644 --- a/plugin/syntastic/autoloclist.vim +++ b/plugin/syntastic/autoloclist.vim @@ -23,7 +23,7 @@ endfunction function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: toggle') - if a:loclist.hasErrorsOrWarningsToDisplay() + if !a:loclist.isEmpty() if g:syntastic_auto_loc_list == 1 call a:loclist.show() endif diff --git a/plugin/syntastic/balloons.vim b/plugin/syntastic/balloons.vim index 18d31c2d..4b6735c3 100644 --- a/plugin/syntastic/balloons.vim +++ b/plugin/syntastic/balloons.vim @@ -29,10 +29,10 @@ endfunction " Update the error balloons function! g:SyntasticBalloonsNotifier.refresh(loclist) let b:syntastic_balloons = {} - if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() + if self.enabled() && !a:loclist.isEmpty() call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: refresh') let buf = bufnr('') - let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') + let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf') if !empty(issues) for i in issues if has_key(b:syntastic_balloons, i['lnum']) diff --git a/plugin/syntastic/cursor.vim b/plugin/syntastic/cursor.vim index b330b33a..0ee8caff 100644 --- a/plugin/syntastic/cursor.vim +++ b/plugin/syntastic/cursor.vim @@ -21,7 +21,7 @@ function! g:SyntasticCursorNotifier.enabled() endfunction function! g:SyntasticCursorNotifier.refresh(loclist) - if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() + if self.enabled() && !a:loclist.isEmpty() call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: refresh') let b:syntastic_messages = copy(a:loclist.messages(bufnr(''))) let b:oldLine = -1 diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index b928ce6f..b48d10cd 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -39,7 +39,7 @@ function! g:SyntasticHighlightingNotifier.refresh(loclist) call self.reset(a:loclist) call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: refresh') let buf = bufnr('') - let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') + let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf') for item in issues let group = item['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning' diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 306ff97e..d4601259 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -19,8 +19,6 @@ function! g:SyntasticLoclist.New(rawLoclist) endfor let newObj._rawLoclist = llist - let newObj._hasErrorsOrWarningsToDisplay = -1 - let newObj._name = '' return newObj @@ -34,23 +32,23 @@ function! g:SyntasticLoclist.current() endfunction function! g:SyntasticLoclist.extend(other) - let list = self.toRaw() - call extend(list, a:other.toRaw()) + let list = self.copyRaw() + call extend(list, a:other.copyRaw()) return g:SyntasticLoclist.New(list) endfunction -function! g:SyntasticLoclist.toRaw() - return copy(self._rawLoclist) -endfunction - -function! g:SyntasticLoclist.filteredRaw() - return self._rawLoclist -endfunction - function! g:SyntasticLoclist.isEmpty() return empty(self._rawLoclist) endfunction +function! g:SyntasticLoclist.copyRaw() + return copy(self._rawLoclist) +endfunction + +function! g:SyntasticLoclist.getRaw() + return self._rawLoclist +endfunction + function! g:SyntasticLoclist.getLength() return len(self._rawLoclist) endfunction @@ -69,14 +67,6 @@ function! g:SyntasticLoclist.decorate(name, filetype) endfor endfunction -function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() - if self._hasErrorsOrWarningsToDisplay >= 0 - return self._hasErrorsOrWarningsToDisplay - endif - let self._hasErrorsOrWarningsToDisplay = !empty(self._rawLoclist) - return self._hasErrorsOrWarningsToDisplay -endfunction - function! g:SyntasticLoclist.quietMessages(filters) call syntastic#util#dictFilter(self._rawLoclist, a:filters) endfunction @@ -138,7 +128,7 @@ function! g:SyntasticLoclist.setloclist() endif let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)')) - call setloclist(0, self.filteredRaw(), replace ? 'r' : ' ') + call setloclist(0, self.getRaw(), replace ? 'r' : ' ') let w:syntastic_loclist_set = 1 endfunction @@ -147,7 +137,7 @@ function! g:SyntasticLoclist.show() call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show') call self.setloclist() - if self.hasErrorsOrWarningsToDisplay() + if !self.isEmpty() let num = winnr() execute "lopen " . g:syntastic_loc_list_height if num != winnr() diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index 68aa5dc9..8f0e0430 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -102,7 +102,7 @@ endfunction " Place signs by all syntax errors in the buffer function! g:SyntasticSignsNotifier._signErrors(loclist) let loclist = a:loclist - if loclist.hasErrorsOrWarningsToDisplay() + if !loclist.isEmpty() " errors some first, so that they are not masked by warnings let buf = bufnr('')