Skip to content

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

@heroboy

Description

@heroboy

🔎 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: #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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions