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

eldoc for Python includes 'self' argument #1066

Closed
piojanu opened this issue Jul 17, 2018 · 7 comments
Closed

eldoc for Python includes 'self' argument #1066

piojanu opened this issue Jul 17, 2018 · 7 comments

Comments

@piojanu
Copy link

piojanu commented Jul 17, 2018

Hi!

I've just started using ycmd and I see that ycmd eldoc for python includes 'self' argument in its print to echo area while hovering over class method. It's unwanted as indication in bold of which argument we are currently typing is shifter to left by one (as you all know, you don't pass self argument explicitly).

You can see it in here:
screen shot 2018-07-16 at 18 21 59

It feels like it's a bug. Can I change it somehow to not to include it? anaconda-mode-eldoc was showing it just fine, but I moved from it as I need something with multi-language support.

Thanks for your time!

@bstaletic
Copy link
Collaborator

I'm not sure what "eldoc" is, but it's not a part of ycmd. Ycmd doesn't echo a function's signature to the command line. What YouCompleteMe does do is open a preview buffer in order to display such information.

@puremourning
Copy link
Member

I suspect you need to raise this with emacs-ycmd

@piojanu
Copy link
Author

piojanu commented Jul 17, 2018

@puremourning That's what I did (see reference two positions above), they told me that they print function signature they get from server, so it might be a fix on server-side. If you deny that, I'll come back to them.

@bstaletic
Copy link
Collaborator

Alright, this is actually what I've ran into when I tried to hack snippet epansion of function signatures in YCM.

What ycmd is doing is:

  • Issuing a /completions request to Jedi.
  • Taking the 'completions' part of the response.
  • Iterating over the completions list and generating the completions like this:
    • Jedi completion['name'] becomes ycmd insertion_text
    • Jedi completion['description'] becomes ycmd extra_menu_info.
    • Jedi completion['docstring'] becomes ycmd detailed_info (the one I parsed for thte snippets).
    • Possibly some extra_data is simply passed through.

So ycmd isn't doing any processing of what jedi sends, rather ycmd just repacks the data into its own format.

@piojanu
Copy link
Author

piojanu commented Jul 18, 2018

And do you think this kind of processing could/should be done on ycmd side or rather client side? Where is it easier and fits better?

@bstaletic
Copy link
Collaborator

That's an interesting question, because it depends on the use case.

  • Are you just echoing the function signature? The formal signature includes self (echodoc plugin, I think).
  • Are you hinting the current parameter? self will be annoying (eldoc).
  • Are you presenting all overloads in a preview buffer? Once again, formal signature includes self (YouCompleteMe and vim preview window).
  • Are you trying to do some snippet expansion based on function signature to provide argument hinting? self will be annoying (my own work).

The server has no idea about the intended use case, but parsing a string that contains the full signature and maybe the docs is hard. Instead we should definitely make a better API.
That brings us to #664, which was never finished for whatever reason.

@micbou
Copy link
Collaborator

micbou commented Jul 23, 2018

Closing in favor of #121.

@micbou micbou closed this as completed Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants