nvim-cmp icon indicating copy to clipboard operation
nvim-cmp copied to clipboard

Fix ConfirmBehavior.Replace

Open keithpl opened this issue 2 years ago • 4 comments

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|

keithpl avatar Aug 22 '22 22:08 keithpl

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

keithpl avatar Aug 22 '22 22:08 keithpl

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

hrsh7th avatar Sep 08 '22 03:09 hrsh7th

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?

keithpl avatar Sep 08 '22 13:09 keithpl

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

lvimuser avatar Sep 10 '22 14:09 lvimuser