Auto merge of #1805 - micbou:boolean-response, r=Valloric
Handle boolean responses from ycmd subcommands `ServerReady`, `ServerRunning`, and `ServerTerminated` C♯ subcommands could return a traceback or nothing in Vim because ycmd returns a boolean as the response of these commands. Fix this by echoing `Yes` when the response is `True`, `No` otherwise. Refactor the `RunPostCommandActionsIfNeeded` function to improve readability. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/1805) <!-- Reviewable:end -->
This commit is contained in:
commit
4651c2112b
@ -60,17 +60,23 @@ class CommandRequest( BaseRequest ):
|
|||||||
|
|
||||||
|
|
||||||
def RunPostCommandActionsIfNeeded( self ):
|
def RunPostCommandActionsIfNeeded( self ):
|
||||||
if not self.Done() or not self._response:
|
if not self.Done() or self._response is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if isinstance( self._response, bool ):
|
||||||
|
return self._HandleBooleanResponse()
|
||||||
|
|
||||||
if self._is_goto_command:
|
if self._is_goto_command:
|
||||||
self._HandleGotoResponse()
|
return self._HandleGotoResponse()
|
||||||
elif self._is_fixit_command:
|
|
||||||
self._HandleFixitResponse()
|
if self._is_fixit_command:
|
||||||
elif 'message' in self._response:
|
return self._HandleFixitResponse()
|
||||||
self._HandleMessageResponse()
|
|
||||||
elif 'detailed_info' in self._response:
|
if 'message' in self._response:
|
||||||
self._HandleDetailedInfoResponse()
|
return self._HandleMessageResponse()
|
||||||
|
|
||||||
|
if 'detailed_info' in self._response:
|
||||||
|
return self._HandleDetailedInfoResponse()
|
||||||
|
|
||||||
|
|
||||||
def _HandleGotoResponse( self ):
|
def _HandleGotoResponse( self ):
|
||||||
@ -97,6 +103,12 @@ class CommandRequest( BaseRequest ):
|
|||||||
+ " changes" )
|
+ " changes" )
|
||||||
|
|
||||||
|
|
||||||
|
def _HandleBooleanResponse( self ):
|
||||||
|
if self._response:
|
||||||
|
return vimsupport.EchoText( 'Yes' )
|
||||||
|
vimsupport.EchoText( 'No' )
|
||||||
|
|
||||||
|
|
||||||
def _HandleMessageResponse( self ):
|
def _HandleMessageResponse( self ):
|
||||||
vimsupport.EchoText( self._response[ 'message' ] )
|
vimsupport.EchoText( self._response[ 'message' ] )
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user