Closed mystilleef closed 10 months ago
I was just thinking the same. I have to delete newlines after completions very frequently. My mapping is the same as yours as well.
I was just thinking the same. I have to delete newlines after completions very frequently. My mapping is the same as yours as well.
I created a fork that fixes the newline issues and some weird insertion behaviors I was having. All this was through trial and error, as I didn't have much time to familiarize myself with the code base.
It would be best if you used cmp.ConfirmBehavior.Insert
. Using cmp.ConfirmBehavior.Replace
doesn't work properly anymore because I'm bypassing the formatting copilot-cmp
does which gave me insertion bugs when using cmp.select_next_item
.
You can test to see if this helps.
I was just thinking the same. I have to delete newlines after completions very frequently. My mapping is the same as yours as well.
I created a fork that fixes the newline issues and some weird insertion behaviors I was having. All this was through trial and error, as I didn't have much time to familiarize myself with the code base.
It would be best if you used
cmp.ConfirmBehavior.Insert
. Usingcmp.ConfirmBehavior.Replace
doesn't work properly anymore because I'm bypassing the formattingcopilot-cmp
does which gave me insertion bugs when usingcmp.select_next_item
.You can test to see if this helps.
If you make improvements please feel free to PR them. I took a look at your fork and there are a number of changes that could be merged in.
As for the main post: Newlines are already explicitly stripped. There's lots of formatting edge cases that are a pain to deal with since they are dependent on an individual's particular cmp and vim indentation configuration. Any newline inserts are likely not coming from the completion, but some setting in cmp as as the above comment explained.
My changes break cmp.ConfirmBehavior.Replace
. That's why I didn't create a PR. I'll try to look more into it when I have time.
This is hard to reproduce, but I'm having issues with
copilot-cmp
sometimes appending a newline character to suggestions, opening a new line, and placing the cursor on it.For 99% of users, this is not what they expect.
This issue only seems to happen with the
copilot-cmp
source. Other sources don't append the mysterious newline character and neither doescopilot.lua
.I'm assuming stripping newline characters from suggestions may resolve this issue. My
<cr>
mapping is very simple and presented below.