-
Notifications
You must be signed in to change notification settings - Fork 0
Remove deprecated calls for Jedi >= 0.16.0 #1
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
Conversation
* Fix hover request for numpy alias (np) and ufuncs * Change hover test string
Co-authored-by: Benjamin Greiner <[email protected]>
ccordoba12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bnavigator for your help! I left some comments for you.
| positional_args = [param for param in d.params | ||
| sig = d.get_signatures() | ||
| if (include_params and sig and not is_exception_class(d.name)): | ||
| positional_args = [param for param in sig[0].params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you taking here only the first signature? Also, could you provide an example of an object with multiple signatures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because PyLS expects only one for completion, but the newer Jedi provides a list of signatures.
https://jedi.readthedocs.io/en/latest/docs/api.html#jedi.Script.get_signatures
I am pretty sure there are cases with multiple signatures for a completion.
https://jedi.readthedocs.io/en/latest/docs/api-classes.html#jedi.api.classes.BaseName.get_signatures
def get_signatures(self):
"""
Returns all potential signatures for a function or a class. Multiple
signatures are typical if you use Python stubs with ``@overload``.
:rtype: list of :class:`BaseSignature`
"""
return [
BaseSignature(self._inference_state, s)
for s in self._get_signatures()
]
| params = ', '.join([param.name for param in definition.params]) | ||
| sig = definition.get_signatures() | ||
| if definition.type in ('function', 'method') and sig: | ||
| params = ', '.join([param.name for param in sig[0].params]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here, why sig[0]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
| script = self.jedi_script() | ||
| return script.get_names(all_scopes=all_scopes, definitions=definitions, | ||
| references=references) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you ditch environment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because environment is already pulled from the configuration in self.jedi_script() and is passed to the jedi.Script() constructor there. The .get_names() method does not have an environment parameter.
|
Jedi 0.17.0 came out and bbfcce1 is an intermediate commit. This is still WIP, as stated in palantir#744 |
|
Rebased and completed. See palantir#744 (comment) |
Signed-off-by: Morten Linderud <[email protected]>
fix path and project parameters for jedi_script remove deprecated usages() calls
source is deprecated in 0.17.0 in favor of code but code did not exist in 0.16.0
sometimes jedi reports some keywords first
|
I reused the same branch for palantir#781 and after the rebase this does not merge into 755 anymore. closing. |
Further work on palantir#775 which helped me for the OpenSUSE package (where Jedi has a version 55 commits after 0.16.0)