redhat-developer / redhat-developer/vscode-java

Prioritize and Differentiate Method Completions by Declaring Type

オープン
#4,408 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

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:

  1. Methods declared in the current class
  2. Methods from direct superclasses
  3. Methods from interfaces
  4. 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:

  1. derivedMethod()
  2. baseMethod()
  3. 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:

  1. findByEmail(String email) // declared in UserRepository
  2. findAll() // from PagingRepository
  3. 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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue では実装ファイルもテストも特定されていません。まず、Java の補完ランキングと補完項目の表示のエントリポイントを見つけ、次に宣言元の型と継承がどのように表現されているかを追跡します。現在のメソッド、直接の祖先のメソッド、インターフェースのメソッド、さらに深い階層のメソッドについて、補完の順序と視覚的マーカーを定義し、クラスとインターフェースの両方の継承例に対するカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, typescript
領域
developer-experience, tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。