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.
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
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).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
npm install openai と import OpenAI from 'openai'; type Foo = OpenAI.Chat.Completion を使って動作を再現し、その後 Completion に cmd-click を使用します。interface と namespace の go-to-definition エントリポイントおよびシンボル解決を調査します。この使用方法で選択ダイアログを表示せずに interface が直接開けば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- developer-experience
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100