microsoft / microsoft/TypeScript
Inline tsdoc comment support
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
Search Terms
tsdoc, comments, IDE, line sorting
Suggestion
When writing a type, sometimes you want to add more information to a field that will be surfaced in IDE autocomplete. Currently you must define them like this:
export type BoxSizeDefinition = {
/** this is null for non-custom box sizes */
itemCount: number | null
size: BoxSize
/** A description for the range of pounds included in box. */
poundage: string
/** price in cents of the box size */
price: number
}
Note that the comment is above the field. This is problematic because auto-sorting linters and such will mangle the comments.
I propose also supporting inline tsdoc comments:
export type BoxSizeDefinition = {
itemCount: number | null /** this is null for non-custom box sizes */
size: BoxSize
poundage: string /** A description for the range of pounds included in box. */
price: number /** price in cents of the box size */
}
This effectively fixes the sorting problem.
Use Cases
Adding descriptive text to be shown via IDE autocomplete for fields (currently supported, but not in a sorting & codeaction-friendly way.)
Examples
See above
Checklist
My suggestion meets these guidelines:
- 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. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提案されている TypeScript の型の例と、記載されている TSDoc および IDE-autocomplete のユースケースを確認することから始めます。影響を受ける parser、コメント処理、editor の動作を特定し、そのうえで、inline コメントが正しいフィールドに関連付けられ、runtime output が変更されないことを示すテストを定義します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers, developer-experience
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100