zbirenbaum / copilot.lua

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot
MIT License
2.43k stars 64 forks source link

Suggestion keymaps accept_line and accept_word should accept boolean true #291

Closed Phil-Barber closed 1 month ago

Phil-Barber commented 1 month ago

Current config states false|string

https://github.com/zbirenbaum/copilot.lua/blob/f7612f5af4a7d7615babf43ab1e67a2d790c13a6/lua/copilot/config.lua#L25C82-L25C94

This means that setting:

          require("copilot").setup({
            suggestion = {
              keymap = {
                accept_line = true,
              },
            },
          })

Yields the following error:

Failed to run `config` for copilot.lua

vim/keymap.lua:0: lhs: expected string, got boolean

# stacktrace:
  - vim/shared.lua:0 _in_ **validate**
  - vim/keymap.lua:0 _in_ **set**
  - /copilot.lua/lua/copilot/suggestion.lua:86 _in_ **set_keymap**
  - /copilot.lua/lua/copilot/suggestion.lua:653 _in_ **setup**
  - /copilot.lua/lua/copilot/command.lua:183 _in_ **enable**
  - /copilot.lua/lua/copilot/init.lua:41 _in_ **setup**
  - ~/dotfiles/nvim/init.lua:305 _in_ **config**
  - ~/dotfiles/nvim/init.lua:20

Updating the value to "true" behaves as expected

Phil-Barber commented 1 month ago

Realised this is the keymap to set perform this action - doofus