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

YCM should query Vim's omnicomplete system if available #3

Closed
romainl opened this issue Feb 1, 2013 · 11 comments
Closed

YCM should query Vim's omnicomplete system if available #3

romainl opened this issue Feb 1, 2013 · 11 comments

Comments

@romainl
Copy link

romainl commented Feb 1, 2013

Currently, YCM seems to only support keyword completion for languages outside the C Family (tested with PHP, JS, CSS and Python). While this completion mechanism may have its merits it is quite dumb. Omni completion generally provides much more useful suggestions. You can compare these two screenshots to get an idea…

YCM:
image 2013-02-01 a 23 14 19
Omni completion:
image 2013-02-01 a 23 14 27

Additionally, the message in the command-line says "User defined completion" but :set completefunc=javascriptcomplete#CompleteJS (tested to work with <C-x><C-u>) doesn't seem to have any effect whatsoever: only keyword completion is used.

Thanks for your attention.

@Valloric
Copy link
Member

Valloric commented Feb 1, 2013

Yes, I am aware of this; this is why YCM provides an internal Completer API so that semantic completers for other languages can be written.

A generic semantic completer that queries Vim's omni-completion engine but provides YCM's fuzzy filtering and sorting will probably be built.

YCM is barely 1.0 at this point and hopefully will provide great semantic completion for many languages. If you wish to implement some of them, I'd be happy to merge such pull requests.

Thanks for your comments!

@jbeja
Copy link

jbeja commented Feb 5, 2013

Yeah that engine would be the "money maker" for this plugin.

@seletskiy
Copy link
Contributor

@Valloric It there some hacking guide on how to start implementing own completer? I'm thinking of contribute, but I don't see much info.

@Valloric
Copy link
Member

Valloric commented Feb 5, 2013

@seletskiy Those are docs I've yet to write, but it's coming. :)

For now, take a look in the completer.py file. That's basically the API that a Completer subclass needs to implement. See how the clang_completer.py file does it.

Let's say you want to write a completer for PHP. You'd create a php folder under the completers folder. You'd write a small hook.py file and put in in that folder (see how the other hook.py files look, they're like 3 lines of code). Then you'd create a php_completer.py file in your folder and write your completer.

There's still no easy way to have YCM do the sorting and filtering for you, but tomorrow I'll add a function that when provided with a list of completion strings and a user query will returned a filtered and sorted list back.

@seletskiy
Copy link
Contributor

@Valloric Thanks! I'm will try to dig in soon...

@Valloric
Copy link
Member

This is now officially implemented as of commit dbad91e! See the updated docs for details, but in short, YCM now uses Vim's omnicomplete data to provide semantic completions for every language Vim has omnicomplete support for.

@tex
Copy link

tex commented May 15, 2013

@Valloric I'm using it with vimerl, it registers the completefunc and I think YCM uses it correctly when it is automaticaly fired. But then when typing it stops using the completefunc results and switches to fuzzy completion. What I want YCM to do is to continue using only results from completefunc because only that results are semanticaly correct here.

ycm1
ycm2

@Valloric
Copy link
Member

I'm using it with vimerl, it registers the completefunc

It needs to register the omnifunc, not the completefunc. It's also possible you need to add : as a semantic trigger for your language if you haven't already.

@tex
Copy link

tex commented May 16, 2013

Sorry, my mistake, it is omnifunc that is set (to erlang_complete#Complete), not the completefunc. Semantic trigger is also set to ':'.

@bullno1
Copy link

bullno1 commented Jan 12, 2014

@tex I'm having the same problem. Did you manage to fix it?

@tex
Copy link

tex commented Jan 12, 2014

No I didn't. Just gave up. Sorry.

Grimy pushed a commit to Grimy/YouCompleteMe that referenced this issue Dec 22, 2014
Add infolog to default filetype blacklist.
@hardboydu hardboydu mentioned this issue Jul 4, 2016
limbolily pushed a commit to limbolily/YouCompleteMe that referenced this issue Aug 9, 2016
limbolily pushed a commit to limbolily/YouCompleteMe that referenced this issue Aug 9, 2016
Also added explicit check for it, since the dependency is non-obvious (see ycm-core#3).
limbolily pushed a commit to limbolily/YouCompleteMe that referenced this issue Aug 9, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants