From 451acc0073ad68cb7155c4001552d1097a3c14f3 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Sun, 7 Jul 2013 10:59:48 -0700 Subject: [PATCH] Adding OnVimLeave support to Completer class --- autoload/youcompleteme.vim | 1 + python/ycm/completers/completer.py | 4 ++++ python/ycm/completers/general/general_completer_store.py | 5 +++++ python/ycm/youcompleteme.py | 7 +++++++ 4 files changed, 17 insertions(+) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 49a46119..46cc12a2 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -207,6 +207,7 @@ function! s:SetUpCompleteopt() endfunction function! s:OnVimLeave() + py ycm_state.OnVimLeave() py extra_conf_store.CallExtraConfVimCloseIfExists() endfunction diff --git a/python/ycm/completers/completer.py b/python/ycm/completers/completer.py index 13626c2d..dee07e5f 100644 --- a/python/ycm/completers/completer.py +++ b/python/ycm/completers/completer.py @@ -278,6 +278,10 @@ class Completer( object ): pass + def OnVimLeave( self ): + pass + + def OnUserCommand( self, arguments ): vimsupport.PostVimMessage( NO_USER_COMMANDS ) diff --git a/python/ycm/completers/general/general_completer_store.py b/python/ycm/completers/general/general_completer_store.py index 943281bd..c04972ae 100644 --- a/python/ycm/completers/general/general_completer_store.py +++ b/python/ycm/completers/general/general_completer_store.py @@ -130,6 +130,11 @@ class GeneralCompleterStore( Completer ): completer.OnInsertLeave() + def OnVimLeave( self ): + for completer in self._all_completers: + completer.OnVimLeave() + + def OnCurrentIdentifierFinished( self ): for completer in self._all_completers: completer.OnCurrentIdentifierFinished() diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 35ef7bef..ee689168 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -144,6 +144,13 @@ class YouCompleteMe( object ): self.GetFiletypeCompleter().OnInsertLeave() + def OnVimLeave( self ): + self.gencomp.OnVimLeave() + + if self.FiletypeCompletionUsable(): + self.GetFiletypeCompleter().OnVimLeave() + + def DiagnosticsForCurrentFileReady( self ): if self.FiletypeCompletionUsable(): return self.GetFiletypeCompleter().DiagnosticsForCurrentFileReady()