From 7500a94cda5d315065fbec0732714da33a7ddd46 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Wed, 24 Apr 2013 13:31:28 -0700 Subject: [PATCH] Use OnBufferVisit in ultisnips completer This is instead of OnFileReadyToParse which is called every time the users stops typing. --- autoload/youcompleteme.vim | 1 + python/completers/general/ultisnips_completer.py | 2 +- python/ycm.py | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 68e35d3b..2ffde9be 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -205,6 +205,7 @@ function! s:OnBufferVisit() call s:SetUpCompleteopt() call s:SetCompleteFunc() + py ycm_state.OnBufferVisit() call s:OnFileReadyToParse() endfunction diff --git a/python/completers/general/ultisnips_completer.py b/python/completers/general/ultisnips_completer.py index 75a885cf..f63e4fba 100644 --- a/python/completers/general/ultisnips_completer.py +++ b/python/completers/general/ultisnips_completer.py @@ -50,7 +50,7 @@ class UltiSnipsCompleter( GeneralCompleter ): return self._filtered_candidates if self._filtered_candidates else [] - def OnFileReadyToParse( self ): + def OnBufferVisit( self ): self._candidates = _GetCandidates() diff --git a/python/ycm.py b/python/ycm.py index 7f65e2f2..3dea4f16 100644 --- a/python/ycm.py +++ b/python/ycm.py @@ -145,6 +145,13 @@ class YouCompleteMe( object ): self.GetFiletypeCompleter().OnBufferDelete( deleted_buffer_file ) + def OnBufferVisit( self ): + self.gencomp.OnBufferVisit() + + if self.FiletypeCompletionUsable(): + self.GetFiletypeCompleter().OnBufferVisit() + + def OnInsertLeave( self ): self.gencomp.OnInsertLeave()