Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get vim omnicompletion to support php class methods using ::

Using vim + php + ctags I can get fairly good php auto-completion. But one part really eludes me: getting vim to auto-complete class methods. Here's an example:

The full method is

CVarDumper::dumpAsString

And I want it to complete if I type this:

CVarDumper::d<tab>

The double-colon does not work. However, if I replace the :: with a . then it does autocomplete:

CVarDumper.d<tab>

I see the c++ omnifunc function has an option to allow for :: completion:

let OmniCpp_MayCompleteScope = 1 " autocomplete after ::

Is there an equivalent for the ft-php-omni function, or a way to hack this feature in?


Update:

Turns out the problem was the supertab plugin, specifically this option in my .vimrc

" SuperTab option for context aware completion                                                                          
let g:SuperTabDefaultCompletionType = "context"

After removing that option supertab + phpcomplete allows for completion of php class methods.

like image 569
Jonathan Beebe Avatar asked Nov 03 '22 11:11

Jonathan Beebe


1 Answers

Try this alternative phpcomplete script. It is better than the default one in every possible ways, including the fact that it supports static completion.

like image 185
romainl Avatar answered Nov 12 '22 13:11

romainl