redhat-developer / redhat-developer/vscode-java
Organize Imports should be smarter about single-letter types
Chưa có ai nhận issue này.
- 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ả
When there's an unresolved single-letter type usage in the code, doing Organize Imports should not blindly import a type it finds
Environment
- Operating System: Windows 10
- JDK version: 14
- Visual Studio Code version: 1.45.0
- Java extension version: 0.61.0
Steps To Reproduce
- do Organize Imports on the code below, while there's a single type T available for import (in my case it was inside Apache POI, but you could just create a trivial
T.javafile
import java.util.Map;
//import org.apache.poi.ss.formula.functions.T;
public class Bar {
public void print(Comparable<T> bar, Map<Integer, T> whatever) {
}
}
Current Result
the type T is imported
Expected Result
the actual issue here is that I forgot to specify the type variable T. Ideally, the extension would give a single error saying exactly that. If that's not feasible, it should at least ask confirmation before importing single-letter types, even if there's only a single one available: the chances that the user actually wants to import such a type are much smaller than the chance that there's an error w.r.t. type variables
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu từ điểm vào của Organize Imports và tái hiện hành vi bằng đoạn mã Java trong issue này, sử dụng một kiểu chỉ gồm một chữ cái như T có sẵn để import. Công việc hoàn tất khi extension không còn import mù quáng kiểu chỉ gồm một chữ cái mà thay vào đó báo cáo vấn đề thiếu biến kiểu hoặc yêu cầu xác nhận.
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
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100