pilat / vscode-importmagic

MIT License
36 stars 7 forks source link

Importing standard libraries #10

Open mrkafk opened 5 years ago

mrkafk commented 5 years ago

I wrote:

def fun():
    fname = hashlib.

And hashlib is not imported at the top. Importing some symbol with Ctrl-space after dot does not add import either.

VSCode: 1.30.2. OS: Debian 9.7, GUI: kde-plasma

pilat commented 5 years ago

Hi,

Please, verify your project settings. Your environment and python interpreter should be configured properly for your project (python.pythonPath). When you're typing "hashlib" you will see suggestinon "import hashlib". Press enter at this moment and import will be inserted to top:

video

balta2ar commented 5 years ago

Hm, it's a bit surprising how it works. I expected that this plugin would provide code actions. But once I saw your example, it became clear how to actually use it.