Help with setup/configs in PHP projects

549 views
Skip to first unread message

Tárcio Zemel

unread,
Jul 25, 2013, 9:16:00 AM7/25/13
to ycm-...@googlegroups.com

Hi, folks! I'm kind of new in Vim (just a few months of use) and I would to ask for your help about correctly configure YCM to work in PHP projects (I manual compile Vim 7.3.584 just to use YCM, btw). Basically, my doubts are about autocomplete class elements and GoToDefinitionElseDeclaration feature.

I made a test: create some variables inside a class and, inside a function, tryed to use $this-> and self::. Theoretically, YCM shouldn't autocomplete the class vars (and functions)? But it not happen and the options showed are relative to things outside the class.

Also, I didn't understand very well the purposes and what to do about that .ycm_extra_conf.py file. It's necessary to the GoToDefinitionElseDeclaration feature?

The most awkward: in insert mode, if I'm inside a class, function or whatever, if I press arrow up or arrow down, thepumvisible() ? "\pumvisible" : "\ text is inserted...

I hope you can help me with this, probably it's also the doubt of many others wanting to use YCM in PHP projects. :-)

Regards!

Val Markovic

unread,
Jul 25, 2013, 7:54:16 PM7/25/13
to Tárcio Zemel, ycm-...@googlegroups.com
On Thu, Jul 25, 2013 at 6:16 AM, Tárcio Zemel <tarci...@gmail.com> wrote:

Hi, folks! I'm kind of new in Vim (just a few months of use) and I would to ask for your help about correctly configure YCM to work in PHP projects (I manual compile Vim 7.3.584 just to use YCM, btw). Basically, my doubts are about autocomplete class elements and GoToDefinitionElseDeclaration feature.

 There's no GoTo* support for PHP since YCM does not have a custom completer for PHP but falls back on Vim's omnifunc. The docs mention this.

I made a test: create some variables inside a class and, inside a function, tryed to use $this-> and self::. Theoretically, YCM shouldn't autocomplete the class vars (and functions)? But it not happen and the options showed are relative to things outside the class.

Also, I didn't understand very well the purposes and what to do about that .ycm_extra_conf.py file. It's necessary to the GoToDefinitionElseDeclaration feature?

 ycm_extra_conf.py is relevant only to people who write C-family code.

The most awkward: in insert mode, if I'm inside a class, function or whatever, if I press arrow up or arrow down, thepumvisible() ? "\pumvisible" : "\ text is inserted...

That sounds like a bad interaction with one of your other Vim plugins. 

I hope you can help me with this, probably it's also the doubt of many others wanting to use YCM in PHP projects. :-)

Regards!

--
You received this message because you are subscribed to the Google Groups "ycm-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ycm-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ycm-users/34d750cb-612f-42a1-99eb-54728fd2abd6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tárcio Zemel

unread,
Jul 25, 2013, 10:37:24 PM7/25/13
to ycm-...@googlegroups.com, Tárcio Zemel
Thank you for the answers, Val!

About that pumvisible() ? "\pumvisible" : "\, indeed was a conflict, but I already removed that plugin, so it's OK.

So, according your explanations, there's no way to YCM autocomplete $this-> and self:: in PHP files with the respectives properties and methods or there's something I can do to accomplish that?

In other words: YCM it's not the best option to work and autocomplete in PHP projects?

Regards!

Chiel ten Brinke

unread,
Jul 26, 2013, 4:11:53 AM7/26/13
to ycm-...@googlegroups.com, Tárcio Zemel
To use YCM with advanced PHP support, a semantic completer has to be written.
Someone here asked about the same question: https://github.com/Valloric/YouCompleteMe/issues/443

Tárcio Zemel

unread,
Jul 26, 2013, 8:55:25 AM7/26/13
to ycm-...@googlegroups.com, Tárcio Zemel
Well, this answer my doubt: no YCM with PHP, after all...

Regards!

Val Markovic

unread,
Jul 26, 2013, 12:42:03 PM7/26/13
to Tárcio Zemel, ycm-...@googlegroups.com
On Fri, Jul 26, 2013 at 5:55 AM, Tárcio Zemel <tarci...@gmail.com> wrote:
Well, this answer my doubt: no YCM with PHP, after all...

This is incorrect; like I said previously, you can set up Eclim which will bring an excellent omnifunc for PHP and then configure it to work with YCM (see the YCM docs for details). Even without Eclim, YCM's identifier completer works great in PHP files (and any other files since it's language agnostic). It's not a semantic completer, but it's pretty good.
 

Tárcio Zemel

unread,
Jul 26, 2013, 11:06:24 PM7/26/13
to ycm-...@googlegroups.com, Tárcio Zemel
I instaled Eclim and, indeed, together with YCM, it's the best choise for autocomplete in Vim!

Tárcio Zemel

unread,
Jul 26, 2013, 11:19:59 PM7/26/13
to ycm-...@googlegroups.com, Tárcio Zemel
As as said before, Eclim + YCM it's awesome!

Just one thing: the autocomplete for functions e properties of classes and objects it's great, but, after reinstall YCM after Eclim was already working, the autocomplete for native PHP functions stoped (neither automaticaly nor pressing <C-Space>). There's something I can do?

Regards!

Val Markovic

unread,
Jul 27, 2013, 12:11:38 AM7/27/13
to Tárcio Zemel, ycm-...@googlegroups.com
On Fri, Jul 26, 2013 at 8:19 PM, Tárcio Zemel <tarci...@gmail.com> wrote:
As as said before, Eclim + YCM it's awesome!

Just one thing: the autocomplete for functions e properties of classes and objects it's great, but, after reinstall YCM after Eclim was already working, the autocomplete for native PHP functions stoped (neither automaticaly nor pressing <C-Space>). There's something I can do?

You didn't read through the YCM docs on configuring Eclim. It has the answers you seek: you need to toggle an Eclim option to have YCM and Eclim play nice together.
 

Tárcio Zemel

unread,
Jul 27, 2013, 12:33:47 AM7/27/13
to ycm-...@googlegroups.com, Tárcio Zemel
I read all my friend. I put that config in my .vimrc and I have Eclim and YCM run smoothly.  :-)

But I haven't the PHP native functions autocomplete, anyway...

Andrea Cedraro

unread,
Aug 7, 2013, 8:30:04 AM8/7/13
to ycm-...@googlegroups.com, Tárcio Zemel
Does it work in eclipse?

Tárcio Zemel

unread,
Aug 7, 2013, 9:47:18 AM8/7/13
to ycm-...@googlegroups.com, Tárcio Zemel
Pretty much!

And I learned a thing: when the native PHP functions is not appearing on type, you just use <C-Space> and everything back to work!

Juan Pedro Fisanotti

unread,
Oct 21, 2013, 1:53:54 PM10/21/13
to ycm-...@googlegroups.com, Tárcio Zemel
On Thursday, July 25, 2013 11:37:24 PM UTC-3, Tárcio Zemel wrote:
Thank you for the answers, Val!

About that pumvisible() ? "\pumvisible" : "\, indeed was a conflict, but I already removed that plugin, so it's OK.

I'm having the same issue, and I have a ton of plugins on my config. Can you tell me which plugin was the conflicting one in your case?

Regards!

fisa  -  Juan Pedro Fisanotti 

Luna

unread,
Oct 17, 2015, 8:57:46 PM10/17/15
to ycm-users, tarci...@gmail.com
Just as a reference to anyone who comes across this with the same issue,  I found that the plugin Townk/vim-autoclose was causing the conflict. This plugin is old and hasn't been updated in a while and causes quite a few other conflicts.
I removed it and used Raimondi/delimitMate instead. 

Lokesh sanapalli

unread,
Feb 1, 2017, 12:54:17 PM2/1/17
to ycm-users, tarci...@gmail.com
Hey,

You just saved my life... thanks a ton...
Reply all
Reply to author
Forward
0 new messages