-
Notifications
You must be signed in to change notification settings - Fork 770
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
Go to definition by python module path in string #3700
Comments
Can you give an example on where you'd go to definition? Do you mean where you're using say |
@rchiodo I agree that while classes paths are fairly obvious in terms of behaviour, for non project directories (majority of cases) it's more complicated. Ideal world scenario would be showing the library directory somehow in the file explorer, perhaps as separate folder in workspace? |
@djego351 I'm sorry but I don't think I understand what it is you're asking for. Goto definition on what exactly? |
@rchiodo Sorry, when I go to definition of I hope that makes sense |
Ah okay, so you want special functionality for strings in general or is there some other way for us to identify these are actually package names? |
I'm thinking about it now. Not really much more than optionally dot separated words. Eh, that might be dirty. |
Are these strings always in a settings.py file? Maybe we could use that to filter it down? Strings in settings.py that contain '.' in them and no spaces or other punctuation |
@rchiodo Not always in settings.py unfortunately. It's also in urls.py and models.py. urls.py
Here in slightly different way: (would normally be "transmissions.models.Sport" but django ommits that in ForeignKey, OneToOneField, ManyToManyField and possibly more)
In general it can be seen in many places so I would treat that as a django thing, but also other libraries use that too. The general question, how much appreciated is making annotations to competition's solution? |
This issue has been fixed in prerelease version 2023.4.41, which we've just released. You can find the changelog here: CHANGELOG.md It has a setting that must be set to true for it to work though: "python.analysis.gotoDefinitionInStringLiteral": true, |
Works beautifully! Thanks you! |
MacOS 13.0
VSCode Version: 1.73.1
Pylance v2022.11.30
Pylance language server 2022.11.30
Django heavily uses python module paths in strings for configuration.
settings.py
Another example:
urls.py
I would like to have option to go to the definition by these strings
The text was updated successfully, but these errors were encountered: