microsoft / microsoft/TypeScript
Go-to-definition on interfaces shadowed by namespaces opens a selection dialog instead of going to the interface, when used as one.
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.81.1
- OS Version: 13.4.1 (c)
Steps to Reproduce:
npm install openaiimport OpenAI from 'openai'; type Foo = OpenAI.Chat.Completion- cmd-click on "Completion"
- observe a dialog pop up, offering you the interface
Completionor the namespaceCompletion
Desired behavior:
Jump directly to the definition of the interface Completion, since that is how it's being used there.
Context:
Libraries like stripe and openai use the pattern of shadowing interfaces with namespaces when describing large JSON objects generated from their OpenAPI specs.
This was a tradeoff made because the alternatives are worse: you'd otherwise have to generate long, Java-like names (eg; ChatCompletionChoiceMessageFunctionCall), try to come up with minimal names (which could easily clash with future objects, causing backwards-compatibility issues), move all sub-objects into other files (which'd quickly get unreadable), or define all objects inline (which makes it difficult-to-impossible to directly reference object types whose parents are nullable/optional, members of unions, etc).
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Verhalten mit npm install openai und import OpenAI from 'openai'; type Foo = OpenAI.Chat.Completion, und verwende dann cmd-click auf Completion. Untersuche den go-to-definition-Einstiegspunkt und die Symbolauflösung für das Interface und den Namespace; abgeschlossen ist die Aufgabe, wenn diese Verwendung das Interface direkt ohne Auswahldialog öffnet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- developer-experience
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100