redhat-developer / redhat-developer/vscode-java
Prioritize and Differentiate Method Completions by Declaring Type
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 546
- Merge medio
- 20h 1m
- PR unite (30g)
- 11
Descrizione
Summary
Improve Java IntelliSense in Visual Studio Code by prioritizing methods based on their declaring type and visually distinguishing methods declared in the current class from inherited ones.
Problem
When invoking code completion on an object, methods from the entire inheritance hierarchy (class, superclasses, interfaces) are presented in a flat, mostly alphabetical or heuristically ranked list.
This creates two issues:
- Hard to quickly identify methods defined in the current class
- No clear distinction between local vs inherited methods
Expected Behavior
1. Ordering by Declaring Type
Completion items should be grouped and ordered as follows:
- Methods declared in the current class
- Methods from direct superclasses
- Methods from interfaces
- Methods from deeper inheritance levels
Within each group, keep existing sorting (alphabetical or relevance-based).
2. Frequency-Based Promotion
- Frequently used methods may be promoted higher in the list
- However, usage-based ranking should not completely override structural grouping
3. Visual Differentiation
- Methods declared in the current class should be bolded
- (Optional) Other methods may include subtle indicators of their declaring type
Example (Class Inheritance)
class Base {
void baseMethod() {}
}
interface MyInterface {
void interfaceMethod() {}
}
class Derived extends Base implements MyInterface {
void derivedMethod() {}
}
When invoking completion on Derived:
Expected order:
- derivedMethod()
- baseMethod()
- interfaceMethod()
Example (Interface Inheritance)
interface BaseRepository<T> {
void save(T entity);
}
interface PagingRepository<T> extends BaseRepository<T> {
Iterable<T> findAll();
}
interface UserRepository extends PagingRepository<User> {
User findByEmail(String email);
}
When invoking completion on UserRepository:
Expected order:
- findByEmail(String email) // declared in UserRepository
- findAll() // from PagingRepository
- save(T entity) // from BaseRepository
Real-World Use Case
This is especially useful in frameworks like Spring Data / Hibernate, where repositories are composed via multiple interface layers.
For example:
- Developers primarily care about methods declared in their own repository interface
- Framework-provided methods (e.g.,
save,findAll) are secondary but still important
Improved ordering and highlighting would:
- Make custom query methods immediately visible
- Reduce cognitive load when working with large inherited APIs
Motivation
- Faster identification of relevant methods
- Better usability in deep inheritance hierarchies
- Clear distinction between user-defined and framework-provided methods
- Aligns with developer mental models
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
Nell’issue non sono identificati file di implementazione né test. Inizia individuando i punti di ingresso per il ranking del completamento Java e per la presentazione degli elementi di completamento, quindi traccia il modo in cui sono rappresentati i tipi dichiaranti e l’ereditarietà. Definisci l’ordinamento dei completamenti e gli indicatori visivi per i metodi correnti, dell’antenato diretto, di interfaccia e dei livelli più profondi, e aggiungi la copertura per esempi di ereditarietà sia di classi sia di interfacce.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, typescript
- Ambito
- developer-experience, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100