redhat-developer / redhat-developer/vscode-java

Include Return Type Annotations in Method Hover Tooltip

Đang mở
#4,407 1 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

enhancement
Ngôn ngữ chính
TypeScript
Star
2.3k
Fork
546
Merge trung bình
20 giờ 1 phút
Pull request đã merge (30 ngày)
11

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xác định phần triển khai tooltip hover Java trong extension VS Code và theo dõi cách các chữ ký phương thức được kết xuất. Sử dụng các ví dụ @Nullable và List<@NonNull String> làm các trường hợp mong đợi; công việc được xem là hoàn tất khi cả chú thích kiểu trả về trong khai báo và chú thích kiểu trả về trong việc sử dụng kiểu đều xuất hiện trong đầu ra hover, đồng thời các bài kiểm thử tương ứng đã được thêm hoặc cập nhật.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, typescript, vscode
Lĩnh vực
developer-experience, tooling
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.