microsoft / microsoft/TypeScript

Adding documentation comments to the return values of destructuring syntax

オープン
#60,759 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

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

Awaiting More Feedback Suggestion
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

Type: Feature Request

  • In ReactJS, we often write code similar to const [stateX, setStateX] = useState({ ... });.

  • I would like to hover over the variable name stateX with the mouse in other places where this variable is used to get an explanation similar to JSDoc (not for type, but to more clearly annotate the purpose of the variable).

  • The reason I think this way is because the following approach often works:

/** It's a ref for X */
const refX = useRef({ ... });

(When I hover over the refX variable in other places where it is accessed, the tooltip can display the documentation "It's a ref for X".)

  • However, I have not found any way to annotate without disrupting the original code structure, so that VSCode can recognize my documentary comments for the tuple.
  • I'm not sure whether this should be considered a feature request or a bug report.

VS Code version: Code 1.95.3 (Universal) (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Darwin arm64 22.3.0
Modes:

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

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

はじめの一歩

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

調査の方向性

VS Code で報告された TypeScript の分割代入の例を再現し、そのホバー動作を文書化された useRef の例と比較してください。ホバーのドキュメント表示を担う language service の動作を追跡し、tuple bindings が個別のコメントを公開できるかどうかを判断してください。元のコード構造を変更せずに、要求された変数のドキュメントが表示されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript, vscode
領域
developer-experience
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

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

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