-
Notifications
You must be signed in to change notification settings - Fork 150
Description
I have enabled folke/sidekick NES and copilot.lua inline suggestions. I would like to use these features together like this:
Workflow: Go to insert mode, start typing, accept suggestions word-by-word, go to normal mode, and trigger NES.
Currently, this doesn't work.
I tried to debug this and found two issues:
copilot.luasuggestions are accepted usingvim.lsp.util.apply_text_edits.
Every time vim.lsp.util.apply_text_edits function is called, mode changes to normal and back to insert. This triggers the "InsertEnter" event and clears the next edit suggestion. Changing this to vim.api.nvim_buf_set_lines solves the issue, since we never leave insert mode and are just updating the current buffer.
- Autoindent hack.
Not sure why, but this:
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Space><Left><Del>", true, false, true), "n", false)
causes a problem - suggestions are incorrect. E.g.:

It looks like copilot lsp is not aware of this change.
Removing this line solves this issue, but I'm not sure what this hack is supposed to do. In my tests, there is no difference with or without it.
I have prepared a PR with the above changes: #627
Please let me know if vim.lsp.util.apply_text_edits can be safely replaced and if autoindent hack can be removed (and if not, how I could test what it does).