TypeScript
TypeScript copied to clipboard
Exclude packages from intellisense
I'd like to excludes packages (whether from @types or not) from intellisense.
Use-case: in a Next.js project, you'll have typings for Node.js. And then even when you're not in server context, but instead are writing typescript meant to run in the browser, typing log will yield:

That's annoying, and you'd almost never want that one anyway. Not even when writing serverside code.
I've tried fiddling with tsconfig to no avail, looking around in editor.suggestions settings, but there's only options for reordering. I would like a way to exclude stuff there.
In this particular case, I would like to exclude the console package, or maybe just all Node.js related packages.
Current workaround is to use the setting "editor.snippetSuggestions": "top".
This achieves the goal of being able to go l o g Enter and end up writing a console.log( );
But it's only a workaround, because the offending package is still there, and this problem might very well occur for other suggestions. I guess the bottomline is, I don't want suggestions for Node.js packages when writing browser code.
This is supported, see #49578
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow or the TypeScript Discord community.
In that case it doesn't seem to be working:
"typescript.preferences.autoImportFileExcludePatterns": [
"console"
]
Even when expanding to all apparent possible ways to find it:
"typescript.preferences.autoImportFileExcludePatterns": [
"console",
"**/console",
"/**/console",
"*/**/console",
"/*/**/console"
]
So let's not be too sure about this issue being a question, before it actually works 😊
Please file bug report using the template if you believe you have a bug. Thanks!
I'm not going to create another issue if a perfectly good one already exists.
If this can't be a feature request, then consider it a bug report. If you need more information, do ask.
To expedite the triage process, we need everyone to follow the issue template and instructions.
When you clicked "Create New Issue", the issue form was pre-populated with a template and some instructions. We need you to read those instructions completely, follow them, and then fill in all the fields in that template.
We are not able to assist with issues that don't follow the template instructions as they represent a significantly larger amount of work compared to issues which are correctly specified. Thank you for understanding.