nvim-cmp
nvim-cmp copied to clipboard
Fix ConfirmBehavior.Replace
This reverts breaking change in 27bc575.
Before this change confirm() with ConfirmBehavior.Replace behaved as expected:
abcd|<C-n><CR> abcdefg|
Presently confirm() with ConfirmBehavior.Replace is inserting the entire suggestion after the cursor:
abcd|<C-n><CR> abcdabcdefg|
This is the current behavior: https://user-images.githubusercontent.com/682595/186026832-f817c995-02a3-4735-bfc2-93f7ed9c61ef.mp4
This is after reverting: https://user-images.githubusercontent.com/682595/186026856-fbcc15bb-4abc-41e5-8d2b-08897bcbe1bc.mp4
First, most language servers tested in VSCode. So it's importa t that the lsp related plugin works the same as the VSCode.
I think the VSCode handles the InsertReplaceTextEdit
as the same as latest nvim-cmp.
https://github.com/microsoft/vscode/blob/main/src/vs/editor/contrib/suggest/browser/suggest.ts#L239 https://github.com/microsoft/vscode/blob/main/src/vs/editor/contrib/suggest/browser/suggest.ts#L101
I'm not sure what the next step is; before 27bc575 ConfirmBehavior.Replace was working as expected, post 27bc575 ConfirmBehavior.Replace started inserted the entire suggestion at the cursor position.
Are you stating the problem is with the language server?
See https://github.com/hrsh7th/nvim-cmp/pull/1140 and https://github.com/hrsh7th/nvim-cmp/issues/1156 The change wasn't without reason, simply reverting it will cause a regression