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
|
let w:syntastic_loclist_set = 0
|
||||||
if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump
|
if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump
|
||||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist (new)')
|
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
|
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')
|
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: jump')
|
||||||
silent! lrewind
|
silent! lrewind
|
||||||
|
|
||||||
@ -388,9 +388,9 @@ endfunction
|
|||||||
"return '' if no errors are cached for the buffer
|
"return '' if no errors are cached for the buffer
|
||||||
function! SyntasticStatuslineFlag()
|
function! SyntasticStatuslineFlag()
|
||||||
let loclist = g:SyntasticLoclist.current()
|
let loclist = g:SyntasticLoclist.current()
|
||||||
let issues = loclist.filteredRaw()
|
let issues = loclist.getRaw()
|
||||||
let num_issues = loclist.getLength()
|
let num_issues = loclist.getLength()
|
||||||
if loclist.hasErrorsOrWarningsToDisplay()
|
if !loclist.isEmpty()
|
||||||
let errors = loclist.errors()
|
let errors = loclist.errors()
|
||||||
let warnings = loclist.warnings()
|
let warnings = loclist.warnings()
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ endfunction
|
|||||||
|
|
||||||
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist)
|
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist)
|
||||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: toggle')
|
call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: toggle')
|
||||||
if a:loclist.hasErrorsOrWarningsToDisplay()
|
if !a:loclist.isEmpty()
|
||||||
if g:syntastic_auto_loc_list == 1
|
if g:syntastic_auto_loc_list == 1
|
||||||
call a:loclist.show()
|
call a:loclist.show()
|
||||||
endif
|
endif
|
||||||
|
@ -29,10 +29,10 @@ endfunction
|
|||||||
" Update the error balloons
|
" Update the error balloons
|
||||||
function! g:SyntasticBalloonsNotifier.refresh(loclist)
|
function! g:SyntasticBalloonsNotifier.refresh(loclist)
|
||||||
let b:syntastic_balloons = {}
|
let b:syntastic_balloons = {}
|
||||||
if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay()
|
if self.enabled() && !a:loclist.isEmpty()
|
||||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: refresh')
|
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: refresh')
|
||||||
let buf = bufnr('')
|
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)
|
if !empty(issues)
|
||||||
for i in issues
|
for i in issues
|
||||||
if has_key(b:syntastic_balloons, i['lnum'])
|
if has_key(b:syntastic_balloons, i['lnum'])
|
||||||
|
@ -21,7 +21,7 @@ function! g:SyntasticCursorNotifier.enabled()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! g:SyntasticCursorNotifier.refresh(loclist)
|
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')
|
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: refresh')
|
||||||
let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
|
let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
|
||||||
let b:oldLine = -1
|
let b:oldLine = -1
|
||||||
|
@ -39,7 +39,7 @@ function! g:SyntasticHighlightingNotifier.refresh(loclist)
|
|||||||
call self.reset(a:loclist)
|
call self.reset(a:loclist)
|
||||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: refresh')
|
call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: refresh')
|
||||||
let buf = bufnr('')
|
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
|
for item in issues
|
||||||
let group = item['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
let group = item['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@ function! g:SyntasticLoclist.New(rawLoclist)
|
|||||||
endfor
|
endfor
|
||||||
|
|
||||||
let newObj._rawLoclist = llist
|
let newObj._rawLoclist = llist
|
||||||
let newObj._hasErrorsOrWarningsToDisplay = -1
|
|
||||||
|
|
||||||
let newObj._name = ''
|
let newObj._name = ''
|
||||||
|
|
||||||
return newObj
|
return newObj
|
||||||
@ -34,23 +32,23 @@ function! g:SyntasticLoclist.current()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! g:SyntasticLoclist.extend(other)
|
function! g:SyntasticLoclist.extend(other)
|
||||||
let list = self.toRaw()
|
let list = self.copyRaw()
|
||||||
call extend(list, a:other.toRaw())
|
call extend(list, a:other.copyRaw())
|
||||||
return g:SyntasticLoclist.New(list)
|
return g:SyntasticLoclist.New(list)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! g:SyntasticLoclist.toRaw()
|
|
||||||
return copy(self._rawLoclist)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! g:SyntasticLoclist.filteredRaw()
|
|
||||||
return self._rawLoclist
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! g:SyntasticLoclist.isEmpty()
|
function! g:SyntasticLoclist.isEmpty()
|
||||||
return empty(self._rawLoclist)
|
return empty(self._rawLoclist)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! g:SyntasticLoclist.copyRaw()
|
||||||
|
return copy(self._rawLoclist)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! g:SyntasticLoclist.getRaw()
|
||||||
|
return self._rawLoclist
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! g:SyntasticLoclist.getLength()
|
function! g:SyntasticLoclist.getLength()
|
||||||
return len(self._rawLoclist)
|
return len(self._rawLoclist)
|
||||||
endfunction
|
endfunction
|
||||||
@ -69,14 +67,6 @@ function! g:SyntasticLoclist.decorate(name, filetype)
|
|||||||
endfor
|
endfor
|
||||||
endfunction
|
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)
|
function! g:SyntasticLoclist.quietMessages(filters)
|
||||||
call syntastic#util#dictFilter(self._rawLoclist, a:filters)
|
call syntastic#util#dictFilter(self._rawLoclist, a:filters)
|
||||||
endfunction
|
endfunction
|
||||||
@ -138,7 +128,7 @@ function! g:SyntasticLoclist.setloclist()
|
|||||||
endif
|
endif
|
||||||
let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set
|
let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set
|
||||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
|
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
|
let w:syntastic_loclist_set = 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -147,7 +137,7 @@ function! g:SyntasticLoclist.show()
|
|||||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show')
|
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show')
|
||||||
call self.setloclist()
|
call self.setloclist()
|
||||||
|
|
||||||
if self.hasErrorsOrWarningsToDisplay()
|
if !self.isEmpty()
|
||||||
let num = winnr()
|
let num = winnr()
|
||||||
execute "lopen " . g:syntastic_loc_list_height
|
execute "lopen " . g:syntastic_loc_list_height
|
||||||
if num != winnr()
|
if num != winnr()
|
||||||
|
@ -102,7 +102,7 @@ endfunction
|
|||||||
" Place signs by all syntax errors in the buffer
|
" Place signs by all syntax errors in the buffer
|
||||||
function! g:SyntasticSignsNotifier._signErrors(loclist)
|
function! g:SyntasticSignsNotifier._signErrors(loclist)
|
||||||
let loclist = a:loclist
|
let loclist = a:loclist
|
||||||
if loclist.hasErrorsOrWarningsToDisplay()
|
if !loclist.isEmpty()
|
||||||
|
|
||||||
" errors some first, so that they are not masked by warnings
|
" errors some first, so that they are not masked by warnings
|
||||||
let buf = bufnr('')
|
let buf = bufnr('')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user