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.

オープン
#55,593 コメント 6 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Awaiting More Feedback Suggestion
主要言語
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:

  1. npm install openai
  2. import OpenAI from 'openai'; type Foo = OpenAI.Chat.Completion
  3. cmd-click on "Completion"
  4. observe a dialog pop up, offering you the interface Completion or the namespace Completion

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).

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

npm install openaiimport 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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。