4

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?

thepunitsingh
  • 713
  • 1
  • 12
  • 30
Ramblestsad
  • 43
  • 1
  • 5

2 Answers2

2

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.

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25
  • 3
    For anyone wondering in Feb 22, why this does not work at the moment: Add this setting to vs code to make it work: `"python.analysis.indexing": true` [see github](https://github.com/microsoft/pylance-release/issues/28#issuecomment-728219527) – Tobi Feb 04 '22 at 13:35
  • 1
    For those who don't want to touch their mouse, like myself, the keyboard shortcut for the quick fix menu is `ctrl + .` – PhilMacKay Nov 22 '22 at 15:22
2

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

chik182
  • 21
  • 3