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

Pylance can't analyze base module but can analyze sub-modules #853

Closed
zbs opened this issue Jan 19, 2021 · 3 comments
Closed

Pylance can't analyze base module but can analyze sub-modules #853

zbs opened this issue Jan 19, 2021 · 3 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@zbs
Copy link

zbs commented Jan 19, 2021

from foo.bar import baz is analyzed (e.g. foo and bar components can be CTRL+clicked), but the following cannot:

from foo import bar
import foo

My workspace structure is*

root
-- foo
---- foo
------ __init__.py
------ bar
-------- __init_.py
-------- baz
-- other_packages
-- main
---- test.py

and in test.py:

import foo

My python.analysis.extraPathslooks like:

python.analysis.extraPaths = [
  "foo",
]

My Pylance version is 2021.1.1 and my VS Code version is 1.52.1.

*Note that this is an abstract representation of my workspace structure, not my actual workspace structure.

@erictraut
Copy link
Contributor

Thanks for the bug report. The issue here is that you have two nested foo directories. Pylance is resolving the foo import to the top-level foo directory when it should be selecting the nested one.

I've fixed the underlying problem, and it will be included in the next release of pylance.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Jan 19, 2021
@zbs
Copy link
Author

zbs commented Jan 20, 2021

Thanks for the quick response! Looking forward to it.

@jakebailey
Copy link
Member

This issue has been fixed in version 2021.1.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202112-20-january-2021

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

No branches or pull requests

3 participants