Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eclim + context completion type appears broken for PHP #144

Closed
briceburg opened this issue Jan 15, 2015 · 8 comments
Closed

eclim + context completion type appears broken for PHP #144

briceburg opened this issue Jan 15, 2015 · 8 comments

Comments

@briceburg
Copy link

class SiteTree extends DataObject {
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->|
        ...
    }

Invoking SuperTab at the cursor position indicated by | brings up tag omnicompletion <Ctrl-X><Ctrl-O>, where I believe it is supposed to invoke the user completefunc <Ctrl-X><Ctrl-U> provided by Eclim.

The tags are limited, and the completefunc provides my desired autocompletions (methods of SiteTree).

My .vimrc includes

let g:SuperTabDefaultCompletionType = 'context'

Any pointers appreciated!

@briceburg
Copy link
Author

As a quick followup after diffing through the docs;

I was able to bring up the completefunc by setting the ContextDefaultCompletion type to the user completefunc via:

let g:SuperTabDefaultCompletionType = 'context'
let g:SuperTabContextDefaultCompletionType = '<c-x><c-u>'

I setup code completion following the eclim docs;
http://eclim.org/vim/code_completion.html

Do you want me to add the g:SuperTabContextDefaultCompletionType setting to those docs and send a PR? or am I still doing/expecting something wrong? I do notice that supertab will now try to execute the usercompletefunc even if there is not one set -- so probably not an ideal setup.

Thanks as ever for your work.

@ervandew
Copy link
Owner

Invoking SuperTab at the cursor position indicated by | brings up tag omnicompletion <Ctrl-X><Ctrl-O>, where I believe it is supposed to invoke the user completefunc <Ctrl-X><Ctrl-U> provided by Eclim.

It should default to user completion if &completefunc is set, unless you've defined g:SuperTabContextTextOmniPrecedence to put &omnifunc first.

I was able to bring up the completefunc by setting the ContextDefaultCompletion type to the user completefunc via:

let g:SuperTabDefaultCompletionType = 'context'
let g:SuperTabContextDefaultCompletionType = '<c-x><c-u>'

I setup code completion following the eclim docs;
http://eclim.org/vim/code_completion.html

Do you want me to add the g:SuperTabContextDefaultCompletionType setting to those docs and send a PR?

No, that setting is not necessary, and as you've seen, it affects all file types regardless of whether they have user completion support or not, so adding that to the docs would confuse users.

or am I still doing/expecting something wrong?

Can you open your php file and check the following:

:verbose set completefunc?
:echo g:SuperTabContextTextOmniPrecedence
" check the buffer local version
:echo b:SuperTabContextTextOmniPrecedence

@briceburg
Copy link
Author

Interesting, it doesn't seem g:SuperTabContextTextOmniPrecedence is set -- although b: is

:verbose set completefunc?
    completefunc=eclim#php#complete#CodeComplete
    Last set from /usr/share/vim/vimfiles/eclim/ftplugin/php.vim

:echo g:SuperTabContextTextOmniPrecedence
    E121: Undefined variable: g:SuperTabContextTextOmniPrecedence
    E15: Invalid expression: g:SuperTabContextTextOmniPrecedence

:echo b:SuperTabContextTextOmniPrecedence
    ['&omnifunc', '&completefunc']

My .vimrc

@ervandew
Copy link
Owner

Hmm, not sure that vim has a way to see where a variable is last set, so you may have to grep through your .vim dir to see if any of those plugins set that variable. Most likely it will be in an ftplugin/php*.vim file, or in an autocmd.

@ervandew
Copy link
Owner

Actually I can reproduce this with a php file, so I'll dig around and see what I come up with.

@ervandew
Copy link
Owner

Ah, it's supertab's html.vim ftplugin that is causing this. Not sure why I have that in there. Let me think on this a bit to see if I can remember.

@briceburg
Copy link
Author

Cool -- thanks for helping with this. Please take your time. I'm working in Eclipse for now ;)

Happy to help if you point me in the right direction.

@ervandew
Copy link
Owner

Kind of gross, but I added some code to avoid this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants