microsoft / microsoft/vscode-java-pack

Make Ctrl+T more context-dependent

Ouverte
#899 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

ai-triaged enhancement feature-request
Langage dominant
TypeScript
Étoiles
352
Forks
166
Merge moyen
17 h 47 min
PR mergées (30 j)
32

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Le payload ne mentionne aucun fichier source ni aucun test ; commencez par reproduire Ctrl+T sur des méthodes Java surlignées dans VS Code et comparez le comportement existant avec Eclipse. C’est terminé lorsque l’arbre suit les implémentations des méthodes pertinentes de la superclasse et de la sous-classe déclarées, et que la sélection d’un nœud permet d’accéder à cette implémentation de méthode plutôt qu’à la déclaration du type.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, typescript, vscode
Domaine
developer-experience, tooling
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
32/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.