microsoft / microsoft/vscode-java-pack

Make Ctrl+T more context-dependent

未关闭
#899 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged enhancement feature-request
主要语言
TypeScript
星标
352
派生
166
平均合并
17 小时 47 分钟
30 天内合并 PR
32

描述

Suggestion

When pressing Ctrl+T when highlighting a method, we see the method hierarchy instead of the type hierarchy and navigation leads us directly to the method's declaration within the selected type and not to the declaration of the type itself.

Use Cases

I want to be able to easily navigate to all implementations of subclasses as well as super classes of a certain method to better understand how a certain type affects implementation of the selected method.

Examples

Given the following class hierarchy:

class A {
public String generateGreeting() {
return "Hi!";
}
}

class B extends A {
@Override
public String generateGreeting() {
return "Hello!";
}
}

class C extends A {
@Override
public String generateGreeting() {
return "Guten Tag!";
}
}

When highlighting generateGreeting() and pressing Ctrl+T I want to see a tree where nodes represent classes implementing the highlighted method. The nodes' nesting represents the class hierarchy. The nodes shown depend on the declared type of the field/variable on the caller side. In case the method is highlighted at its declaration the declared type would be the class enclosing the method. All sub classes and super classes of the declared type implementing the method must be shown as nodes in the tree (not only sub classes). When clicking a node, VS Code navigates to the corresponding method implementation of the highlighted method, not to the beginning of the type declaration (current behavior):

Situation 1:
A a = new B();
a.generateGreeting();
Declared type would be A, so I want to see implementations of A.generateGreeting and B.generateGreeting and C.generateGreeting as nodes in the tree

Situation 2:
B b = new B();
b.generateGreeting();
Declared type would be B, so I want to see implementations of A.generateGreeting and B.generateGreeting as nodes in the tree, but not C.generateGreeting because it is neither a subclass nor a super class of B.

You could check Eclipse's behavior for an existing implementation.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

payload 未指定源文件或测试;首先在 VS Code 中对突出显示的 Java 方法复现 Ctrl+T,并将现有行为与 Eclipse 进行比较。完成的标准是,树会跟随已声明类型的相关超类和子类方法实现,并且选择节点时会导航到该方法实现,而不是类型声明。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, typescript, vscode
领域
developer-experience, tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
32/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。