extra conf store now vim-free

This commit is contained in:
Strahinja Val Markovic 2013-09-17 16:34:02 -07:00
parent fba4477ca3
commit 02b88dccf1
3 changed files with 15 additions and 6 deletions

View File

@ -223,7 +223,6 @@ endfunction
function! s:OnVimLeave()
py ycm_state.OnVimLeave()
py extra_conf_store.CallExtraConfVimCloseIfExists()
endfunction

View File

@ -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 ):

View File

@ -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 )