diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index d8e6e895..32731bbd 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -223,7 +223,6 @@ endfunction function! s:OnVimLeave() py ycm_state.OnVimLeave() - py extra_conf_store.CallExtraConfVimCloseIfExists() endfunction diff --git a/python/ycm/extra_conf_store.py b/python/ycm/extra_conf_store.py index 9611d697..15a3f087 100644 --- a/python/ycm/extra_conf_store.py +++ b/python/ycm/extra_conf_store.py @@ -24,7 +24,6 @@ import imp import random import string import sys -from ycm import vimsupport from ycm import user_options_store from fnmatch import fnmatch @@ -37,6 +36,12 @@ CONFIRM_CONF_FILE_MESSAGE = ('Found {0}. Load? \n\n(Question can be turned ' _module_for_module_file = {} _module_file_for_source_file = {} +class UnknownExtraConf( Exception ): + def __init__( self, extra_conf_file ): + message = CONFIRM_CONF_FILE_MESSAGE.format( extra_conf_file ) + super( UnknownExtraConf, self ).__init__( message ) + self.extra_conf_file = extra_conf_file + def ModuleForSourceFile( filename ): return _Load( ModuleFileForSourceFile( filename ) ) @@ -60,7 +65,7 @@ def CallExtraConfYcmCorePreloadIfExists(): _CallExtraConfMethod( 'YcmCorePreload' ) -def CallExtraConfVimCloseIfExists(): +def OnVimLeave( request_data ): _CallExtraConfMethod( 'VimClose' ) @@ -94,7 +99,7 @@ def _ShouldLoad( module_file ): if _MatchesGlobPattern( module_file, glob.lstrip('!') ): return not is_blacklisted - return vimsupport.Confirm( CONFIRM_CONF_FILE_MESSAGE.format( module_file ) ) + raise UnknownExtraConf( module_file ) def _Load( module_file, force = False ): diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index a7f8e276..ea600f44 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -26,6 +26,7 @@ import logging import tempfile from ycm import vimsupport from ycm import base +from ycm import extra_conf_store from ycm.completers.all.omni_completer import OmniCompleter from ycm.completers.general.general_completer_store import GeneralCompleterStore @@ -147,12 +148,16 @@ class EventNotification( BaseRequest ): def Start( self ): + event_handler = 'On' + self._event_name getattr( self._ycm_state.GetGeneralCompleter(), - 'On' + self._event_name )( self._request_data ) + event_handler )( self._request_data ) if self._ycm_state.FiletypeCompletionUsable(): getattr( self._ycm_state.GetFiletypeCompleter(), - 'On' + self._event_name )( self._request_data ) + event_handler )( self._request_data ) + + if hasattr( extra_conf_store, event_handler ): + getattr( extra_conf_store, event_handler )( self._request_data )