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

copilot autocompletion deleting last written character #266

Closed danielreis1 closed 2 months ago

danielreis1 commented 5 months ago

image autocompleting the above line, results in: image the last written character seems to disappear, surprisingly, it only happens sometimes: with sometimes I mean: it only happens when changing an already written line: if I have file:write() already written and enter insert mode now, the initial suggestion will appear and accepting that suggestion results in the mentioned problem. if I write the whole line from the start, instead of entering insert mode with file:write() already written, the mentioned problem doesn't exist. the following problem also happens: image autocompleting to: image if I press 'u' (for undo) image which means the correct thing was accepted and a character was deleted afterwards, the undo happens in both cases, even though I only posted the picture for the second case

my config:

require('copilot').setup({
  panel = {
    enabled = false,
    auto_refresh = false,
    keymap = {
      jump_prev = "[[",
      jump_next = "]]",
      accept = "<CR>",
      refresh = "gr",
      open = "<leader>cop"
    },
    layout = {
      position = "bottom", -- | top | left | right
      ratio = 0.4
    },
  },
  suggestion = {
    enabled = true,
    auto_trigger = true,
    debounce = 75,
    keymap = {
      --accept = "<A-s>",
      accept_word = false,
      accept_line = false,
      next = "<A-a>",
      prev = "<A-d>",
      dismiss = "<A-q>",
    },
  },
  filetypes = {
    yaml = false,
    markdown = false,
    help = false,
    gitcommit = false,
    gitrebase = false,
    hgcommit = false,
    svn = false,
    cvs = false,
    ["."] = false,
  },
  copilot_node_command = 'node', -- Node.js version must be > 18.x
  server_opts_overrides = {},
})

require('copilot_cmp').setup({})
--require("copilot.suggestion").accept(modifier)

vim.keymap.set({ 'i', 'n' }, "<A-s>",[[<cmd>lua require('copilot.suggestion').accept()<CR><Esc>]])

config in txt: copilot.txt

danielreis1 commented 2 months ago

it really was that last line fixed with image