TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Exclude packages from intellisense

Open thany opened this issue 2 years ago • 1 comments

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:

image

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.

thany avatar May 04 '23 14:05 thany

This is supported, see #49578

RyanCavanaugh avatar May 04 '23 18:05 RyanCavanaugh

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.

typescript-bot avatar May 07 '23 00:05 typescript-bot

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 😊

thany avatar May 08 '23 15:05 thany

Please file bug report using the template if you believe you have a bug. Thanks!

RyanCavanaugh avatar May 08 '23 19:05 RyanCavanaugh

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.

thany avatar May 10 '23 10:05 thany

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.

RyanCavanaugh avatar May 10 '23 14:05 RyanCavanaugh