Bug fix: loclist clobbered by filter().
Loclist cleanup: hasErrorsOrWarningsToDisplay() == !isEmpty(). Loclist cleanup: rename filteredRaw() --> getRaw(). Loclist cleanup: rename toRaw() --> copyRaw().
This commit is contained in:
parent
a39b397e6a
commit
e30c80623d
@ -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()
|
||||
|
||||
|
@ -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
|
||||
|
@ -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'])
|
||||
|
@ -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
|
||||
|
@ -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'
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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('')
|
||||
|
Loading…
x
Reference in New Issue
Block a user