diff --git a/python/ycm/client/command_request.py b/python/ycm/client/command_request.py index 5f728c92..51916c9d 100644 --- a/python/ycm/client/command_request.py +++ b/python/ycm/client/command_request.py @@ -36,16 +36,19 @@ def _EnsureBackwardsCompatibility( arguments ): class CommandRequest( BaseRequest ): - def __init__( self, arguments, completer_target = None ): + def __init__( self, arguments, completer_target = None, extra_data = None ): super( CommandRequest, self ).__init__() self._arguments = _EnsureBackwardsCompatibility( arguments ) self._completer_target = ( completer_target if completer_target else 'filetype_default' ) + self._extra_data = extra_data self._response = None def Start( self ): request_data = BuildRequestData() + if self._extra_data: + request_data.update( self._extra_data ) request_data.update( { 'completer_target': self._completer_target, 'command_arguments': self._arguments @@ -129,8 +132,8 @@ class CommandRequest( BaseRequest ): vimsupport.WriteToPreviewWindow( self._response[ 'detailed_info' ] ) -def SendCommandRequest( arguments, completer ): - request = CommandRequest( arguments, completer ) +def SendCommandRequest( arguments, completer, extra_data = None ): + request = CommandRequest( arguments, completer, extra_data ) # This is a blocking call. request.Start() request.RunPostCommandActionsIfNeeded() diff --git a/python/ycm/client/debug_info_request.py b/python/ycm/client/debug_info_request.py index d7a5822b..8e856a75 100644 --- a/python/ycm/client/debug_info_request.py +++ b/python/ycm/client/debug_info_request.py @@ -28,13 +28,16 @@ from ycm.client.base_request import ( BaseRequest, BuildRequestData, class DebugInfoRequest( BaseRequest ): - def __init__( self ): + def __init__( self, extra_data = None ): super( DebugInfoRequest, self ).__init__() + self._extra_data = extra_data self._response = None def Start( self ): request_data = BuildRequestData() + if self._extra_data: + request_data.update( self._extra_data ) with HandleServerException( display = False ): self._response = self.PostDataToHandler( request_data, 'debug_info' ) @@ -111,8 +114,8 @@ def _FormatCompleterDebugInfo( completer ): return message -def SendDebugInfoRequest(): - request = DebugInfoRequest() +def SendDebugInfoRequest( extra_data = None ): + request = DebugInfoRequest( extra_data ) # This is a blocking call. request.Start() return request.Response() diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 3fa33846..a5454789 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -302,7 +302,9 @@ class YouCompleteMe( object ): def SendCommandRequest( self, arguments, completer ): - return SendCommandRequest( arguments, completer ) + extra_data = {} + self._AddExtraConfDataIfNeeded( extra_data ) + return SendCommandRequest( arguments, completer, extra_data ) def GetDefinedSubcommands( self ): @@ -636,7 +638,9 @@ class YouCompleteMe( object ): debug_info = '' if self._client_logfile: debug_info += 'Client logfile: {0}\n'.format( self._client_logfile ) - debug_info += FormatDebugInfoResponse( SendDebugInfoRequest() ) + extra_data = {} + self._AddExtraConfDataIfNeeded( extra_data ) + debug_info += FormatDebugInfoResponse( SendDebugInfoRequest( extra_data ) ) debug_info += ( 'Server running at: {0}\n' 'Server process ID: {1}\n'.format( BaseRequest.server_location,