Cache balloons' contents. Cleanup.

This commit is contained in:
LCD 47 2014-10-17 08:35:05 +03:00
parent 7ed52d1e44
commit 54086304b3
5 changed files with 32 additions and 17 deletions

View File

@ -274,7 +274,7 @@ endfunction " }}}2
function! syntastic#util#dictFilter(errors, filter) " {{{2
let rules = s:_translateFilter(a:filter)
" call syntastic#log#debug(g:SyntasticDebugFilters, "applying filter:", rules)
" call syntastic#log#debug(g:SyntasticDebugTrace, "applying filter:", rules)
try
call filter(a:errors, rules)
catch /\m^Vim\%((\a\+)\)\=:E/

View File

@ -725,7 +725,7 @@ for python in syntastic (see |syntastic_mode_map|), or disable lint checks in
Syntastic can be used together with the 'YouCompleteMe' Vim plugin (see
http://valloric.github.io/YouCompleteMe/). However, by default 'YouCompleteMe'
disables syntastic"s checkers for the "c", "cpp", "objc", and "objcpp"
disables syntastic's checkers for the "c", "cpp", "objc", and "objcpp"
filetypes, in order to allow its own checkers to run. If you want to use YCM's
identifier completer but still run syntastic's checkers for those filetypes you
have to set |ycm_show_diagnostics_ui| to 0. E.g.: >

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:syntastic_start
endif
let g:syntastic_version = '3.5.0-69'
let g:syntastic_version = '3.5.0-70'
lockvar g:syntastic_version
" Sanity checks {{{1

View File

@ -22,20 +22,11 @@ endfunction " }}}2
" Update the error balloons
function! g:SyntasticBalloonsNotifier.refresh(loclist) " {{{2
let b:syntastic_balloons = {}
unlet! b:syntastic_balloons
if self.enabled() && !a:loclist.isEmpty()
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: refresh')
let buf = bufnr('')
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'])
let b:syntastic_balloons[i['lnum']] .= "\n" . i['text']
else
let b:syntastic_balloons[i['lnum']] = i['text']
endif
endfor
set beval bexpr=SyntasticBalloonsExprNotifier()
let b:syntastic_balloons = a:loclist.balloons()
if !empty(b:syntastic_balloons)
set ballooneval balloonexpr=SyntasticBalloonsExprNotifier()
endif
endif
endfunction " }}}2
@ -46,7 +37,8 @@ function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2
let b:syntastic_balloons = {}
if has('balloon_eval')
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: reset')
set nobeval
unlet! b:syntastic_balloons
set noballooneval
endif
endfunction " }}}2
" @vimlint(EVL103, 0, a:loclist)

View File

@ -173,6 +173,29 @@ function! g:SyntasticLoclist.decorate(tag) " {{{2
endfor
endfunction " }}}2
function! g:SyntasticLoclist.balloons() " {{{2
if !exists("self._cachedBalloons")
let sep = has("balloon_multiline") ? "\n" : ' | '
let self._cachedBalloons = {}
for e in self._rawLoclist
let buf = e['bufnr']
if !has_key(self._cachedBalloons, buf)
let self._cachedBalloons[buf] = {}
endif
if has_key(self._cachedBalloons[buf], e['lnum'])
let self._cachedBalloons[buf][e['lnum']] .= sep . e['text']
else
let self._cachedBalloons[buf][e['lnum']] = e['text']
endif
endfor
endif
return get(self._cachedBalloons, bufnr(''), {})
endfunction " }}}2
function! g:SyntasticLoclist.errors() " {{{2
if !exists("self._cachedErrors")
let self._cachedErrors = self.filter({'type': "E"})