MCPcopy Index your code
hub / github.com/ycm-core/YouCompleteMe / StringResponse

Method StringResponse

python/ycm/client/command_request.py:113–142  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

111
112
113 def StringResponse( self ):
114 # Retuns a supporable public API version of the response. The reason this
115 # exists is that the ycmd API here is wonky as it originally only supported
116 # text-responses and now has things like fixits and such.
117 #
118 # The supportable public API is basically any text-only response. All other
119 # response types are returned as empty strings
120
121 # This is a blocking call if not Done()
122 self.Response()
123
124 # Completer threw an error ?
125 if self._response is None:
126 return ""
127
128 # If not a dictionary or a list, the response is necessarily a
129 # scalar: boolean, number, string, etc. In this case, we print
130 # it to the user.
131 if not isinstance( self._response, ( dict, list ) ):
132 return str( self._response )
133
134 if 'message' in self._response:
135 return self._response[ 'message' ]
136
137 if 'detailed_info' in self._response:
138 return self._response[ 'detailed_info' ]
139
140 # The only other type of response we understand is 'fixits' and GoTo. We
141 # don't provide string versions of them.
142 return ""
143
144
145 def _HandleGotoResponse( self, buffer_command, modifiers ):

Callers 1

GetCommandResponseFunction · 0.80

Calls 1

ResponseMethod · 0.95

Tested by

no test coverage detected