redhat-developer / redhat-developer/vscode-java
Include Return Type Annotations in Method Hover Tooltip
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
Description
When hovering over a method in the editor, the tooltip currently shows the method signature and Javadoc (if available). However, annotations applied to the method’s return type are not displayed.
This feature request proposes enhancing the hover tooltip to include annotations declared on the return type.
Example
public @Nullable String getName() {
return name;
}
or with type-use annotations:
public List<@NonNull String> getNames() {
return names;
}
Current Behavior:
Hover tooltip shows:
String getName()
Expected Behavior:
Hover tooltip shows:
@Nullable String getName()
and for generics:
List<@NonNull String> getNames()
Motivation / Use Case
Return type annotations (e.g., nullability annotations like @Nullable, @NonNull, or custom type-use annotations) are critical for understanding API contracts, static analysis, and preventing runtime errors.
Not displaying them in hover:
- Hides important semantic information
- Forces developers to navigate to the declaration
- Reduces the usefulness of hover as a quick inspection tool
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Java hover-tooltip implementation in the VS Code extension and tracing how method signatures are rendered. Use the @Nullable and List<@NonNull String> examples as the expected cases; done means both declaration and type-use return annotations appear in the hover output, with corresponding tests added or updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100