Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Qute CodeAction(s) for similar text suggestions for UnknownProperty #693

Conversation

AlexXuChen
Copy link
Contributor

Added Qute CodeAction(s) for similar text suggestions for UnknownProperty.

Part of #602

Signed-off-by: Alexander Chen alchen@redhat.com

private Collection<String> collectAvailableValuesForPropertyPart(PropertyPart node, Template template,
String resolvedType) {
String projectUri = template.getProjectUri();
return javaCache.resolveJavaType(resolvedType, projectUri).getNow(null).getFields().stream()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You dont need to use javaCache here. You can use directly baseResolvedType

Copy link
Contributor

@angelozerr angelozerr Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that you see property completion at

private CompletionList doCompleteForJavaTypeMembers(ResolvedJavaTypeInfo baseType, int start, int end,
and you wiĺl see that it is not only fields of resolved type but too fields from extended type and method which have no parameters, value revolvers, etc

@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion-property branch from 64686f4 to eb2918c Compare August 4, 2022 17:13
@@ -70,12 +76,14 @@ public void doCodeActions(CodeActionRequest request, List<CompletableFuture<Void
QuteTemplateGenerateMissingJavaMember resolver = request.getResolver();
SharedSettings sharedSettings = request.getSharedSettings();

Part propertyPart = (Part) request.getCoveredNode();
Part part = (Part) node;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caste in PropertyPart


List<String> javaFieldNames = baseResolvedType.getFields().stream().map(x -> x.getName())
.collect(Collectors.toList());
for (String fieldName : javaFieldNames) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

availableValues.addAll(javaFieldNames)

}
}

return availableValues;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It misses methods without parameters and value resolvers. See completion for property

Signed-off-by: Alexander Chen <alchen@redhat.com>
@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion-property branch from eb2918c to 58992ec Compare August 9, 2022 13:21
@datho7561 datho7561 self-requested a review August 9, 2022 13:39
@@ -183,4 +195,110 @@ private static void doCodeActionToCreateTemplateExtensionsClass(String missingPr
}));
}

private static void doCodeActionToCreateProperty(Part propertyPart, ResolvedJavaTypeInfo baseResolvedType,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you this static method which break the build in your PR? .

@angelozerr
Copy link
Contributor

angelozerr commented Aug 22, 2022

Replaced with #713

@angelozerr angelozerr closed this Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants