zbirenbaum / copilot-cmp

Lua plugin to turn github copilot into a cmp source
MIT License
1.1k stars 39 forks source link

Copilot suggestion goes to the beginning of the line on enter #11

Closed marcelarie closed 2 years ago

marcelarie commented 2 years ago

When I use enter to accept a suggestion from copilot it always puts it at the beginning of the line, ignoring any tabulation or the position of the cursor. This happens with all the languages.

Does this happen to someone else? I need to do a minimal config error, but I wanted to ask because it might be something known.

Here is an example:

https://user-images.githubusercontent.com/62728887/166101903-d39ec2f5-7d07-4afd-97c8-0a4195fdae76.mov

marcelarie commented 2 years ago

Changing the cmp default behavior to cmp.ConfirmBehavior.Replace fixed it :)

require("cmp").setup {
    mapping = {
        ["<CR>"] = cmp.mapping.confirm {
            behavior = cmp.ConfirmBehavior.Replace,
            select = true,
        },
    }
}