drccrd commented on code in PR #3965:
URL:
https://github.com/apache/incubator-kie-tools/pull/3965#discussion_r3842265292
##########
packages/drools-lsp/drools-completion/src/main/java/org/drools/completion/DRLHoverHelper.java:
##########
@@ -108,35 +136,383 @@ public static Hover hover(String text, Position
position, ClassIndex classIndex,
String boundFqcn = DRLCompletionHelper.resolveFqcn(
boundType, boundType, compilationUnit, classIndex);
if (boundFqcn != null) {
- return markdown(renderJavaType(boundType, boundFqcn,
memberIndex.membersOf(boundFqcn)));
+ return markdown(renderJavaType(boundType, boundFqcn,
memberIndex.membersOf(boundFqcn),
+ memberIndex.constructorsOf(boundFqcn)));
}
+ // Nothing to describe beyond the name: a primitive has no
class
+ // to load and no members, and the type is the useful part
anyway.
+ return markdown(fencedHeader(word + " : " +
boundType).stripTrailing());
}
}
- // 3. Field of the pattern enclosing the caret.
+ // 4. Field of the pattern enclosing the caret.
if (nodeIndex != null) {
String patternType =
DRLCompletionHelper.findEnclosingPatternTypeName(
compilationUnit, nodeIndex);
if (patternType != null && !patternType.equals(word)) {
Field field = findField(patternType, word, typeIndex,
compilationUnit, classIndex,
memberIndex);
if (field != null) {
- String owner =
patternType.substring(patternType.lastIndexOf('.') + 1);
- return markdown("**" + field.name + "** : `" + field.type
- + "`\n\nField of `" + owner + "`");
+ return markdown(renderField(field,
simpleName(patternType)));
}
}
}
- // 4. Classpath type (or java.lang built-in). Show the hover even with
no
+ // 5. Documented function/query/global. The doc-comment parser maps
names
+ // across the whole document with no position scoping, so this comes
+ // after the binding and pattern-field steps: a field sharing its
name
+ // with a documented declaration must still describe the field.
+ Hover doc = docHover(word, currentDocTypes, text, documentPath,
openFiles);
+ if (doc != null) {
+ return doc;
Review Comment:
fixed in 9e1527b70fdd80c8b49934e3502e4a6c7b5771d3 - name-only doc is built
only if the token isn't resolved by any more structured method
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]