Variable with the same name as a submodule occasionally breaks semantic highlighting/hover text #750
Labels
bug
Something isn't working
fixed in next version (main)
A fix has been implemented and will appear in an upcoming version
Environment data
Expected behaviour
If a module exports a variable with the same name as one of it's submodules, pylance should always interpret it as a variable (just like python), and highlight it and show the relevant hover text accordingly.
Actual behaviour
If the first import from a submodule has the same name as the submodule, python overwrites it to the imported variable, while pylance still interprets it as a module.
Logs
Expand
Code Snippet / Additional information
I have a setup like this
demo\__init__.py
:demo\test.py
:example.py
:In
example.py
test
gets highlighted/hover test as if it is a module, while indemo\__init__.py
it's correctly highlighted as an int.This particular issue only happens if
from .test import test
is the first import from the test submodule indemo\__init__.py
. If you swap the order of the imports (or add a third beforehand) it changes slightly. Inexample.py
test
will be correctly highlighted as an int, while indemo\__init__.py
it will now be highlighted as a module.The text was updated successfully, but these errors were encountered: