abingham / emacs-ycmd

Emacs client for ycmd, the code completion system.
MIT License
384 stars 46 forks source link

Add support for Ivy completion mechanism #477

Closed piojanu closed 6 years ago

piojanu commented 6 years ago

Hi!

It's just a feature request, I couldn't find anything about it, so I just want to open it as it's really useful thing. When emacs-ycmd receives multiple results from ycmd server it shows it in new window. It would be much much more convenient if it could use tools like Ivy or Helm to list multiple results.

I used both and prefer Ivy (its "lightweight" and fast), so my feature request is for Ivy πŸ˜„

abingham commented 6 years ago

Are you talking about the ycmd-display-completions command? That's not really meant for anything but debugging.

We have a company completion system that works really well. Would that meet your needs?

If not, what are you envisioning with ivy? Would the user request completion at a point and be shown the options in ivy? This could be made to work, but I'll admit that it seems less convenient than company.

piojanu commented 6 years ago

Nope. I use company-ycmd and its great. What I mean is e.g. situation when I command emacs-ycmd to find references and I get multiple results listed in newly created window where I need to hover with cursor exact under list position and then when I hit enter I have it in this new window instead of in the original one where I work. Here is screen shot:

screen shot 2018-07-17 at 16 36 14

What ivy allows is putting it in scrollable list in mini-buffer like in here (this is example from dump-jump):

screen shot 2018-07-17 at 16 37 25

abingham commented 6 years ago

(Sorry for the delay. I'm on vacation and not processing stuff terribly quickly right now.)

Ah, right. This is a good idea. I think where we'd want to look is ycmd--run-completer-command. We could pass a success-handler that uses ivy. I've had good experiences with using ivy via counsel in the past, and that could probably work here.

Are you up for trying to implement something like this?

piojanu commented 6 years ago

Well, I've never written anything in elisp but emacs config and like everyone I don't have time πŸ˜„ But at the same time, I think it's time to pay back to open source community and I would love to try to do this if you think it isn't that hard and you can tell me where should I start πŸ˜‰

abingham commented 6 years ago

I don't think this will be terribly hard. On a certain level you should be able just pattern-match what you already see in ycmd-goto-references. If you follow this thread you'll find yourself in ycmd-completer making a call to ycmd--run-completer-command. This sends a "completer" command to the server and passes the results to a "success handler". I think you'll want to mimic this stack but pass the results to your own ivy-based handler. I know this is a bit hand-wavy, but this is how I would at least start exploring this work.

You should do this work in a separate .el file similar to company-ycmd.el, perhaps ivy-ycmd.el or counsel-ycmd.el.

By all means let me know if you have questions or want me to test things out as you go. I'm far from an elisp expert, but we'll get it working. Thanks for putting in the effort!

piojanu commented 6 years ago

Sory, but I want find time for now. This isn't that critical. You can close this issue for now.

abingham commented 6 years ago

I'll keep it open to keep the idea around. It's a good one.

abingham commented 6 years ago

@piojanu Try this out: https://github.com/abingham/emacs-ivy-ycmd

It exposes the ycmd-goto-references through ivy. It's not complete and needs some polish, but I think this is what you were looking for. Let me know how it works for you.

piojanu commented 6 years ago

Thanks!

Pozdrawiam, Piotr Januszewski

WiadomoΕ›Δ‡ napisana przez Austin Bingham notifications@github.com w dniu 25.07.2018, o godz. 22:39:

@piojanu Try this out: https://github.com/abingham/emacs-ivy-ycmd

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

abingham commented 6 years ago

OK, cool. I'll close this out then. If you feel like contributing a bit to ivy-ycmd you can send PRs there.