Ramblestsad
Ramblestsad

Reputation: 53

VSCode Pylance auto import only prompt for typing

I am using vscode python and pylance extension. Half a month ago, everything was wonderful, when I typed pandas without importing it, I can press cmd + . to show quick fixes but now I cannot. Besides, pylance says it has an auto import function, however, it only auto imports anything relates to typing package.

Should I modify pylance stubpath because now it is default to typing?

Upvotes: 5

Views: 13047

Answers (2)

chik182
chik182

Reputation: 21

Had the same problem and the easy fix is to add:

    "python.analysis.stubPath": "",
    "python.analysis.indexing": true,

in your settings.json either in workspace or in user settings of VS Code. More about VS Code settings here: https://code.visualstudio.com/docs/getstarted/settings

Upvotes: 2

Jill Cheng
Jill Cheng

Reputation: 10354

Pylance's "quick fix" and "auto import" functions are available. It displays the modules that have been used by default, especially the files in the current project have used this module.

It is recommended that you disable other unrelated extensions to avoid interference between extensions. In addition, please try to reinstall the extension "Pylance" and reload VSCode.

enter image description here

Reference: Auto-import doesn't work.

Upvotes: 1

Related Questions