diff --git a/python/ycm/client/command_request.py b/python/ycm/client/command_request.py index 75685669..dc6abfb1 100644 --- a/python/ycm/client/command_request.py +++ b/python/ycm/client/command_request.py @@ -33,10 +33,6 @@ class CommandRequest( BaseRequest ): self._arguments = _EnsureBackwardsCompatibility( arguments ) self._completer_target = ( completer_target if completer_target else 'filetype_default' ) - self._is_goto_command = ( - self._arguments and self._arguments[ 0 ].startswith( 'GoTo' ) ) - self._is_fixit_command = ( - self._arguments and self._arguments[ 0 ].startswith( 'FixIt' ) ) self._response = None @@ -61,24 +57,26 @@ class CommandRequest( BaseRequest ): if not self.Done() or self._response is None: return - 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 'fixits' in self._response: + return self._HandleFixitResponse() + if 'message' in self._response: return self._HandleMessageResponse() if 'detailed_info' in self._response: return self._HandleDetailedInfoResponse() + # The only other type of response we understand is GoTo, and that is the + # only one that we can't detect just by inspecting the response (it should + # either be a single location or a list) + return self._HandleGotoResponse() + def _HandleGotoResponse( self ): if isinstance( self._response, list ):