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

Popup does not appear #2

Closed
lcmen opened this issue Aug 25, 2017 · 9 comments
Closed

Popup does not appear #2

lcmen opened this issue Aug 25, 2017 · 9 comments

Comments

@lcmen
Copy link

lcmen commented Aug 25, 2017

Hi!
I'm testing it with NeoVim on Ruby files and it does not seem to work. When I invoke completion using <C-X><C-O> it works fine but the completion popup (from asynccomplete-omni) does not automatically appear as I type.

Fragments from my init.vim file:

    " Completions {{{
      Plug 'prabirshrestha/asyncomplete.vim'
      Plug 'prabirshrestha/asyncomplete-buffer.vim'
      Plug 'prabirshrestha/asyncomplete-gocode.vim'
      Plug 'prabirshrestha/asyncomplete-tags.vim'
      Plug 'yami-beta/asyncomplete-omni.vim'
    " }}}

    call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
      \ 'name': 'omni',
      \ 'whitelist': ['*'],
      \ 'completor': function('asyncomplete#sources#omni#completor')
      \  }))

Any idea what can be wrong?

@prabirshrestha
Copy link
Contributor

If you add this imap <c-space> <Plug>(asyncomplete_force_refresh) and then type <c-space> does it show autocomplete popup?

@lcmen
Copy link
Author

lcmen commented Aug 26, 2017

@prabirshrestha thanks for quick reply. With <C-Space> it does not work correctly either. I've recorded screencast to show you how it behaves on my side:

out

At first try it asynccomplete shows error: No inserted text yet. Next I use normal omni-completion (<C-X><C-O>), then I try <C-Space> again (it works for include? method but it puts double ii at the beginning of the method) and finally when I try one more time, it wipes the code before the cursor.

@prabirshrestha
Copy link
Contributor

Seems to work perfectly fine with vim8 on windows that comes with inbuilt ruby onmifunc. For me both syntax and omni sources works.

Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-necosyntax.vim'
Plug 'yami-beta/asyncomplete-omni.vim'

autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete

imap <c-space> <Plug>(asyncomplete_force_refresh)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif

au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
    \ 'name': 'omni',
    \ 'whitelist': ['*'],
    \ 'completor': function('asyncomplete#sources#omni#completor'),
    \ }))
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#necosyntax#get_source_options({
    \ 'name': 'necosyntax',
    \ 'whitelist': ['*'],
    \ 'completor': function('asyncomplete#sources#necosyntax#completor'),
    \ }))
  • Do you have problems with other sources like gocode, buffer or is it just with ruby?
  • Are you using some other omnicomplete func? If so make sure that completefunc is sync.
  • Do you also other autocomplete plugins besides asyncomplete.vim. Since asyncomplete.vim is async it takes over our popup management. That means deoplete, ncm or neocomplete shouldn't be used. It is the same other way around. If you use those plugins use only one and not multiple autocomplete managers.
  • Since asyncomplete popup manages what to show in popup, do not use <c-x c-o> directly. Use <Plug>(asyncomplete_force_refresh) instead.
  • Can you try disabling sign plugin. I do use ale personally but haven't seen this problem.
  • Please upload a minimal vimrc like this https://gist.githubusercontent.com/junegunn/6936bf79fedd3a079aeb1dd2f3c81ef5/raw so that I can exactly try to reproduce. also mention vim/nvim version as well as OS.
  • You can also try to see the log let g:asyncomplete_log = expand('~/asyncomplete.log').

Another option would be to also try vim-lsp with asyncomplete using asyncomplete-lsp.vim. This is better than omnicompletion since the actual lang server is started in different process and provides various other features such as go to definition, document formatting, find references and so on. This allow the actual completion to be purly async. A quick search let me to this https://github.com/mtsmfm/language_server-ruby and rubyide/vscode-ruby#118 (comment)

@lcmen
Copy link
Author

lcmen commented Aug 26, 2017

Thanks for detailed troubleshooting instructions!

I'm sorry but I map incorrectly map <c-space> to <Plug>(asyncomplete_force_refresh) - I used nnoremap instead of imap. After changing to imap I don't see any popup nor it does not autocomplete.

Here is the minimal vimrc that I've been using for testing. I'm using neovim (NVIM v0.2.1-782-gf465bf0).

Do you have problems with other sources like gocode, buffer or is it just with ruby?

It's only with Ruby. Autocompletion for gocode and buffers works fine.

Are you using some other omnicomplete func? If so make sure that completefunc is sync.

No I'm not

Do you also other autocomplete plugins besides asyncomplete.vim. Since asyncomplete.vim is async it takes over our popup management. That means deoplete, ncm or neocomplete shouldn't be used. It is the same other way around. If you use those plugins use only one and not multiple autocomplete managers.

No I don't

Can you try disabling sign plugin. I do use ale personally but haven't seen this problem.

I tried with the vimrc I posted above. Still no popup.

You can also try to see the log let g:asyncomplete_log = expand('~/asyncomplete.log')

I tried it but it didn't even created the log file for me.

@yami-beta
Copy link
Owner

@lowski Sorry for my late reply.
Please try fix-startcol branch.
I think this branch works correctly.

If this branch resolve this issue, I merge it into master.

@prabirshrestha Thank you for help to resolve !

@lcmen
Copy link
Author

lcmen commented Aug 28, 2017

@yami-beta I've switched to that branch but I don't see pop-up (neither when I type nor I hit <c-space>). I'm testing it with the following vimrc (using nvim -u path/to/file):

set nocompatible

call plug#begin('~/.vim/plugged')
  Plug 'prabirshrestha/asyncomplete.vim'
  Plug 'yami-beta/asyncomplete-omni.vim', { 'branch': 'fix-startcol' }
call plug#end()

autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
imap <c-space> <Plug>(asyncomplete_force_refresh)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
  \ 'name': 'omni',
  \ 'whitelist': ['*'],
  \ 'completor': function('asyncomplete#sources#omni#completor')
  \  }))

@yami-beta
Copy link
Owner

@lowski Sorry, I misspelled.
Wrong: fix-startcol
Correct: topic/fix-startcol

@lcmen
Copy link
Author

lcmen commented Aug 28, 2017

@yami-beta this works perfectly, thanks! Please merge to master.

@yami-beta
Copy link
Owner

Merged!

@astyagun astyagun mentioned this issue Jan 28, 2018
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

3 participants