You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update our calls to goto_assignments() for Jedi #1033
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
[/home/john_16/.vscode/extensions/donjayamanne.githistory-0.4.0]: Команда "git.viewFileHistory" встречается несколько раз в разделе commands.
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:257 [Extension Host] TypeDefinition null
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:257 [Extension Host] Extension "currenttodos" activated!
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:257 [Extension Host] vscode-icons is active!
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:257 [Extension Host] (node:23354) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:257
This reproduces for me under Python 2, 3.5 and 3.6 (all virtualenvs on Ubuntu).
Notably on importing a1 as a whole module and referencing Foo as an attribute of that, going to the definition of Foo goes directly to the class definition in a1.py:
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 bar in this code
from foo import bar
bar()
will jump to bar in the foo module, but if goto_assignments is used this will jump to the from foo import bar line.
I guess, vscode-python switch from goto_definitions to goto_assignments.
I think giving a setting option to choose between goto_definitions and goto_assignments is a better solution. (I like goto_definitions)
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?
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_request to a single goto_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.
Activity
PeterJCLaw commentedon Mar 13, 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: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?
Varkal commentedon Mar 17, 2018
This reproduce for me on macOS python3.6.
ocavue commentedon Mar 20, 2018
I found something that may help from here
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)brettcannon commentedon 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.ocavue commentedon Mar 21, 2018
Brett Cannon (@brettcannon) you are right. I clone v0.9.0 Jedi and everything is fine. Thanks to
python.jediPathsetting.PeterJCLaw commentedon Mar 21, 2018
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 commentedon Apr 5, 2018
Good news!
P.S. I am still on version 2018.1.0 and wait fix
PeterJCLaw commentedon Apr 6, 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).brettcannon commentedon Apr 9, 2018
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.
PeterJCLaw commentedon Apr 17, 2018
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.
brettcannon commentedon Apr 18, 2018
Peter Law (@PeterJCLaw) it's open source; you were trying to do a kindness and you simply couldn't get to it. No worries. 😄
Add tests for current cases
Make navigation to definitions follow imports
Ensure navigation to definitons follows imports and is transparent to…