redhat-developer / redhat-developer/vscode-java
Organize Imports should be smarter about single-letter types
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 546
- Merge medio
- 20h 1m
- PR unite (30g)
- 11
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dal punto di ingresso di Organize Imports e riproduci il comportamento con lo snippet Java presente in questa issue, usando per l’importazione un tipo di una sola lettera come T. Il lavoro è completato quando l’estensione evita di importare alla cieca il tipo di una sola lettera e invece segnala il problema della variabile di tipo mancante o chiede conferma.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, typescript, vscode
- Ambito
- developer-experience, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100