Closed lcmen closed 7 years ago
If you add this imap <c-space> <Plug>(asyncomplete_force_refresh)
and then type <c-space>
does it show autocomplete popup?
@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:
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
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'),
\ }))
gocode
, buffer
or is it just with ruby?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.<c-x c-o>
directly. Use <Plug>(asyncomplete_force_refresh)
instead.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 https://github.com/rubyide/vscode-ruby/issues/118#issuecomment-278221193
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.
@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 !
@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')
\ }))
@lowski Sorry, I misspelled. Wrong: fix-startcol Correct: topic/fix-startcol
@yami-beta this works perfectly, thanks! Please merge to master
.
Merged!
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 (fromasynccomplete-omni
) does not automatically appear as I type.Fragments from my
init.vim
file:Any idea what can be wrong?