Exuberant ctags is great, but it has not kept up with changes to PHP. Ideally, if we want to compete with commercial products, our code completion and navigation should be

  • aware of OO inheritance
  • smart about {@inheritdoc}
  • aware of PSR-0 and PSR-4

If it lives up to its promise, then Universal ctags should be an improvement over exuberant ctags, and a pretty easy switch.

A more complete solution is Padawan, assuming it works.

Comments

benjifisher created an issue.

cweagans’s picture

This is something that I've been meaning to tackle for a while. I started working on something like this a while back - https://github.com/cweagans/theforce. It's nowhere near complete, but I haven't had the time or motivation to work on it lately. Padawan is decent, but it requires some configuration to make it work in some cases.

I think https://github.com/felixfbecker/php-language-server is what you're looking for if you want something beyond what ctags can provide. In addition to completion, it should be able to provide Go To Definition, Refactoring, and other functionality (see the gifs on the project page for how it works in vscode). It's a standalone server that uses the language server protocol, which is fairly widespread at this point (see http://langserver.org/ for details), and there's a lot of work in that direction already from the Neovim community (https://github.com/tjdevries/nvim-langserver-shim). As far as I know, that nvim-langserver-shim plugin also works in vim, but I haven't tried it. There's also https://github.com/roxma/nvim-cm-php-language-server, which is a plugin for https://github.com/roxma/nvim-completion-manager, which is Neovim specific.

Another option is codeintel, which is the code indexing feature from Komodo Edit/Komodo IDE (https://pypi.python.org/pypi/CodeIntel). This is what SublimeCodeIntel uses for indexing. Frankly, I'm not convinced this is a good option, but leaving it here for the sake of completeness.

Yet another option is Eclim.

Finally, there is https://github.com/php-integrator/core, which is the code intelligence server that powers the PHP Integrator suite of plugins for Atom. I'm assuming that it's fairly powerful based on skimming the code, but I wasn't able to actually get the Atom plugins to work properly, so I'm not 100% sure.

benjifisher’s picture

It was pretty easy to add support for Universal ctags: see #2902266: Support for Universal Ctags.

Thanks @cweagans for contributing PHP support to that project.

We should still consider the other options mentioned in Comment #2.

cweagans’s picture

Just to clarify, I'm not responsible for the new PHP parser. The initial rewrite was here: https://sourceforge.net/p/ctags/patches/83/, and there have been other improvements since then.

For what it's worth, the Language Server ecosystem seems to be the direction that everything is heading these days. Neovim is in the process of adding language server support in Neovim proper, vscode uses it extensively, and there are a number of plugins for various editors that add support.