phpactor / ncm2-phpactor

NCM2 Integration for Phpactor
55 stars 6 forks source link

Default completion is ncm2 #11

Closed fcojavierdomenech closed 5 years ago

fcojavierdomenech commented 5 years ago

I know this is more a missconfiguration than an issue, and I've been looking but I don't know how to fix it. By default I'm getting what I think is the default ncm2 autocompletion (triggered automatically): ncm2completion Then, if I press \<C-x>\<C-o> I get the phpactor source: ncm2completionphpactor How can I set up ncm2 in order to trigger automatically the phpactor suggestions instead of the default ones?

roxma commented 5 years ago

How can I set up ncm2 in order to trigger automatically the phpactor suggestions instead of the default ones?

Remove this plugin.

Read the css example in ncm2 README. You might also need :help ncm2#register_source.

dantleech commented 5 years ago

From the screen shot, this plugin is returning the phpactor suggestions. The omni-complete suggestions are the same? ncm2 does not, by default, complete PHP.

fcojavierdomenech commented 5 years ago

From the screen shot, this plugin is returning the phpactor suggestions. The omni-complete suggestions are the same? ncm2 does not, by default, complete PHP.

The first image is what I think omni-complete, second (pressing \<C-x>\<C-o>) phpactor. The look different despite both are perfectly valid

dantleech commented 5 years ago

Yep that's expected. One is using native VIM omni-complete, the other ncm2 (both are using Phactor underneath)

fcojavierdomenech commented 5 years ago

How can I set up ncm2 in order to trigger automatically the phpactor suggestions instead of the default ones?

Remove this plugin.

Read the css example in ncm2 README. You might also need :help ncm2#register_source.

I removed 'phpactor/ncm2-phpactor', then in my vimrc:

autocmd FileType php setlocal omnifunc=phpactor#Complete

au User Ncm2Plugin call ncm2#register_source({
            \ 'name' : 'php',
            \ 'priority': 9, 
            \ 'subscope_enable': 1,
            \ 'scope': ['php'],
            \ 'mark': 'php',
            \ 'word_pattern': '[\w\-]+',
            \ 'complete_pattern': ['->'],
            \ 'on_complete': ['phpactor#Complete'],
            \ })

And after "$this->" I can see that automatically it's being called, but there is some kind of error:

[ncm2_core@yarp] php on_complete: Vim(call):E119: Not enough arguments for function: phpactor#Complete

Still working well when called through \<C-x>\<C-o>

dantleech commented 5 years ago

Just out of interest, what advantage are you trying to gain here?

fcojavierdomenech commented 5 years ago

mmm I like your plugin and I'm aware you are actively working on it so I'd like to adapt my vim settings as much as possible to it. I saw the completions look different when triggered automatically and manually and I asked here.

fcojavierdomenech commented 5 years ago

With "your plugin" I mean Phpactor of course.

roxma commented 5 years ago

And after "$this->" I can see that automatically it's being called, but there is some kind of error:

It is important to keep the ncm2#on_complete#omni in the on_complete field.

fcojavierdomenech commented 5 years ago

Yep that's expected. One is using native VIM omni-complete, the other ncm2 (both are using Phactor underneath)

Ok, got it; Both are using phpactor but they represent the list in different ways. Thanks