microsoft / microsoft/TypeScript

Should intellisense suggest block scoped values before they are declared?

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

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

Domain: LS: Completion Lists Experience Enhancement Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

Currently intellisense suggests every block scoped declaration in scope, even if the suggestion is located within the TDZ. When accepting that suggestion, TypeScript issue an used before its declaration error:

new /**/; // suggests 'Clazz', which results in an error
class Clazz {}

function test(
  foo = /**/, // suggests `foo`, `bar` and `baz`, all of them result in an error
  bar = /**/, // suggests `bar` and `baz`, both result in an error
) {
  let baz = 1;
}

Should intellisense filter out suggestions that would result in an error? If so, it should probably use the same condition as the checker.

Related: #28472 #28471

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

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

はじめの一歩

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

調査の方向性

ファイルやテストは指定されていません。まず、ブロックスコープ宣言に対する IntelliSense の補完ロジックを見つけ、そのフィルタリングを checker の used-before-declaration 条件と比較します。Clasz、foo、bar、baz などの TDZ により無効な候補が除外され、正しい候補は引き続き利用可能になれば完了です。

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

評価

技術スタック
typescript
領域
developer-experience
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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