def get_declaration(self, request, response): src = request['src'] contents = request['contents'] line = request['line'] column = request['column'] flags = request['flags'] response['src'] = src response['line'] = line response['column'] = column # Update the translation unit with the latest contents. translation_unit = self._tryUpdateTranslationUnit(src, contents, flags) if not translation_unit: return location_and_spelling = get_declaration_location_and_spelling(translation_unit, src, line + 1, column + 1) # Clang returns 1-indexed values, but we want to return 0-indexed. if location_and_spelling: location_and_spelling['line'] -= 1 location_and_spelling['column'] -= 1 location_and_spelling['extent']['start']['line'] -= 1 location_and_spelling['extent']['start']['column'] -= 1 location_and_spelling['extent']['end']['line'] -= 1 location_and_spelling['extent']['end']['column'] -= 1 response['locationAndSpelling'] = location_and_spelling
def get_declaration(self, request): contents = request['contents'] line = request['line'] column = request['column'] # Update the translation unit with the latest contents. translation_unit = self._update_translation_unit(contents) if not translation_unit: return None return get_declaration_location_and_spelling(translation_unit, contents, self.flags, self.src, line + 1, column + 1)
def get_declaration(self, request, response): contents = request['contents'] line = request['line'] column = request['column'] flags = request['flags'] response['line'] = line response['column'] = column # Update the translation unit with the latest contents. translation_unit = self._update_translation_unit(contents, flags) if not translation_unit: return response['locationAndSpelling'] = get_declaration_location_and_spelling( translation_unit, self.src, line + 1, column + 1)
def get_declaration(self, request, response): contents = request['contents'] line = request['line'] column = request['column'] flags = request['flags'] response['line'] = line response['column'] = column # Update the translation unit with the latest contents. translation_unit = self._update_translation_unit(contents, flags) if not translation_unit: return response[ 'locationAndSpelling'] = get_declaration_location_and_spelling( translation_unit, self.src, line + 1, column + 1)
def get_declaration(self, request): contents = request['contents'] line = request['line'] column = request['column'] # Update the translation unit with the latest contents. translation_unit = self._update_translation_unit(contents) if not translation_unit: return None return get_declaration_location_and_spelling( translation_unit, contents, self.flags, self.src, line + 1, column + 1)