-
Notifications
You must be signed in to change notification settings - Fork 18
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
Omnifunc is skipped if c-n
or c-p
or tags
are set
#179
Comments
c-n
or c-p
or tags
are set
Can you show the relevant configuration from your |
Also, can you please provide links to the relevant plugins? Are you using Vim or Neovim? |
I'll try to come up with a reproducible example |
@lifepillar let me know if this repository with a Dockerfile works. At least I can reproduce the issue this way. |
Ok, I see. Does it help to add |
You should also unset |
Unfortunately neither of the two options had any effect on the issue |
Ok, I'll debug further. |
I am wondering whether this is just an issue with |
I think the problem is that nvim-lsp |
Well, MUcomplete doesn't handle asynch at all. If that is the culprit, I guess that MUcomplete cannot be used with nvim-lsp. How is asynchronous completion implemented? With |
Probably. Anyway, if mucomplete could handle asynch sources it would be a big improvement, considering that lsp-based completions are generally asynch. |
That would probably require a rework of the plugin. Currently, MUcomplete is based on strictly sequential fallback: try first source and wait for result; if no result, try second source and wait, etc. Asynchronous completion requires a totally different approach, Maybe, timers might be used; or maybe something else. |
I don't think you'd need to rework everything, for example you could try something like this (I didn't test it...). Start by keeping a dict of recognized asynch methods/sources, suppose you fill " key is the method, value is the callback status
let s:asynch_methods = {'nvim-lsp': 0} Then when you verify the completion, if the current method is asynch you start fun! s:verify_completion(...)
let method = s:compl_methods[s:i]
if !a:0 && has_key(s:asynch_methods, method)
if s:asynch_methods[method] == 0
" completion hasn't been tried yet
let s:asynch_methods[method] = 1
call timer_start(100, function('s:verify_completion'))
return ''
else
" keys have been fed by the callback, reset callback status
" no return value, proceed to check pumvisible()
let s:asynch_methods[method] = 0
endif
elseif a:0
" this is the timer callback
call feedkeys("\<Plug>(MUcompleteVerify)")
return ''
endif
return pumvisible()
\ ? s:act_on_pumvisible()
\ : (method ==# 'cmd' ? s:ctrlx_out : '')
\ . s:next_method()
endf |
Btw the problem with this approach is that you have to guess how long to wait (and overestimate it to be safer), it's not like the asynch source calls the next method on its own if it cannot provide completions (it would be ideal but not really possible unless a source supports this behaviour). Edit: I tried the approach above but I couldn't make it work. |
Okay, so I am having this issue (or similar) as well and its most prominent when using What I have found that fixes the issue but I have no idea on the fallout or why it works (@lifepillar maybe you could elaborate?) is to skip the
|
@alexkornitzer Could you provide a minimal |
Why of course, sorry for not doing that to start so, here is my minimal conf: if empty(glob("~/.vim/autoload/plug.vim"))
execute '!curl -fLo ~/.vim/autoload/plug.vim'
\ 'https://raw.github.com/junegunn/vim-plug/master/plug.vim'
endif
call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'lifepillar/vim-mucomplete'
call plug#end()
set completeopt-=longest,preview
set completeopt+=menu,menuone,noinsert,noselect
set shortmess+=c
if executable('pyls')
au User lsp_setup call lsp#register_server({
\ 'name': 'pyls',
\ 'cmd': {server_info->['pyls']},
\ 'whitelist': ['python'],
\ })
autocmd FileType python setlocal omnifunc=lsp#complete
endif
let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#chains = {}
let g:mucomplete#chains.default = ['path', 'omni', 'c-p', 'dict', 'uspl', 'ulti'] The following to install pyls: pip install --user python-language-server And here is the test file I have been using: aaa
aaaa
aaaaa
aaaaaa
import sys
sys.a Hitting |
I tried to use the Neovim built-in LSP client (Intelephense language server) in a chain |
I have
gopls
(Golang LSP) installed and I'm usingnvim-lsp
and the built-in LSP to usegopls
for omnifunc completion. When invoked manually viac-x c-o
I getgopls
completion candidates. It also works if I removec-n
andc-p
from my completion chains, so that onlyomni
is left. But as soon as I re-addc-n
orc-p
omnifunc completion via mucomplete doesn't work. If I manually cycle through the chains it never showsomni
.c-x c-o
works\ 'go' : ['ulti', 'omni'],
works\ 'go' : ['ulti', 'omni', 'c-n'],
does not workThe text was updated successfully, but these errors were encountered: