si.setKind(mapKind(element)); if (element.getParent() != null) { si.setContainerName(element.getParent().getElementName());
protected SymbolInformation createSymbol(TextDocument doc, Node node, YType type) throws BadLocationException { DocumentRegion region = NodeUtil.region(doc, node); Location location = new Location(doc.getUri(), doc.toRange(region.getStart(), region.getLength())); SymbolInformation symbol = new SymbolInformation(); symbol.setName(region.toString()); symbol.setKind(symbolKind(type)); symbol.setLocation(location); symbol.setContainerName(containerName(type)); return symbol; }
@Override public void acceptTypeNameMatch(TypeNameMatch match) { SymbolInformation symbolInformation = new SymbolInformation(); symbolInformation.setContainerName(match.getTypeContainerName()); symbolInformation.setName(match.getSimpleTypeName()); symbolInformation.setKind(mapKind(match)); Location location; try { if (match.getType().isBinary()) { location = JDTUtils.toLocation(match.getType().getClassFile()); } else { location = JDTUtils.toLocation(match.getType()); } } catch (Exception e) { JavaLanguageServerPlugin.logException("Unable to determine location for " + match.getSimpleTypeName(), e); return; } symbolInformation.setLocation(location); symbols.add(symbolInformation); }
/** * @since 2.16 */ protected SymbolInformation createSymbol(final String uri, final DocumentSymbol symbol, final Function1<? super DocumentSymbol, ? extends String> containerNameProvider) { SymbolInformation _symbolInformation = new SymbolInformation(); final Procedure1<SymbolInformation> _function = (SymbolInformation it) -> { it.setName(symbol.getName()); it.setKind(symbol.getKind()); it.setDeprecated(symbol.getDeprecated()); Location _location = new Location(); final Procedure1<Location> _function_1 = (Location it_1) -> { it_1.setUri(uri); it_1.setRange(symbol.getSelectionRange()); }; Location _doubleArrow = ObjectExtensions.<Location>operator_doubleArrow(_location, _function_1); it.setLocation(_doubleArrow); it.setContainerName(containerNameProvider.apply(symbol)); }; return ObjectExtensions.<SymbolInformation>operator_doubleArrow(_symbolInformation, _function); }