use of com.redhat.qute.project.datamodel.ExtendedDataModelParameter in project quarkus-ls by redhat-developer.
the class QuteCodeLens method collectDataModelCodeLenses.
private static void collectDataModelCodeLenses(ExtendedDataModelTemplate templateDataModel, Template template, SharedSettings settings, List<CodeLens> lenses, CancelChecker cancelChecker) {
if (templateDataModel == null || templateDataModel.getSourceType() == null) {
return;
}
cancelChecker.checkCanceled();
String projectUri = template.getProjectUri();
boolean canSupportJavaDefinition = settings.getCommandCapabilities().isCommandSupported(COMMAND_JAVA_DEFINITION);
// Method/Field which is bound with the template
String title = createCheckedTemplateTitle(templateDataModel);
Range range = LEFT_TOP_RANGE;
Command command = !canSupportJavaDefinition ? new Command(title, "") : new Command(title, COMMAND_JAVA_DEFINITION, Arrays.asList(templateDataModel.toJavaDefinitionParams(projectUri)));
CodeLens codeLens = new CodeLens(range, command, null);
lenses.add(codeLens);
// Parameters of the template
List<ExtendedDataModelParameter> parameters = templateDataModel.getParameters();
if (parameters != null) {
for (ExtendedDataModelParameter parameter : parameters) {
String parameterTitle = createParameterTitle(parameter);
Command parameterCommand = !canSupportJavaDefinition ? new Command(title, "") : new Command(parameterTitle, COMMAND_JAVA_DEFINITION, Arrays.asList(parameter.toJavaDefinitionParams(projectUri)));
CodeLens parameterCodeLens = new CodeLens(range, parameterCommand, null);
lenses.add(parameterCodeLens);
}
}
}
use of com.redhat.qute.project.datamodel.ExtendedDataModelParameter in project quarkus-ls by redhat-developer.
the class QuteCompletionsForExpression method doCompleteExpressionForObjectPartWithCheckedTemplate.
private void doCompleteExpressionForObjectPartWithCheckedTemplate(Template template, Range range, CompletionList list) {
ExtendedDataModelTemplate dataModel = javaCache.getDataModelTemplate(template).getNow(null);
if (dataModel == null || dataModel.getParameters() == null) {
return;
}
for (ExtendedDataModelParameter parameter : dataModel.getParameters()) {
CompletionItem item = new CompletionItem();
item.setLabel(parameter.getKey());
item.setKind(CompletionItemKind.Reference);
TextEdit textEdit = new TextEdit(range, parameter.getKey());
item.setTextEdit(Either.forLeft(textEdit));
list.getItems().add(item);
}
}
Aggregations