Example #1
0
    def _CollectCitables(self, request_data):
        """
        Create the YCM compatible list of all citable objects which could be
        found.

        :param request_data: The data which YouCompleteMe passes to the
                             completer.
        :type request_data: dict[str,str]
        :rtype: list[dict[str,str]]
        :return: A list of all citable objects which could be found in a format
                 which YCM understands.
        """
        citables = self._CollectCitablesInner(request_data)

        return [
            BuildCompletionData(c.completion(), extra_menu_info=c.extra_info())
            for c in citables
        ]
Example #2
0
    def _RequestCompletions(self, server, data):
        path = data['filepath']
        url = 'http://localhost:' + str(server.port)
        req_body = {
            'path': 'res://' + PosixPath(os.path.relpath(path, server.path)),
            'text': data['file_data'][path]['contents'],
            'cursor': {
                'row': data['line_num'] - 1,
                'column': data['column_codepoint'] - 1
            }
        }
        res = requests.post(url, json=req_body)
        res.raise_for_status()
        res_body = res.json()

        hint = res_body['hint'].replace('\n', '')
        return [
            BuildCompletionData(s, detailed_info=hint)
            for s in res_body['suggestions']
        ]
Example #3
0
 def ComputeCandidatesInner( self, request_data ):
   return [ BuildCompletionData( candidate )
            for candidate in self.CandidatesList() ]