-
Notifications
You must be signed in to change notification settings - Fork 767
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
Import suggestions ignores imports made on package level #5485
Comments
that's behavior for user files, when it is installed as third party packages (installed in site-packages), you will get the behavior you want. |
@heejaechang Ok, thanks for the quick reply and explanation. I get what you mean but packages installed in the venv's site-packages are never suggested (only the message "No code actions available") EDIT: Example of a package installed in site-packages of the current venv. It's not an issue finding the imports when I type them by hand, but the packages in the venvs site-packages are never suggested using alt-Enter. Typing the import works and types are discovered: (I'm not using any extraPaths settings) |
That's because, by default, pylance will try not to spend too much time on indexing. Indexing full packages installed is expensive, and not everyone wants or uses those expensive features. In other words, they don't want to spend 10 minutes waiting for VSCode to finish indexing their workspace/repo. So, we have this option
I believe you will get what you want. For more detail on the option, see the description. |
we also have this issue - #5434 - to address root issue (providing mode ( |
This issue has been closed automatically because it needs more information and has not had recent activity. If the issue still persists, please reopen with the information requested. Thanks. |
Import suggestions never lists package level declarations, only module level.
Problem: I want users of my package to import symbols from package level and not module level. VSCode suggests importing symbols from
package.module
instead ofpackage
.Environment data
FWIW, I'm NOT using the exact match setting when testing this:
Code Snippet
The following code is not being shown in the list of import suggestions:
pylance_imports_test/__init__.py
Module defined as:
pylance_imports_test/my_module.py
Repro Steps
from module import ...
importExpected behavior
Note: This behavior was produced by modifying the
__init__.py
from using afrom .... import ....
to use variables:Actual behavior
Logs
The logs prints
[found 0]
, unless the workaround of declaring an explicit variable is used. Then it prints[found 1]
:The text was updated successfully, but these errors were encountered: