From 3c0d05e362b60febef28aef8316eb13218b3f63b Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:00:04 +0100 Subject: [PATCH] lsp: Use replace edits for completions (#23490) (Late) follow up to #9634. Fixes #23395 Release Notes: - Accepting completions while the cursor is in the middle of suggested completion will now result in smaller edits being applied. --- crates/project/src/lsp_command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/project/src/lsp_command.rs b/crates/project/src/lsp_command.rs index e69b7b95b04207d9c599b1f6b779eac882507a4e..edb227cf8f026798fd9514c3c1cbc0bdcb8924ff 100644 --- a/crates/project/src/lsp_command.rs +++ b/crates/project/src/lsp_command.rs @@ -2123,7 +2123,7 @@ pub(crate) fn parse_completion_text_edit( } lsp::CompletionTextEdit::InsertAndReplace(edit) => { - let range = range_from_lsp(edit.insert); + let range = range_from_lsp(edit.replace); let start = snapshot.clip_point_utf16(range.start, Bias::Left); let end = snapshot.clip_point_utf16(range.end, Bias::Left);