redhat-developer / redhat-developer/vscode-java

Include Return Type Annotations in Method Hover Tooltip

Offen
#4,407 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement
Vorherrschende Sprache
TypeScript
Sterne
2.3k
Forks
546
Ø Merge
20 Std. 1 Min.
Gemergte PRs (30 T.)
11

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie damit, die Java-Hover-Tooltip-Implementierung in der VS Code-Erweiterung zu finden und nachzuverfolgen, wie Methodensignaturen gerendert werden. Verwenden Sie die Beispiele @Nullable und List<@NonNull String> als erwartete Fälle; abgeschlossen ist die Aufgabe, wenn sowohl Deklarations- als auch Type-Use-Rückgabeannotationen in der Hover-Ausgabe erscheinen und entsprechende Tests hinzugefügt oder aktualisiert wurden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java, typescript, vscode
Bereich
developer-experience, tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.