Search in sources :

Example 1 with ExtendedDataModelTemplate

use of com.redhat.qute.project.datamodel.ExtendedDataModelTemplate 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);
    }
}
Also used : CompletionItem(org.eclipse.lsp4j.CompletionItem) ExtendedDataModelParameter(com.redhat.qute.project.datamodel.ExtendedDataModelParameter) TextEdit(org.eclipse.lsp4j.TextEdit) ExtendedDataModelTemplate(com.redhat.qute.project.datamodel.ExtendedDataModelTemplate)

Aggregations

ExtendedDataModelParameter (com.redhat.qute.project.datamodel.ExtendedDataModelParameter)1 ExtendedDataModelTemplate (com.redhat.qute.project.datamodel.ExtendedDataModelTemplate)1 CompletionItem (org.eclipse.lsp4j.CompletionItem)1 TextEdit (org.eclipse.lsp4j.TextEdit)1