Autocomplete: Expose Jedi signature to frontends
This adds support for function signatures introduced in https://github.com/ipython/ipython/pull/10507 so we can try them in other frontends.
/cc @Carreau
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 label which includes both the name of the function and the arguments. I think that returning text + signature and calling it label is a more future-proof approach as compared to using right_label.
While LSP does use signature in other contexts, this is definitely a completion label; also thinking about other uses of completer which modify the already entered text which is already possible with IPython - e.g. the LaTeX symbols completions, pre-pending text on the left would not be unexpected for me. Think about a user trying to complete sqrt but they have not imported it but they have math available - in that case the label could be math.sqrt(x) (and the text would be math.sqrt with adjusted start/end coordinates). How does that sound?
Edit: Also, JupyterLab is ready to receive label (well, we will need to actually pass it, but the current interface does separate label from insertText so we can easily adopt the label from this PR).