Skip to content
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

Document popup size and content #166

Closed
petrux opened this issue Nov 27, 2013 · 11 comments
Closed

Document popup size and content #166

petrux opened this issue Nov 27, 2013 · 11 comments
Labels
Milestone

Comments

@petrux
Copy link
Contributor

petrux commented Nov 27, 2013

  1. the first line of the documentation content (which should be the function's signature) isn't displayed in the popup.
  2. the popup should fit better the buffer dimensions

(Emacs 24.3 on Ubuntu 12.04, elpy installed from Marmalade)

docwrongsize

@jorgenschaefer
Copy link
Owner

Good ideas, just tricky to do. The documentation is strictly what Rope (or Jedi) return for the respective method call, so ideally, this would be a fix in upstream in Rope and/or Jedi. Likewise, the popup is done purely by autocomplete, so a fix would need to happen there.

The documentation popup might be doable with http://www.emacswiki.org/emacs/PosTip but I'm not sure how this integrates with auto-complete.

@petrux
Copy link
Contributor Author

petrux commented Nov 28, 2013

About the popup dimension and the buffer size, there is a pull request in popup.el about this issue. I tried to bring it up with a comment. For PosTip: thanks for pointing out, I'll take a look.

For the documentation (w.r.t. the screenshot): if you just type in the python code json.dump(None), then put the cursor over 'dump' and type M-x elpy-doc in the _Python Doc_ buffer you can see the correct text.

@jorgenschaefer
Copy link
Owner

For Rope, the documentation for the completions are from proposal.get_doc() (with proposal being returned by codeassist.code_assist), while C-c C-d gets the documentation from codeassist.get_doc(). I'm not sure why Rope makes a difference there. Maybe proposals have a separate function for the call tip. Hm.

@petrux
Copy link
Contributor Author

petrux commented Nov 28, 2013

Ok, got it. Note that I'm not very into the emacs/rope/jedi/elpy "internals", so the next questions may sound silly but... please, forgive me. :-) So, the first question is: why is documentation supplied by Rope? Shouldn't be jedi (that I use as the backend) to supply the documentation and the completion suggestions? Could you point me the code where the completion popup is filled (or it's not something elpy dependent) so that I can take a look? Thanks.

@jorgenschaefer
Copy link
Owner

Well, if you use Jedi, it's supplied by Jedi. Sorry for the confusion, rope's the default usually :-)

For completions, elpy calls the method rpc_get_completions in the backend class, for Jedi that's found in elpy/backends/jedibackend.py. That returns a list of tuples (two-element lists, really), with the first element the completion and the second the documentation. You can look there if you can coerce Jedi to give more information.

@petrux
Copy link
Contributor Author

petrux commented Nov 28, 2013

No, I was totally wrong!!! Ok, I think I should slow down a little. Question number zero: what kind of Jedi config shall I place in my .emacs file? Because I'm doing some random experiments and it seems that this is messing everything up. Thanks!

@jorgenschaefer
Copy link
Owner

(setq elpy-rpc-backend "jedi") should be all you need to use jedi. Also, not installing rope should use jedi if it's available.

@petrux
Copy link
Contributor Author

petrux commented Nov 30, 2013

I made some tests and I came to this conclusion.
In Rope the documentation for completion is the json.load.__doc__, while the documentation shown is what you have in the REPL typing >>>> help(json.load). The issue is that the first doesn't show the method signature, while this is exactly what one may need in selecting a method among the auto-complete suggestion. Can we study a workaround? I think it would be a real improvement.
In Jedi.el the auto-complete tooltip shows only the method signature.

The only issue I couldn't fix is how to have the arguments in bold one by one in the minibuffer while typing a method invocation in elpy while using jedi.el as the backend. Any suggestion? Thanks.

@jorgenschaefer
Copy link
Owner

You can certainly study a workaround :-)

Highlighting method arguments would likely have to be done in Emacs Lisp, and it's tricky to parse Python from Lisp. If you find a better option, I'd be very interested.

@petrux
Copy link
Contributor Author

petrux commented Nov 30, 2013

I'll try to study a workaround for the Rope backup and I've already suggested Jedi.el author to change the tooltip content.

About the arguments highlighting: it should come for free with jedi.el, as it supply this utility on its own...

@jorgenschaefer
Copy link
Owner

Due to lack of activity, I assume this has been resolved or abandoned. Please do not hesitate to open a new issue (or even a pull request) with further information or ideas, though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants