CopilotC-Nvim / CopilotChat.nvim

Chat with GitHub Copilot in Neovim
https://copilotc-nvim.github.io/CopilotChat.nvim/
GNU General Public License v3.0
1.44k stars 67 forks source link

Bug: Tab completion does not work in either coc.nvim OR nvim-cmp inside CopilotChat window #324

Closed tecfu closed 3 months ago

tecfu commented 3 months ago

Description

While in the CopilotChat window, text generated by Copilot itself may populate while a user is writing their prompt. As a user I expect to be able to use the <TAB> key to accept the generated text. But the <TAB> key does not accept the generated text when using a minimal configuration for either of these popular auto-completion plugins:

Steps to Repeat

  1. Run NVIM v0.10.0-dev-3117 with the following init.vim:
call plug#begin()
Plug 'github/copilot.vim'
Plug 'zbirenbaum/copilot.lua'
Plug 'nvim-lua/plenary.nvim'
Plug 'CopilotC-Nvim/CopilotChat.nvim', { 'branch': 'canary' }

" ## coc-vim ecosystem

Plug 'neoclide/coc.nvim', {'branch': 'release'}
" coc extensions
let g:coc_global_extensions = [
     \ '@hexuhua/coc-copilot'
     \ ]

call plug#end()

lua << EOF

require("CopilotChat").setup {
  debug = true, -- Enable debugging
  }
}
EOF
  1. Open nvim and :CopilotChat
  2. Begin typing until you see autogenerated text in grey that is ahead of your cursor. Then hit the tab key.
tecfu commented 3 months ago

Workaround

This seems to be a conflict between CopilotChat and how it takes control of the <TAB> key from coc.nvim & cmp-nvim. It can be resolved by changing the default complete key to something other than tab, i.e.:

lua << EOF

require("CopilotChat").setup {
  debug = true, -- Enable debugging
  -- See Configuration section for rest
  mappings = {
    complete = {
      detail = 'Use @<Tab> or /<Tab> for options.',
      insert ='<S-Tab>',
    }
  }
}
EOF
deathbeam commented 3 months ago

I mean thats just conflicting mappings between plugins, not rly a bug and the solution isnt wokaround either its proper solution. This plugin does not have nvim-cmp source integration or anything atm so the default tab completion is just showing nvim popup menu and thats it.