Handle scalar response from subcommands
When the ycmd server returns a scalar (boolean, number, string, etc.) from a subcommand, print it to the user.
This commit is contained in:
parent
4651c2112b
commit
37f3f1530e
@ -63,15 +63,18 @@ class CommandRequest( BaseRequest ):
|
|||||||
if not self.Done() or self._response is None:
|
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:
|
||||||
return self._HandleGotoResponse()
|
return self._HandleGotoResponse()
|
||||||
|
|
||||||
if self._is_fixit_command:
|
if self._is_fixit_command:
|
||||||
return self._HandleFixitResponse()
|
return self._HandleFixitResponse()
|
||||||
|
|
||||||
|
# If not a dictionary or a list, the response is necessarily a
|
||||||
|
# scalar: boolean, number, string, etc. In this case, we print
|
||||||
|
# it to the user.
|
||||||
|
if not isinstance( self._response, ( dict, list ) ):
|
||||||
|
return self._HandleBasicResponse()
|
||||||
|
|
||||||
if 'message' in self._response:
|
if 'message' in self._response:
|
||||||
return self._HandleMessageResponse()
|
return self._HandleMessageResponse()
|
||||||
|
|
||||||
@ -103,10 +106,8 @@ class CommandRequest( BaseRequest ):
|
|||||||
+ " changes" )
|
+ " changes" )
|
||||||
|
|
||||||
|
|
||||||
def _HandleBooleanResponse( self ):
|
def _HandleBasicResponse( self ):
|
||||||
if self._response:
|
vimsupport.EchoText( self._response )
|
||||||
return vimsupport.EchoText( 'Yes' )
|
|
||||||
vimsupport.EchoText( 'No' )
|
|
||||||
|
|
||||||
|
|
||||||
def _HandleMessageResponse( self ):
|
def _HandleMessageResponse( self ):
|
||||||
|
Loading…
Reference in New Issue
Block a user