From 13aeaa37a887bfb9785118b1b18c8d27dfa5c7f8 Mon Sep 17 00:00:00 2001 From: micbou Date: Sat, 28 Nov 2015 16:20:51 +0100 Subject: [PATCH] Handle boolean responses from ycmd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix ServerReady, ServerRunning, and ServerTerminated subcommands from C♯ completer. --- python/ycm/client/command_request.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/python/ycm/client/command_request.py b/python/ycm/client/command_request.py index 55be6e9d..bd60d021 100644 --- a/python/ycm/client/command_request.py +++ b/python/ycm/client/command_request.py @@ -60,17 +60,23 @@ class CommandRequest( BaseRequest ): def RunPostCommandActionsIfNeeded( self ): - if not self.Done() or not self._response: + if not self.Done() or self._response is None: return + if isinstance( self._response, bool ): + return self._HandleBooleanResponse() + if self._is_goto_command: - self._HandleGotoResponse() - elif self._is_fixit_command: - self._HandleFixitResponse() - elif 'message' in self._response: - self._HandleMessageResponse() - elif 'detailed_info' in self._response: - self._HandleDetailedInfoResponse() + return self._HandleGotoResponse() + + if self._is_fixit_command: + return self._HandleFixitResponse() + + if 'message' in self._response: + return self._HandleMessageResponse() + + if 'detailed_info' in self._response: + return self._HandleDetailedInfoResponse() def _HandleGotoResponse( self ): @@ -97,6 +103,12 @@ class CommandRequest( BaseRequest ): + " changes" ) + def _HandleBooleanResponse( self ): + if self._response: + return vimsupport.EchoText( 'Yes' ) + vimsupport.EchoText( 'No' ) + + def _HandleMessageResponse( self ): vimsupport.EchoText( self._response[ 'message' ] )