-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Update our calls to goto_assignments() for Jedi #1033
Comments
This reproduces for me under Python 2, 3.5 and 3.6 (all virtualenvs on Ubuntu). Notably on importing 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
I guess, vscode-python switch from I think giving a setting option to choose between |
@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 |
@brettcannon you are right. I clone v0.9.0 Jedi and everything is fine. Thanks to |
@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? |
@PeterJCLaw I did not open an issue upstream, no. Are you up for opening one? |
@brettcannon apologies for the delay on this. I've just had a look into this with the aim of understanding it better to report it upstream. My understanding of things is as follows:
Based on all that (plus a hunch based on the name of the argument) I tried changing the value of I am slightly puzzled why we previously had Edit: I've validated that the potentially related https://github.com/DonJayamanne/pythonVSCode/issues/781 and https://github.com/DonJayamanne/pythonVSCode/issues/742 still behave correctly; area there others? |
This fixes microsoft#1033 following the change of behaviour in jedi's `goto_assignments` in the upgrade from 0.9.0 to 0.11.1. The change is assumed to be a bug-fix since it now appears to obey the `follow_imports` boolean for cases which it previously would follow imports even when the value was set to `False`. Since we actually do want to follow imports here, we set the value to `True` to restore the old behaviour.
@davidhalter might have more info on the change, but if we were relying on a buggy feature then changing on our end makes sense. Feel free to send a PR and we can have a look (knowing how this will affect IntelliSense all-up is just plain hard to track). |
I owe you an answer here and in another place. I'll try to follow up ASAP. Hopefully tomorrow. Been quite busy. Sorry. |
IMO you can just use goto_assignments and nothing else. Using it three times just makes it slower. goto_assignments should always return a result. The only thing that might make sense is if you try goto_definitions and then goto_assignments, since in that direction you might have additional results. AFAIK in jedi 0.11.1 there weren't any serious bugs regarding goto_assignments that would make something like the code you wrote necessary. That was probably necessary in 0.9.0 or something else that is a few years old (like 2000 commits ago). You can basically simplify your logic as much as possible after every release and just spam my issue tracker if there's bugs. Currently there's like 5 open bugs that affect jedi users and they are not really a problem, so I'm happy if people report new ones :) |
Thanks for the info @davidhalter ! (And no need to apologize; it's open source and we all have only so much time to contribute.) |
Good news! |
@brettcannon how large a fix would you like to make here? |
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 :) |
@PeterJCLaw it's open source; you were trying to do a kindness and you simply couldn't get to it. No worries. 😄 |
Specifically this covers some basic cases as well as the reproductions of microsoft#1638 and microsoft#1033 plus the variant of microsoft#1033 which always worked.
This fixes microsoft#1638 and simplifies the code (to what I believe that @davidhalter had in mind in microsoft#1033 (comment)). This change means that all of the test cases recently added to 'navigation.tests.ts' now pass, meaning that navigtion to the definition of functions works through imports and goes to the original function, even when that function is decorated.
… decoration (#1712) * Add baseline function definition navigation tests This provides a starting point for more interesting tests. * Add tests for current cases Specifically this covers some basic cases as well as the reproductions of #1638 and #1033 plus the variant of #1033 which always worked. * Make navigation to definitions follow imports This fixes #1638 and simplifies the code (to what I believe that @davidhalter had in mind in #1033 (comment)). This change means that all of the test cases recently added to 'navigation.tests.ts' now pass, meaning that navigtion to the definition of functions works through imports and goes to the original function, even when that function is decorated. * Add news entry for PR * Improve framing of this
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: pass
Foo
, must open a1 file with definition of Foo, but moving cursor to first line with import of FooLogs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
)The text was updated successfully, but these errors were encountered: