Signs: delay initialisation until actually needed.

This commit is contained in:
LCD 47 2016-03-06 22:33:34 +02:00
parent 1de31fa5e8
commit b9620a60b7
2 changed files with 9 additions and 10 deletions

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.7.0-93' let g:_SYNTASTIC_VERSION = '3.7.0-94'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1

View File

@ -20,15 +20,7 @@ let s:setup_done = 0
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticSignsNotifier.New() abort " {{{2 function! g:SyntasticSignsNotifier.New() abort " {{{2
let newObj = copy(self) return copy(self)
if !s:setup_done
call self._setup()
let s:setup_done = 1
lockvar s:setup_done
endif
return newObj
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticSignsNotifier.enabled() abort " {{{2 function! g:SyntasticSignsNotifier.enabled() abort " {{{2
@ -37,8 +29,15 @@ endfunction " }}}2
function! g:SyntasticSignsNotifier.refresh(loclist) abort " {{{2 function! g:SyntasticSignsNotifier.refresh(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'signs: refresh') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'signs: refresh')
let old_signs = copy(self._bufSignIds()) let old_signs = copy(self._bufSignIds())
if self.enabled() if self.enabled()
if !s:setup_done
call self._setup()
let s:setup_done = 1
lockvar s:setup_done
endif
call self._signErrors(a:loclist) call self._signErrors(a:loclist)
endif endif
call self._removeSigns(old_signs) call self._removeSigns(old_signs)