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:
parent
7bb7e20f8d
commit
4b039e2102
@ -63,7 +63,7 @@ function! youcompleteme#Enable()
|
|||||||
" that happens *after" BufRead/BufEnter has already triggered for the
|
" that happens *after" BufRead/BufEnter has already triggered for the
|
||||||
" initial file.
|
" initial file.
|
||||||
autocmd BufRead,BufEnter * call s:OnBufferVisit()
|
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 CursorHold,CursorHoldI * call s:OnCursorHold()
|
||||||
autocmd InsertLeave * call s:OnInsertLeave()
|
autocmd InsertLeave * call s:OnInsertLeave()
|
||||||
autocmd InsertEnter * call s:OnInsertEnter()
|
autocmd InsertEnter * call s:OnInsertEnter()
|
||||||
@ -222,12 +222,12 @@ function! s:OnBufferVisit()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:OnBufferDelete( deleted_buffer_file )
|
function! s:OnBufferUnload( deleted_buffer_file )
|
||||||
if !s:AllowedToCompleteInCurrentFile() || empty( a:deleted_buffer_file )
|
if !s:AllowedToCompleteInCurrentFile() || empty( a:deleted_buffer_file )
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
py ycm_state.OnBufferDelete( vim.eval( 'a:deleted_buffer_file' ) )
|
py ycm_state.OnBufferUnload( vim.eval( 'a:deleted_buffer_file' ) )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ class Completer( object ):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def OnBufferDelete( self, deleted_buffer_file ):
|
def OnBufferUnload( self, deleted_buffer_file ):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ class ClangCompleter( Completer ):
|
|||||||
flags )
|
flags )
|
||||||
|
|
||||||
|
|
||||||
def OnBufferDelete( self, deleted_buffer_file ):
|
def OnBufferUnload( self, deleted_buffer_file ):
|
||||||
self.completer.DeleteCachesForFileAsync( deleted_buffer_file )
|
self.completer.DeleteCachesForFileAsync( deleted_buffer_file )
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,9 +115,9 @@ class GeneralCompleterStore( Completer ):
|
|||||||
completer.OnBufferVisit()
|
completer.OnBufferVisit()
|
||||||
|
|
||||||
|
|
||||||
def OnBufferDelete( self, deleted_buffer_file ):
|
def OnBufferUnload( self, deleted_buffer_file ):
|
||||||
for completer in self._all_completers:
|
for completer in self._all_completers:
|
||||||
completer.OnBufferDelete( deleted_buffer_file )
|
completer.OnBufferUnload( deleted_buffer_file )
|
||||||
|
|
||||||
|
|
||||||
def OnCursorHold( self ):
|
def OnCursorHold( self ):
|
||||||
|
@ -138,11 +138,11 @@ class YouCompleteMe( object ):
|
|||||||
self.GetFiletypeCompleter().OnFileReadyToParse()
|
self.GetFiletypeCompleter().OnFileReadyToParse()
|
||||||
|
|
||||||
|
|
||||||
def OnBufferDelete( self, deleted_buffer_file ):
|
def OnBufferUnload( self, deleted_buffer_file ):
|
||||||
self.gencomp.OnBufferDelete( deleted_buffer_file )
|
self.gencomp.OnBufferUnload( deleted_buffer_file )
|
||||||
|
|
||||||
if self.FiletypeCompletionUsable():
|
if self.FiletypeCompletionUsable():
|
||||||
self.GetFiletypeCompleter().OnBufferDelete( deleted_buffer_file )
|
self.GetFiletypeCompleter().OnBufferUnload( deleted_buffer_file )
|
||||||
|
|
||||||
|
|
||||||
def OnBufferVisit( self ):
|
def OnBufferVisit( self ):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user