-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
Autocomplete: Expose Jedi signature to frontends #249
base: main
Are you sure you want to change the base?
Conversation
ipykernel/ipkernel.py
Outdated
comps = [] | ||
for comp in completions: | ||
comps.append(dict( | ||
start=comp.start, | ||
end=comp.end, | ||
text=comp.text, | ||
type=comp.type, | ||
signature=getattr(comp, 'signature', '') |
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.
Depending on the IPython version, completions may or may not return the function signature. Therefor I used getattr
to make sure we stay compatible.
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.
+1, one thing I was thinking about is to give that a name more generic name (right_extra
?) to see how that would extend to other languages. I can't really think of any language where signature is on the left, or maybe language that have operators
would want to send extra text to display on the left and right ? and call that extra_left
and extra_right
?
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.
Good Point! signature
probably only makes sense in case of functions.
Atom's autocomplete-plus uses the terms rightLabel
and leftLabel
so right_label
would be another option.
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.
I'm always happy to copy something that already exists, so +1 to right_label
Hey there @lgeiger. I'm going through old issues and it seems this one stalled. I've just rebased and changed the generic 'signature' to a 'right_label' as per discussion above. Do you still have cycles to push forward on this? Either way is fine, I think we just need to document the change before merging, so others can know they can start using this. So that would be the next step (unless, of course, I've missed something entirely and this has been superseded by another avenue of transmitting signatures). |
Python 3.9 test failed here, but in a weird timeout - so I'm just gonna try running it again. |
Note: LSP uses just While LSP does use Edit: Also, JupyterLab is ready to receive |
This adds support for function signatures introduced in ipython/ipython#10507 so we can try them in other frontends.
/cc @Carreau