ervandew / eclim

Expose eclipse features inside of vim.
http://eclim.org
GNU General Public License v3.0
1.04k stars 127 forks source link

deoplete support? #478

Open richox opened 8 years ago

richox commented 8 years ago

is there any plan to support deoplete under neovim?

JulioJu commented 7 years ago

It's work ! See https://www.reddit.com/r/vim/comments/5xspok/trouble_with_eclim_and_deoplete/

You can close this issue.
It's really really faster than YCM (YouCompleteMe). You havn't long block time with Deoplete. Coding with YCM under Java EE Project it's impossible with YCM. With Deoplete it's very funny ! @ervandew maybe you could advise Deoplete on the README.md or doc/eclim.txt ?

andsild commented 7 years ago

I occasionally get some bugs, but this works well enough for me.

File "rplugin/python3/deoplete/sources/eclimd.py" in your vim's RTP:

from .base import Base

class Source(Base):
    def __init__(self, vim):
        Base.__init__(self, vim)

        self.name = 'eclimd'
        self.mark = '[eclim]'
        self.filetypes = ['java', 'jsp']
        self.is_bytepos = True
        self.input_pattern = r'[^. \t0-9]\.\w*'
        self.rank = 500
        self.max_pattern_length = -1
        self.matchers = ['matcher_full_fuzzy']

    def get_complete_position(self, context):
        res = self.vim.call('eclim#java#complete#CodeComplete', 1, '')
        if isinstance(res, str):
            return res
        return 0

    def gather_candidates(self, context):
        res = self.vim.call('eclim#java#complete#CodeComplete', 0, context['complete_str'])
        if res is -1:
            return  ['compiler error!']
        return res
uberbrodt commented 6 years ago

@andsild This doesn't seem to work for me. I tried placing it in it's own folder and in the deoplete source folder but it doesn't seem to ever trigger a completion from eclim. Is there additional configuration to get this to work?

andsild commented 6 years ago

@uberbrodt If you use neovim, you have to do :UpdateRemotePlugins Also, make sure eclimd is sourced in vim, does :EclimValidate execute successfully for you?

I could maybe write a proper plugin for this later with docs if people find it useful

uberbrodt commented 6 years ago

@andsild Eclim definitely works, I can complete by manually triggering the omnifunc. I did run :UpdateRemotePlugins but I'm still not seeing eclim completions via Deoplete. Would love a plugin if you get the chance!

JulioJu commented 6 years ago

@uberbrodt To have Eclim autocompletion with Deoplete, you just must add

        let g:deoplete#omni#input_patterns = {}
        let g:deoplete#omni#input_patterns.java = '[^. *\t]\.\w*'

You could also read https://www.reddit.com/r/vim/comments/5xspok/trouble_with_eclim_and_deoplete/

My config relative to Deoplete is :

    if has('nvim')
        " Eclim support
        " See https://www.reddit.com/r/vim/comments/5xspok/trouble_with_eclim_and_deoplete/
        let g:deoplete#omni#input_patterns = {}
        let g:deoplete#omni#input_patterns.java = '[^. *\t]\.\w*'

        " Autoclose preview windows
        " https://github.com/Shougo/deoplete.nvim/issues/115
        autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif

        " https://github.com/Shougo/deoplete.nvim/issues/100
        " use tab to forward cycle
        inoremap <silent><expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
        " use tab to backward cycle
        inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"

        " Lazy load Deoplete to reduce statuptime
        " See manpage
        " Enable deoplete when InsertEnter.
        let g:deoplete#enable_at_startup = 0
        autocmd InsertEnter * call deoplete#enable()

    endif
uberbrodt commented 6 years ago

Yep, I do something similar now. I actually had to disable the input_patterns for Java because I would get errors from Eclipse and long pauses. My understanding is that if I used a source like above, the calls to Eclipse would be asynchronous.

On Fri, Dec 08, 2017 at 06:58:59AM -0800, Julio wrote:

@uberbrodt To have Eclim autocompletion with Deoplete, you just must add

        let g:deoplete#omni#input_patterns = {}
        let g:deoplete#omni#input_patterns.java = '[^. *\t]\.\w*'

You could also read https://www.reddit.com/r/vim/comments/5xspok/trouble_with_eclim_and_deoplete/

My config relative to Deoplete is :

    if has('nvim')
        " Eclim support
        " See https://www.reddit.com/r/vim/comments/5xspok/trouble_with_eclim_and_deoplete/
        let g:deoplete#omni#input_patterns = {}
        let g:deoplete#omni#input_patterns.java = '[^. *\t]\.\w*'

        " Autoclose preview windows
        " https://github.com/Shougo/deoplete.nvim/issues/115
        autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif

        " https://github.com/Shougo/deoplete.nvim/issues/100
        " use tab to forward cycle
        inoremap <silent><expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
        " use tab to backward cycle
        inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"

        " Lazy load Deoplete to reduce statuptime
        " See manpage
        " Enable deoplete when InsertEnter.
        let g:deoplete#enable_at_startup = 0
        autocmd InsertEnter * call deoplete#enable()

    endif

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/ervandew/eclim/issues/478#issuecomment-350283648

JulioJu commented 6 years ago

@uberbrodt yes, Deoplete is asynchronous, so no lag with Eclim. Opposite, YCM is synchronous so sometimes we wait very long time to have the completion menu displayed, that's why we should not use it.

Actually, Syntaxic and Eclim Validation are synchronous, and I experience lag problems. For validation, I hope we will have soon w0rp avaible (see https://github.com/w0rp/ale/issues/352).