use of com.redhat.qute.parser.template.ParameterDeclaration in project quarkus-ls by redhat-developer.
the class QuteHover method doHover.
public CompletableFuture<Hover> doHover(Template template, Position position, SharedSettings settings, CancelChecker cancelChecker) {
cancelChecker.checkCanceled();
HoverRequest hoverRequest = null;
try {
hoverRequest = new HoverRequest(template, position, settings);
} catch (BadLocationException e) {
LOGGER.log(Level.SEVERE, "Failed creating HoverRequest", e);
return NO_HOVER;
}
Node node = hoverRequest.getNode();
if (node == null) {
return NO_HOVER;
}
switch(node.getKind()) {
case Section:
// - Start end tag definition
Section section = (Section) node;
return doHoverForSection(section, template, hoverRequest, cancelChecker);
case ParameterDeclaration:
ParameterDeclaration parameterDeclaration = (ParameterDeclaration) node;
return doHoverForParameterDeclaration(parameterDeclaration, template, hoverRequest, cancelChecker);
case ExpressionPart:
Part part = (Part) node;
return doHoverForExpressionPart(part, template, hoverRequest, cancelChecker);
case Parameter:
Parameter parameter = (Parameter) node;
return doHoverForParameter(parameter, template, hoverRequest);
default:
return NO_HOVER;
}
}
use of com.redhat.qute.parser.template.ParameterDeclaration in project quarkus-ls by redhat-developer.
the class QuteSearchUtils method searchReferencedObjects.
// ------------------- Search referenced objects
/**
* Search referenced object of the given node.
*
* @param node the origin node.
* @param offset the offset.
* @param collector the collector to collect node and range.
* @param includeNode true if the origin node must be collected and false
* otherwise.
* @param cancelChecker the cancel checker.
*/
public static void searchReferencedObjects(Node node, int offset, BiConsumer<Node, Range> collector, boolean includeNode, CancelChecker cancelChecker) {
switch(node.getKind()) {
case ParameterDeclaration:
{
ParameterDeclaration parameterDeclaration = (ParameterDeclaration) node;
if (parameterDeclaration.isInJavaTypeName(offset)) {
// {@org.acme.It|em item}
RangeOffset rangeOffset = parameterDeclaration.getJavaTypeNameRange(offset);
if (rangeOffset != null) {
Range range = QutePositionUtility.createRange(rangeOffset, node.getOwnerTemplate());
collector.accept(parameterDeclaration, range);
}
} else if (parameterDeclaration.isInAlias(offset)) {
// {@org.acme.Item it|em}
String alias = parameterDeclaration.getAlias();
if (includeNode) {
Range range = QutePositionUtility.selectAlias(parameterDeclaration);
collector.accept(parameterDeclaration, range);
}
searchReferencedObjects(alias, PartNameMatcher.BOTH, node, collector, cancelChecker);
}
break;
}
case Parameter:
{
Parameter parameter = (Parameter) node;
if (includeNode) {
Range range = QutePositionUtility.selectParameterName(parameter);
collector.accept(parameter, range);
}
String alias = parameter.getName();
searchReferencedObjects(alias, PartNameMatcher.ONLY_NAME, parameter.getParent(), collector, cancelChecker);
break;
}
default:
break;
}
}
Aggregations