Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intellisense including from xxx import {haven't specified classes} #2533

Closed
gonghenghai opened this issue Apr 1, 2022 · 8 comments
Closed
Assignees
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version reference

Comments

@gonghenghai
Copy link

For example:

from PySide6.QtWidgets import QApplication,

The Intellisense including QPushButton when I type QP, and after I selected it, QPushButton will be imported automatically. the import will be changed to:

from PySide6.QtWidgets import QApplication, QPushButton.

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Apr 4, 2022
@github-actions github-actions bot added the triage label Apr 4, 2022
@judej judej added needs investigation Could be an issue - needs investigation and removed triage labels Apr 4, 2022
@heejaechang heejaechang added fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed needs investigation Could be an issue - needs investigation labels Apr 4, 2022
@heejaechang
Copy link
Contributor

fix will be in the next release.

but, it won't be supported out of box since we only include first level symbols in auto import. you will need to use our hidden options to enable it.

in settings.json, put this for us to pick the symbols up for auto import.

 "python.analysis.packageIndexDepths":[["PySide6",2]],

what it basically means is ["package name", "max depth to search"]. "max depth" basically means how many dot you need to access the module you want.

ex) PySide6.QtWidgets
this is 2 level deep.

deeper you go, Pylance will take more time to scan python files.

if you put, ["", 2], it will change default depth not one particular library's search depth.

thank you.

@bschnurr
Copy link
Member

bschnurr commented Apr 7, 2022

This issue has been fixed in version 2022.4.0, which we've just released. You can find the changelog here: CHANGELOG.md

@stefanbschneider
Copy link

stefanbschneider commented Jul 19, 2022

Adding this to my settings.json, VSCode tells me "Unknown Configuration Setting" and shows the line in reduced colors.

And it does not seem to work.

@willygroup
Copy link

Adding this to my settings.json, VSCode tells me "Unknown Configuration Setting" and shows the line in reduced colors.

And it does not seem to work.

Hi,
I solved it by putting this value to true in settings.json:
"python.analysis.indexing": true,

@nicodea
Copy link

nicodea commented Aug 16, 2022

I also updated my settings.json with the following lines:

"python.analysis.indexing": true,
"python.analysis.packageIndexDepths": [["", 10],],

This does seem to work for imports outside the workspace. However, imports inside the workspace still seem to be a problem. Has anyone encountered a similar behavior and/or found a solution for it?

UPDATE: it looks like imports inside the workspace work briefly after saving the settings, then stop being suggested. Most likely a bug.

@Smeb
Copy link

Smeb commented Aug 31, 2022

Can report a similar issue - imports within the workspace aren't being auto-completed. I'm working in a development container with code in src - fixing imports works, and suggestions are given after a file has been opened, but otherwise it'll only complete non-user code.

@its-all-waves
Copy link

Can report a similar issue - imports within the workspace aren't being auto-completed. I'm working in a development container with code in src - fixing imports works, and suggestions are given after a file has been opened, but otherwise it'll only complete non-user code.

Similar if not the same issue, here. Trying to use Kivy and it's only suggesting imports from official Py libraries.

@debonte
Copy link
Contributor

debonte commented Sep 21, 2022

@nicodea, @Smeb, @3pimz3, can one of you please file a separate issue on this "imports inside the workspace" issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version reference
Projects
None yet
Development

No branches or pull requests

10 participants