Repository navigation
Update our calls to goto_assignments() for Jedi #1033
Description
Activity
- addedbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
on Mar 12, 2018 This reproduces for me under Python 2, 3.5 and 3.6 (all virtualenvs on Ubuntu).
Notably on importing
a1as a whole module and referencingFooas an attribute of that, going to the definition ofFoogoes directly to the class definition ina1.py:import a1 class Bar2(a1.Foo): pass
Separately, this bug feels reminiscent of https://github.com/DonJayamanne/pythonVSCode/issues/781 and https://github.com/DonJayamanne/pythonVSCode/issues/742; perhaps a fix might be found in a similar location?
I found something that may help from here
This seems to be because the extension uses goto_definitions instead of goto_assignments when calling Jedi. Calling goto_assignments instead fixes this, but changes the behavior when going to an imported function.
i.e. with the current code clicking on
barin this codefrom foo import bar bar()will jump to
barin thefoomodule, but if goto_assignments is used this will jump to thefrom foo import barline.I guess, vscode-python switch from
goto_definitionstogoto_assignments.I think giving a setting option to choose between
goto_definitionsandgoto_assignmentsis a better solution. (I likegoto_definitions)- added and removed
on Mar 20, 2018 ocavue we actually use both as necessary.
This appears to be a semantic change between Jedi 0.10.x and 0.11.x which we upgraded to in the
2018.2.0release.Brett Cannon (@brettcannon) you are right. I clone v0.9.0 Jedi and everything is fine. Thanks to
python.jediPathsetting.Brett Cannon (@brettcannon) does that mean that there's now an open issue upstream for this? (I can't immediately see one, but would be happy to create one)
The jedi changelog doesn't note any changes around the goto* api methods in 0.11.x, it would be good to understand where you think the difference is?
12 remaining items
EvgeniyMakhmudov commented
on Apr 5, 2018 AuthorMore actionsGood news!
P.S. I am still on version 2018.1.0 and wait fix- assigned and unassigned
on Apr 5, 2018 Brett Cannon (@brettcannon) how large a fix would you like to make here?
I can see a couple of options: just the small fix which resolves the original report, or a larger change which simplifies the definition lookup code in_process_requestto a singlegoto_assignments(follow_imports=True)call. I'm interested in helping fix this either way, though might need a bit more guidance on testing of the larger change (if that's the approach you want).How large is large? I'm personally fine with a small fix, but if e.g. less than 20 lines or so for the bigger one and there is larger win for users then we will happily help you with the bigger fix.
Great to see this fixed :)
Apologies for not replying here, I had meant to come back to this but haven't had a lot of time recently.Peter Law (@PeterJCLaw) it's open source; you were trying to do a kindness and you simply couldn't get to it. No worries. 😄
- added 2 commits that reference this issue
on May 19, 2018 - added a commit that references this issue
on Jun 5, 2018 - locked as resolved and limited conversation to collaborators
on Jul 11, 2018

Environment data
Actual behavior
Go to definition of some used class not open file with it definition
Expected behavior
Go to definition of some used class open file with it definition
Steps to reproduce:
class Foo: passFoo, must open a1 file with definition of Foo, but moving cursor to first line with import of FooLogs
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)Output from
Consoleunder theDeveloper Toolspanel (toggle Developer Tools on underHelp)