-
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
Cannot "Go to Definition" for files in Python Eggs #1685
Comments
If the file is in an egg, there's no file on disk that VS Code can open, so we don't allow navigation there. Allowing navigation causes VS Code to throw an error that the file isn't found. I'm not sure how this would have been working on versions that predate egg support; necessarily, if this module is in an egg, and we entirely ignored eggs, we wouldn't have been able to resolve the import. The only way that navigation would have been working is if there was another module of the same name that was being resolved (which would actually be the wrong module, given the egg is resolving it now). |
Where does go to def go in the older version? Somewhere else? |
the def goes to the correct place in the older versions, ie the 2021.6.0 introduced an update that regressed this functionality for me So it would be navigating to and opening this file correctly |
Is that |
The the |
I see; I didn't realize that eggs would be folders (not quite sure of the point of them at that point compared to regularly installed modules, but...). |
Eggs being folders is to support Python bindings in C/C++ without compilation, allow for easy import, and allow easy upgrades because it is self-contained |
Sure, but one can achieve the same things with packages installed normally in site-packages versus nested in egg folders. (I'm honestly surprised anyone uses eggs these days when wheels have been the standard for a while). Anyway, it's a bug that we ignore eggs that aren't files. |
Oh gotcha. Was not aware of wheels vs eggs. |
This should be fixed in the next release. |
We typically leave issues open until the fix is released; reopening. |
the fix is in 2021.8.3 release. |
Environment data
Expected behaviour
In PyLance 2021.5.4 and before, when I do the command "Go to Definition" (right click on the function and then the first dropdown link), it works as intended and creates a separate tab in VSCode where the highlighted code is defined.
Actual behaviour
When I do the command "Go to Definition" for something like
where package would be in a Python egg
home/acho/miniconda3/envs/env_name/lib/python3.8/site-packages/internal_package-2.1.2.300-py3.8.egg/InternalPackage/utility/log
I would expect this to work, but instead, PyLance throws "No Definition Found".
PyLance does recognize the correct type for imported classes and signature for functions.
Code Snippet / Additional information
So this works correctly in 2021.5.4 and previous version. However, there was a breaking change made in 2021.6.0
The text was updated successfully, but these errors were encountered: