Repository navigation
Support "go to definition" for namespace packages #231
Description
Activity
Swarnendu Biswas (@swarnendubiswas) Please could you provide a code sample of a scenario where 'Go to definition' does not work.
- addedinfo-neededIssue requires more information from posterIssue requires more information from posterarea-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
on Nov 15, 2017 swarnendubiswas commented
on Nov 15, 2017 AuthorMore actionsI understand, but I am referring to a multi-module multi-file project I am working on. I will need to try and create a dummy project to reproduce the problem.
Instead for now, I have attached a screenshot.
Refer to the static method calls In the screenshot:
RunTask.runBench()(line 16) andStatsTask.extractStats()(line 24). VSC is unable to go to definition. It cannot also jump to definition for calls likeoptions.setInputTupleFromStats()(line 38) whereoptionsis a object.However, VSC can jump to definition for
util.computeInputsFromStats()where util is the module.I understand, but I am referring to a multi-module multi-file project I am working on
Hmm, thats new information.
Without a proper sample its very difficult to assist. I'll try my best.
When using multi-root workspaces or similar, you'd have problems with paths (we're using Jedi to perform static analysis of the code base to provide intellisense).Assuming you have the following structure in a multiroot scenario:
- FolderA
- FolderB
When using modules from FolderA from code in FolderB, you'd need to modify your PYTHONPATH to help intellisense. One way of doing this is as follows:
- Create a
.envfile in your FolderB workspace root - Add the following
PYTHONPATH=../FolderA(this ensures FolderA will be added into your PYTHONPATH for vscode) - Restart VS Code
swarnendubiswas commented
on Nov 16, 2017 AuthorMore actionsI have attached a dummy project consisting of a few modules and class definitions. Go to definition does not work for me from the main() function. Please check.
dummy-project.tar.gz- added and removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Nov 16, 2017 - changed the title
[-]No definition found [/-][+]Support "go to definition" for namespace packages[/+]on Jan 2, 2018 - addedfeature-requestRequest for new features or functionalityRequest for new features or functionalityand removedarea-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.
on Jan 2, 2018 10 remaining items
gustavovalverde commented
on Mar 5, 2018 More actionsThank you very much Dave Halter (@davidhalter), just saw your commits sprint with all the fixes.
After VS Code is updated with the latest Jedi I'll be testing. Don Jayamanne (@DonJayamanne), I suppose we could test with the Insider Version of this repo after you do include the Jedi version, so I'll be waiting for that.gustavovalverde commented
on Mar 5, 2018 More actionsJust for curiosity, I'll be testing setting
"python.jediPath"with a pip install from Jedi master branch.Don Jayamanne (@DonJayamanne) Never use master in a release. I do releases for a reason. I'm just saying test it properly without releasing it :)
swarnendubiswas commented
on Jun 27, 2018 AuthorMore actionsBrett Cannon (@brettcannon) This is a quite late follow up to your comment about packages not having a
__init__.py. However,Go to definitiondoes not work even if I add a__init__.py.FYI, I can navigate these definitions in Atom.
Reacted by Mark Nuzz and Susaj S NairI have +1ed the enhancement request.
I was developing my code in a way that it is split over multiple packages falling in same namespace. The code for individual packages are in totally separate directories. The intellisense feature is not working in this case as of today.
MikhailArkhipov commented
on Dec 17, 2018 More actionsThis was fixed in LS 0.1.72
- locked as resolved and limited conversation to collaborators
on Jan 14, 2019

Environment data
VS Code version: 1.18.0
Python Extension version: 0.8.0
Python Version: 3.5.4
OS and version: CentOS 7.4
Actual behavior
"${workspaceRoot}/src"
].
Expected behavior
What is confusing for me is that "go to definition" works for a few method calls, but not for all.
Steps to reproduce:
Logs
Output from
Pythonoutput panelNo valid output.
Output from
Console window(Help->Developer Tools menu)No valid output.