Skip to content

Instantly share code, notes, and snippets.

@artemave
Last active February 13, 2023 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artemave/57d647451240d8278e25e434bad5f208 to your computer and use it in GitHub Desktop.
Save artemave/57d647451240d8278e25e434bad5f208 to your computer and use it in GitHub Desktop.
Deoplete vs copilot

I am using deoplete and copilot (with neovim) and it seems like deoplete menu often dismisses copilot suggestion. As in, copilot suggestion appears first and then deoplete menu shows up and copilot suggestion disappears at the same time.

Steps to reproduce:

  1. Install vim plug:
    sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
      https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  1. Open a test.rb using mini.vim (both from this gist):
    nvim -u mini.vim -c 'PlugInstall' test.rb
  1. As demonstrated in this video, when deoplete menu is shows, copilot suggestion is hidden:
Peek.2022-02-18.09-40.mp4
set nocompatible
call plug#begin()
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
let g:deoplete#enable_at_startup = 1
Plug 'github/copilot.vim'
call plug#end()
class A
def print_local_time_to_console
end
end
@Shougo
Copy link

Shougo commented Feb 18, 2022

Reproduced. But it is copilot feature.

copilot checks pumvisible() and it uses timer feature.
It does not work when completion window is visible.

@Shougo
Copy link

Shougo commented Feb 18, 2022

ddc.vim + pum.vim + copilot.vim works expected.

set runtimepath+=~/work/denops.vim
set runtimepath+=~/work/ddc.vim
set runtimepath+=~/work/ddc-around
set runtimepath+=~/work/ddc-matcher_head
set runtimepath+=~/work/ddc-sorter_rank
set runtimepath+=~/work/pum.vim

set runtimepath+=~/src/copilot.vim


call ddc#custom#patch_global('sources', ['around'])

call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
      \   'matchers': ['matcher_head'],
      \   'sorters': ['sorter_rank']},
      \ })
call ddc#custom#patch_global('completionMenu', 'pum.vim')

inoremap <silent><expr> <TAB>
      \ pum#visible() ? '<Cmd>call pum#map#insert_relative(+1)<CR>' :
      \ (col('.') <= 1 <Bar><Bar> getline('.')[col('.') - 2] =~# '\s') ?
      \ '<TAB>' : ddc#manual_complete()
inoremap <S-Tab> <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-n>   <Cmd>call pum#map#select_relative(+1)<CR>
inoremap <C-p>   <Cmd>call pum#map#select_relative(-1)<CR>
inoremap <C-y>   <Cmd>call pum#map#confirm()<CR>
inoremap <C-e>   <Cmd>call pum#map#cancel()<CR>

call ddc#enable()

@benedikt-bartscher
Copy link

did you ever solve this issue?

@artemave
Copy link
Author

Probably not. I moved off deoplete to hrsh7th/nvim-cmp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment