microsoft / microsoft/TypeScript
`js/ts.preferences.autoImportFileExcludePatterns` is not reflected promptly in IntelliSense suggestions
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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