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:
micbou 2015-11-28 22:18:54 +01:00
parent 4651c2112b
commit 37f3f1530e

View File

@ -63,15 +63,18 @@ class CommandRequest( BaseRequest ):
if not self.Done() or self._response is None:
return
if isinstance( self._response, bool ):
return self._HandleBooleanResponse()
if self._is_goto_command:
return self._HandleGotoResponse()
if self._is_fixit_command:
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:
return self._HandleMessageResponse()
@ -103,10 +106,8 @@ class CommandRequest( BaseRequest ):
+ " changes" )
def _HandleBooleanResponse( self ):
if self._response:
return vimsupport.EchoText( 'Yes' )
vimsupport.EchoText( 'No' )
def _HandleBasicResponse( self ):
vimsupport.EchoText( self._response )
def _HandleMessageResponse( self ):