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

Any plans to integrate into YouCompleteMe's Completer API? #13

Closed
svermeulen opened this issue Apr 7, 2013 · 37 comments
Closed

Any plans to integrate into YouCompleteMe's Completer API? #13

svermeulen opened this issue Apr 7, 2013 · 37 comments

Comments

@svermeulen
Copy link
Contributor

It currently works nicely with YouCompleteMe (via omnifunc) but from the YCM docs it sounds like there are advantages to using their API.

@nosami
Copy link
Contributor

nosami commented Apr 7, 2013

Not any plans at the moment but maybe in the future. I've been shying away from using a custom build of Vim on windows because of a regression that crept in recently without me realising. I'm sticking to the stock download which is Vim 7.3 with patches 1-46 currently.

I've been playing around with a slightly modified AutoComplPopup plugin which is working ok for me.

What advantages are there to using their API?

@chtenb
Copy link
Contributor

chtenb commented Apr 8, 2013

Hey there,

I wanted to ask the exact same question, as I planned to implement a completer for YCM for C#. However, when I asked around in the NRefactory repo about the completer API, I was pointed to this project. So to avoid doing unnecessary work, I too would ask you to consider integrating into YCM. I'm willing to help if that's necessary.

Let me first try to answer your question regarding advantages in using YCM's API. The advantages of using YCM's API that are currently mentioned on the site are the following:

  • You have to use VimScript to write the omnifunc, but get to use Python to write for the Completer API; this by itself should make you want to use the API.
  • The Completer API is a much more powerful way to integrate with YCM and it provides a wider set of features. For instance, you can make your Completer query your semantic back-end in an asynchronous fashion, thus not blocking Vim's GUI thread while your completion system is processing stuff. This is impossible with VimScript. All of YCM's completers use the Completer API.
  • Performance with the Completer API is better since Python executes faster than VimScript.

In addition to this, it says: "If you want to upstream your completer into YCM's source, you should use the Completer API." You might wonder why you would want to upstream the C# completer into YCM. Let me try to state some of the advantages that come to my mind right now.

  • YCM is getting more and more popular and seems to grow into a strong completion engine for vim. To integrate the C# completer into it makes it very likely to get used a lot. C# programmers wouldn't have to crawl the internet looking for a single plugin that enables C# completion.
  • It makes it trivial to install C# completion for ycm users, since it comes with YCM. It's nice and clean to have all your completion stuff in a single plugin.
  • It is more likely to get help in developing, again because more people will use it.

I understand it is currently a bit more work to install ycm, since it requires a newer version of vim than is currently available as a download package. But keep in mind that that's just a temporal thing.

@nosami
Copy link
Contributor

nosami commented Apr 8, 2013

OK. I'm sold. The asynchronous completions won it for me. I have a stack of other things that I'd like to see get done first though that are not autocomplete related.

I'd be more than happy if you could do it. I need all the help I can get to be honest! If not, I'll get around to it sometime. It sounds like it would be a compelling feature for a lot of people. I'm not against the feature requiring a newer version of vim to use, so long as current functionality isn't broken for users wishing to stick with a stock vim.

Thanks.

@chtenb
Copy link
Contributor

chtenb commented Apr 23, 2013

I'm unexpectedly very busy at the moment, so it will not be able to do some work for a while. Just to inform :)
I'd like to mention as well that YCM made a few improvements today, with filename completion and ultisnips support.

@chtenb
Copy link
Contributor

chtenb commented Apr 29, 2013

I've got something working. However, the scope is not correctly recognized. Only top-level completions are offered. Do you know what I'm doing wrong?

The relevant file can be found here: https://github.com/Chiel92/YouCompleteMe/blob/master/python/completers/cs/cs_completer.py
The function SetCandidates is the only one that matters.

@nosami
Copy link
Contributor

nosami commented Apr 29, 2013

My guess would be that you need to set parameters['wordToComplete']. This should be set to the current letters that are to be completed. For example, if you had

Console.Wri

then parameters['wordToComplete'] should equal 'Wri'.

Good luck!

@chtenb
Copy link
Contributor

chtenb commented Apr 30, 2013

YCM handles the partial word stuff, so we don't have to send it.
The problem appeared to be a difference in offset. I needed to add 1 to both the line and the column, before sending the info to the Omnisharp server. Glad that I got it working now. :)

What to do next? I would like to do a pull request to YCM, but before doing that we have to make sure that installing and starting the omnisharp server is neat and easy. I saw something about starting omnisharp from within vim on the todo list. Is there any progression on that?

@nosami
Copy link
Contributor

nosami commented Apr 30, 2013

I'm glad you got it working, well done! There are performance benefits to sending the partial word to OmniSharp though. We don't need to fetch the XML documentation for completions that don't need to be returned. I guess YCM is filtering later on.

No progress made on starting OmniSharp from within Vim... but it should be trivial. I was thinking of just scanning upwards through the folders from the the current source file until the solution was found and just start that one (assuming that there is only one solution file). If more than one was found, then we'd have to prompt the user.

@chtenb
Copy link
Contributor

chtenb commented Apr 30, 2013

Yep, I was thinking of the latter too. For your information, this issue may be of your interest: ycm-core/YouCompleteMe#207

About the partial word; YCM uses a fuzzy search algorithm. That's why it wants to do the filtering by itself. I do not experience any performance problems at the moment. If that changes, this may have to be reconsidered though.

@nosami
Copy link
Contributor

nosami commented Apr 30, 2013

OmniSharp has fuzzy searching built in now too. You won't experience any degradation at the moment I guess as the Documentation completion isn't working yet on Linux. That's on my TODO list :)
I guess you would see it if you were using Windows.

@nosami
Copy link
Contributor

nosami commented May 4, 2013

I'm home now (only home at weekends) and I just tried your YouCompleteMe completer plugin on my Linux box. That's seriously cool!

@chtenb
Copy link
Contributor

chtenb commented May 4, 2013

It works pretty well indeed :) Especially together with the ultisnips plugin.

@nosami
Copy link
Contributor

nosami commented May 7, 2013

I made a start on starting OmniSharp within Vim last night. Nearly done, but not ready to commit yet. Should be in tomorrow night sometime.

@nosami
Copy link
Contributor

nosami commented May 9, 2013

I just got your YouCompleteMe plugin working on Windows. Description and DisplayText are essentially the wrong way around.

image

@chtenb
Copy link
Contributor

chtenb commented May 9, 2013

Thanks for pointing that out! For me (on linux) it is different though, since I only see the "short version" in both places.

@vito-c
Copy link

vito-c commented May 12, 2013

👍 for YCM integration is this already in master or is there a place I can test it out? =B

@nosami
Copy link
Contributor

nosami commented May 12, 2013

@vito-c You can use OmniSharp master combined with @Chiel92's YCM fork here https://github.com/Chiel92/YouCompleteMe. If you already have YCM installed, you should just be able to copy the YouCompleteMe / python / completers / cs folder from Chiel92's repo.

@nosami
Copy link
Contributor

nosami commented May 16, 2013

Just made a tweak to Omnisharp to pass in the return types so that it looks more like you had it before. Looking pretty sweet now.

image

@chtenb
Copy link
Contributor

chtenb commented May 16, 2013

Nice :)

@nosami
Copy link
Contributor

nosami commented May 21, 2013

@Chiel92 Anything else I need to do for this?

@chtenb
Copy link
Contributor

chtenb commented May 21, 2013

I guess we're almost done. What about the options I proposed in #24?
That would make omnisharp really work out of the box, and user friendly for YCM-users who want to add C# completion to YCM.
Apart from that, I think Omnisharp is pretty much ready to be officially integrated into YCM. I will request a pull very soon.

@chtenb
Copy link
Contributor

chtenb commented Jun 4, 2013

I just rewrote the ycm completer to fit in the new api, because I want to do a PR.
Can you have a quick run to see if it works for you as well? (Please, re-clone my fork, because I started from scratch again in a new fresh fork.)

For me, it looks like this now. Is that correct?
screenshot from 2013-06-04 12 20 21

@nosami
Copy link
Contributor

nosami commented Jun 4, 2013

Don't have access to my linux vm right now... but that doesn't look right. Doesn't look like you have the monodoc documentation.

@chtenb
Copy link
Contributor

chtenb commented Jun 4, 2013

That's weird, since I'm sure I have your latest revision.
BTW, I meant to ask if you could verify if it works on windows.

@nosami
Copy link
Contributor

nosami commented Jun 4, 2013

I looked at your code and Description and DisplayText are the wrong way around again. I think I should have named those better. They make more sense the other way around :) When I get a minute I think I'll switch those over at my end (or take a pull request ;) ).

I'm at work right now, so can't test this. I might get some time tomorrow evening.

@chtenb
Copy link
Contributor

chtenb commented Jun 4, 2013

Indeed they are the other way around again :) But still no documentation in either of them, right?

@nosami
Copy link
Contributor

nosami commented Jun 4, 2013

You should see documentation

2013-06-04-100008_1205x641_scrot

@chtenb
Copy link
Contributor

chtenb commented Jun 4, 2013

I swapped the displaytext and the description in the correct order again. No docs though.
Should we first try to fix this, or should I request a pull to YCM already?

@nosami
Copy link
Contributor

nosami commented Jun 4, 2013

Does it work for you without YCM?

@chtenb
Copy link
Contributor

chtenb commented Jun 4, 2013

Neither without YCM. I uninstalled YCM, and triggered the omnicompleter with <C-X><C-O> but that yields the same results.

@nosami
Copy link
Contributor

nosami commented Jun 4, 2013

Strange. You had it working previously, right? The code hasn't changed around this. Do you have monodoc installed at /usr/lib/monodoc? I also noticed that you only have one parse method, whereas I have 4 overloaded methods. (I used <c-x><c-o>

@chtenb
Copy link
Contributor

chtenb commented Jun 4, 2013

When I tested your justed implemented monodoc support, I indeed believe to saw more then I do now. But I believe to remember many entries didn't have docs. Not sure, since I tested really briefly.

I can confirm to have monodoc in /usr/lib/monodoc.

@nosami
Copy link
Contributor

nosami commented Jun 4, 2013

Well, many entries don't have documentation, but int.MaxValue isn't one of
them.

@nosami
Copy link
Contributor

nosami commented Jun 7, 2013

Monodoc didn't work for me either after a fresh checkout. Turns out that the server submodule was pointing to the wrong commit. Git submodules suck :) It should work now. If it doesn't do a git checkout master on the server and try rebuilding.

@chtenb
Copy link
Contributor

chtenb commented Jun 8, 2013

I did a PR: ycm-core/YouCompleteMe#365

@nosami
Copy link
Contributor

nosami commented Jun 9, 2013

Hope they accept it!

@nosami
Copy link
Contributor

nosami commented Jul 18, 2013

Closing. Good job @Chiel92 :)

@nosami nosami closed this as completed Jul 18, 2013
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