mmdanziger
mmdanziger

Reputation: 4648

How to stop VSCode Intellisense in `import X as y` statements?

In VS Code when you import a module as an alias Intellisense suggests auto-completions, which appear to be Python path binaries.

For example, when I try and import pandas as pd I get pdb and pudb as suggestions:

import pandas as pd pdb pudb

which, if I instinctively press enter on, results in import pandas as import pdb; pdb.set_trace(), an error:

import pandas as import pdb; pdb.set_trace()

It seems to me that there should be no Intellisense at all for aliases because there is no "correct" alias for an imported library, and this is just a bug.

My question is, is there a way to disable Intellisense for cases like this?

I could press Esc or add a ; and it will go away. I could also use a plain text editor, instead of an IDE.

Incidentally, someone tried to ask this question earlier but it was not phrased clearly and was closed Set up pandas as pd alias in vscode

Upvotes: 0

Views: 306

Answers (1)

kumarchandresh
kumarchandresh

Reputation: 590

My question is, is there a way to disable Intellisense for cases like this?

Not that I am aware of. Maybe raise an issue on Github? 😁

Workaround:

These are the two settings that I use to get rid of annoying autocompletion except for tab-completion:

{
    "editor.acceptSuggestionOnEnter": "off",
    "editor.acceptSuggestionOnCommitCharacter": false,
}

Upvotes: 2

Related Questions