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

Incomplete omni completion with vim-go with minimal chain #201

Open
scfarley opened this issue Sep 10, 2022 · 3 comments
Open

Incomplete omni completion with vim-go with minimal chain #201

scfarley opened this issue Sep 10, 2022 · 3 comments

Comments

@scfarley
Copy link

When using vim-mucomplete with vim-go with a minimal chain, mu-complete does provide a full list of completions from omni. For example, if the chain only includes omni and path then typing signal. will show a partial list:

  • signal.Ignore ...
  • signal.Ignored ...
  • signal.Notify ...

This list apparently is limited to the first three possibilities. Typing <C-x><C-o> will pull up the full list.

However, if the chain includes keyn or one of a few other choices, then the a full list is displayed following the period, which has in addition to the previous list:

  • signal.NotifyContext ...
  • signal.Reset ...
  • signal.Stop ...

NOTE: This presumes no mistake is made during typing. If someone types a little then hits backspace/delete, then typing the period will show a complete list.
NOTE: If the Go package is not already loaded via an import, then the completion will show the full list.

Minimal vimrc appended to troubleshooting_vimrc.vim:

" Prepend vim-go to avoid b:did_ftplugin being set by Vim runtime.
" See:  https://github.com/fatih/vim-go/issues/1997
set runtimepath^=~/.vim/plugged/vim-go
set runtimepath+=~/.vim/plugged/vim-mucomplete

" Optionally add additional configuration below this line
set completeopt+=noselect
set backspace=indent,eol,start

" Restore backspace.
inoremap <silent> <plug>(MUcompleteFwdKey) <right>
imap <right> <plug>(MUcompleteCycFwd)
inoremap <silent> <plug>(MUcompleteBwdKey) <left>
imap <left> <plug>(MUcompleteCycBwd)

let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#minimum_prefix_length = 1
let g:mucomplete#can_complete = {}
let g:mucomplete#can_complete.go = {
    \ 'omni': { t -> t =~# '\m\k\%(\k\|\.\)$' } }
let g:mucomplete#chains = {
    \ 'go' : ['omni', 'path']
    \ }

Minimal Go:
tiny.go

package main

import "os/signal"

func main() {
	signal.Ignore()
}

go.mod

module tiny

go 1.19
@lifepillar
Copy link
Owner

Do these settings help?

let g:mucomplete#completion_delay = 50
let g:mucomplete#reopen_immediately = 0

@lifepillar
Copy link
Owner

What is the value of omnifunc? I am trying your vimrc, but when I set the filetype to Go, omnifunc remains empty.

@scfarley
Copy link
Author

Do these settings help?

let g:mucomplete#completion_delay = 50
let g:mucomplete#reopen_immediately = 0

They did not help exactly, even if omni was the only option in Go's chain. However, I tried g:mucomplete#completion_delay = 5000. If I type signal. quick enough, then it does provide the full list.

What is the value of omnifunc? I am trying your vimrc, but when I set the filetype to Go, omnifunc remains empty.

omnifunc=go#complete#Complete

I needed the following or my omnifunc was also empty. I spent more time on figuring how to get omnifunc to be set than anything else in the sample vimrc. If vim-go is not before $VIMRUNTIME, it will not be set as noted in that issue.

" Prepend vim-go to avoid b:did_ftplugin being set by Vim runtime.
" See:  https://github.com/fatih/vim-go/issues/1997
set runtimepath^=~/.vim/plugged/vim-go

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