ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.44k stars 2.81k forks source link

Add smart PHP code completion #443

Closed cweagans closed 11 years ago

cweagans commented 11 years ago

I'm not even sure how to approach this, but for PHP developers, the choices look something like this:

1) Use a lightweight text editor with no code completion (or basic per-buffer word completion); or 2) Use a bloated IDE that has a code completion engine that locks up your machine for a few minutes while it indexes things.

This is not a good situation, and I think that YCM has a great opportunity to change it (since there's a plan to make the completion engine a standalone daemon, if I read the other issue correctly). If YCM gains support for smart completion of PHP, I could write a plugin for Sublime Text, Textmate, etc to connect to the completion engine.

As for the how...I'm not sure. I haven't seen anything like Jedi for PHP. The closest I've seen is the CodeIntel bits from OpenKomodo. Those are okay, but the indexing is still a pretty resource intensive operation. I'm not sure if the PHP interpreter has some kind of interactive mode or something where you can connect to it from another process and use it to see what classes/functions/etc exist in the current context or something.

Any ideas? I'd love to help with this if it's at all possible (or desirable).

Valloric commented 11 years ago

YCM connects semantic language engines others have built (libclang, Jedi, OmniSharp etc... Tern.js probably soon too) and presents a unified interface to Vim.

Building the semantic engines directly is not within the scope of the YCM project. If you have a recommendation for a good PHP semantic engines YCM can connect to, I'd love to hear about it. I'm not a PHP user so it's unlikely I'd write a custom completer for it. I recommend you create a pull request implementing support for some PHP engine if you wish this use case supported; the docs cover this use case quite well. The Jedi completion source was contributed by external developers and the OmniSharp support is on its way to being merged in too.

cweagans commented 11 years ago

Ah, I see. I'll see what I can find. Thanks!

blueyed commented 11 years ago

@cweagans using eclim works quite well for me. It is based on Eclipse though, and therefore not really lightweight. See the docs, which cover setting up Eclim.

cweagans commented 11 years ago

I'm going to work on splitting https://github.com/SublimeCodeIntel/SublimeCodeIntel/tree/master/libs/codeintel2 out into a standalone project, so maybe that will help here :)

cweagans commented 9 years ago

For anyone subscribed to this issue, you might be interested in https://github.com/Valloric/ycmd/pull/120