microsoft / microsoft/TypeScript

Enums and interfaces do not have definitions in quick info/tooltips

Offen
#25,894 6 Kommentare 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Domain: LS: Quick Info Experience Enhancement Help Wanted Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

The issue might be related to this one, but mine is not about version 3.0, and is not solely about imports.

Search Terms

enum, description, definition, pop-up, tooltip, vs code, interface, suggestion

Suggestion

Hovering over enums and interfaces, should show their definition, i.e. I have this enum (or an interface):

enum enumName {
    ONE = 1;
    TWO = 2;
    THREE = 3;
}

If I hover over this enum, wherever I use it (whether it is imported to another file or used locally where it is declared), I would like to see what this enum is all about (essentially what are the properties).

This is what I see right now when I hover over enums or interfaces:
image
image

As a workaround, I currently need to add this type of JSDoc comments right above the enum declaration.

/** Props:
*    @param ONE 1;
*    @param TWO 2;
*    @param THREE 3;
*/

Which yields to:
image

Use Cases

This feature would save time & effort.
The shortcoming of the current approach is that either need to add ${2+numberOfEnumProperties} lines of comments or go to the file, where enum is declared, locate the enum there and then familiarize myself with its properties.

Examples

image

Checklist

I am not that experienced to be able to answer the questions below.

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere das gemeldete quick-info-Verhalten mit den enum- und interface-Beispielen aus dem Issue, sowohl lokal als auch beim Import. Beginne damit, den TypeScript quick-info/tooltip-Einstiegspunkt nachzuverfolgen, und ermittle anschließend das bestehende Anzeigeverhalten für diese Deklarationen. Als erledigt gilt die Aufgabe, wenn beim Darüberfahren ihre Definitionen und Member sowohl bei lokaler als auch bei importierter Verwendung angezeigt werden und die relevanten Tests aktualisiert sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
developer-experience, tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.