pidgezero
pidgezero

Reputation: 283

VSCode: Intellisense has stopped suggesting imports in Python from my own code

Within a Python file in vscode, I have imported a constant called MONSTER_1_SET. The import source also has other constant variables named MONSTER_2_SET, all the way up to MONSTER_8_SET.

Before, once I would start typing the name of one of these constants anywhere within my .py file, VSCode would suggest the names of all of those constants to me, including the ones I haven't imported yet, where clicking on a not-yet-imported option would automatically import it.

This is no longer the case, beginning to type the name of these constants only suggests the one I have already imported. (only one autocomplete suggestion)

Autocomplete still works if I am beginning to type the constant being imported as part of the import statement. (autocomplete suggestions working as expected)

I would really prefer the old functionality if possible and am wondering how I can enable that. It was a huge quality of life thing for me, as the type of project I'm working on needs to do a lot of imports like this for contextual reasons.

This stopped working for me a few days ago, and I'm not sure why, as I didn't add any new extensions, restart vscode, or do anything funny besides make a new .py file that I wanted to import things into. I just assumed my language server had crashed or something, but I've tried reinstalling the Python and Pylance extensions and reloading and updating vscode, but nothing is restoring the old functionality.

Upvotes: 6

Views: 3190

Answers (2)

PDJ
PDJ

Reputation: 31

Press: Ctrl + ,

Type in Search settings "Pylance", scroll down, and then you'll accomplish it!

Upvotes: 0

pidgezero
pidgezero

Reputation: 283

I figured it out, this Pylance setting somehow became disabled and I needed to re-enable it.Pylance setting for auto imports

Upvotes: 6

Related Questions