microsoft / microsoft/TypeScript

`js/ts.preferences.autoImportFileExcludePatterns` is not reflected promptly in IntelliSense suggestions

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

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

Needs Investigation
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

🔎 Search Terms

autoImportFileExcludePatterns

🕗 Version & Regression Information
  • I test this in 4.8.4, 6.0.3 and tsgo 0.20260520.1
⏯ Playground Link

No response

💻 Code

in .vscode/settings.json

"js/ts.preferences.autoImportFileExcludePatterns": [
	//"**/node_modules/@types/node",
	// "node",
	"fs.d.ts",
	// "node_modules/@types/node/fs.d.ts",
	// "node:fs"
]

a.ts

readFileSync('','');
readF
🙁 Actual behavior

In VSCode,
when repeatedly toggling "fs.d.ts" in the config above:
Normal part: you will find that for the first line readFileSync('',''), the Quick Fix menu item like import from "fs" will appear or disappear as expected when "fs.d.ts" is added or removed from the config.
But for the case when you type readF and trigger IntelliSense, whether readFileSync... appears in the completion suggestions is unpredictable. Sometimes using "Reload Window" can fix it, but in most cases, it doesn't work as expected—toggling "fs.d.ts" doesn't immediately change the current IntelliSense state.

🙂 Expected behavior

For the above example, after modifying "js/ts.preferences.autoImportFileExcludePatterns" in the VSCode config, I expect the IntelliSense suggestions to reflect the changes immediately.

Additional information about the issue

There is a similar issue: https://github.com/microsoft/TypeScript/issues/60082
However, that one is a bit old and the phenomenon I described is somewhat different.

Additionally, I have a question: For the setting js/ts.preferences.autoImportFileExcludePatterns, does it only match a single file, or does it match the xxx part in import ... from 'xxx'? After all, a single file can define multiple modules, and multiple "exports" can also be defined in package.json.

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

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

はじめの一歩

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

調査の方向性

.vscode/settings.json と a.ts で再現を開始し、fs.d.ts を切り替えながら Quick Fix の動作と IntelliSense の補完候補を比較します。js/ts.preferences.autoImportFileExcludePatterns の設定処理と、それが影響を与える補完状態を追跡します。設定を変更すると現在の IntelliSense の候補が直ちに更新され、報告された再現が回帰テストでカバーされれば完了です。

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

評価

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

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

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