Location clone(Location location) { if (location == null) { return null; } Range range = location.getRange(); String uri = location.getUri(); Location cloned = new Location(); cloned.setRange(clone(range)); cloned.setUri(uri); return cloned; }
r.setEnd(new Position(bLangNode.getPosition().getEndLine() - 1, bLangNode.getPosition().getEndColumn() - 1)); l.setRange(r); contents.add(l);
/** * Get the physical source location of the given package. * * @param bLangNode ballerina language node references are requested for * @param ownerPackageName list of name compositions of the node's package name * @param currentPackageName list of name compositions of the current package * @return location of the package of the given node */ private Location getLocation(BLangNode bLangNode, String ownerPackageName, String currentPackageName) { Location l = new Location(); Range r = new Range(); TextDocumentPositionParams position = this.context.get(DocumentServiceKeys.POSITION_KEY); String parentPath = new LSDocument(position.getTextDocument().getUri()).getSourceRoot(); if (parentPath != null) { String fileName = bLangNode.getPosition().getSource().getCompilationUnitName(); Path filePath = Paths.get(CommonUtil.getPackageURI(currentPackageName, parentPath, ownerPackageName), fileName); l.setUri(filePath.toUri().toString()); // Subtract 1 to convert the token lines and char positions to zero based indexing r.setStart(new Position(bLangNode.getPosition().getStartLine() - 1, bLangNode.getPosition().getStartColumn() - 1)); r.setEnd(new Position(bLangNode.getPosition().getEndLine() - 1, bLangNode.getPosition().getEndColumn() - 1)); l.setRange(r); } return l; }
/** * @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); }
}; Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_4); it_2.setRange(_doubleArrow); }; Location _doubleArrow = ObjectExtensions.<Location>operator_doubleArrow(_location, _function_3);