Using BufUnload instead of BufDelete

Seems to be more robust. This should help with memory consumption when using the
clang_completer. See issue #184.
This commit is contained in:
Strahinja Val Markovic 2013-05-11 13:49:48 -07:00
parent 7bb7e20f8d
commit 4b039e2102
5 changed files with 10 additions and 10 deletions

View File

@ -63,7 +63,7 @@ function! youcompleteme#Enable()
" that happens *after" BufRead/BufEnter has already triggered for the
" initial file.
autocmd BufRead,BufEnter * call s:OnBufferVisit()
autocmd BufDelete * call s:OnBufferDelete( expand( '<afile>:p' ) )
autocmd BufUnload * call s:OnBufferUnload( expand( '<afile>:p' ) )
autocmd CursorHold,CursorHoldI * call s:OnCursorHold()
autocmd InsertLeave * call s:OnInsertLeave()
autocmd InsertEnter * call s:OnInsertEnter()
@ -222,12 +222,12 @@ function! s:OnBufferVisit()
endfunction
function! s:OnBufferDelete( deleted_buffer_file )
function! s:OnBufferUnload( deleted_buffer_file )
if !s:AllowedToCompleteInCurrentFile() || empty( a:deleted_buffer_file )
return
endif
py ycm_state.OnBufferDelete( vim.eval( 'a:deleted_buffer_file' ) )
py ycm_state.OnBufferUnload( vim.eval( 'a:deleted_buffer_file' ) )
endfunction

View File

@ -262,7 +262,7 @@ class Completer( object ):
pass
def OnBufferDelete( self, deleted_buffer_file ):
def OnBufferUnload( self, deleted_buffer_file ):
pass

View File

@ -225,7 +225,7 @@ class ClangCompleter( Completer ):
flags )
def OnBufferDelete( self, deleted_buffer_file ):
def OnBufferUnload( self, deleted_buffer_file ):
self.completer.DeleteCachesForFileAsync( deleted_buffer_file )

View File

@ -115,9 +115,9 @@ class GeneralCompleterStore( Completer ):
completer.OnBufferVisit()
def OnBufferDelete( self, deleted_buffer_file ):
def OnBufferUnload( self, deleted_buffer_file ):
for completer in self._all_completers:
completer.OnBufferDelete( deleted_buffer_file )
completer.OnBufferUnload( deleted_buffer_file )
def OnCursorHold( self ):

View File

@ -138,11 +138,11 @@ class YouCompleteMe( object ):
self.GetFiletypeCompleter().OnFileReadyToParse()
def OnBufferDelete( self, deleted_buffer_file ):
self.gencomp.OnBufferDelete( deleted_buffer_file )
def OnBufferUnload( self, deleted_buffer_file ):
self.gencomp.OnBufferUnload( deleted_buffer_file )
if self.FiletypeCompletionUsable():
self.GetFiletypeCompleter().OnBufferDelete( deleted_buffer_file )
self.GetFiletypeCompleter().OnBufferUnload( deleted_buffer_file )
def OnBufferVisit( self ):