From 13126823f83cb90a3aabfc2326c0907d1ca2d921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 8 Nov 2022 20:48:06 +0900 Subject: [PATCH] lsp: Support insertReplace Fixes #4473 --- helix-lsp/src/client.rs | 1 + helix-term/src/ui/completion.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 0b443ccf4..81b7d8ada 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -311,6 +311,7 @@ impl Client { String::from("additionalTextEdits"), ], }), + insert_replace_support: Some(true), ..Default::default() }), completion_item_kind: Some(lsp::CompletionItemKindCapability { diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index de7c3232b..5ec8cf892 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -113,7 +113,8 @@ impl Completion { let edit = match edit { lsp::CompletionTextEdit::Edit(edit) => edit.clone(), lsp::CompletionTextEdit::InsertAndReplace(item) => { - unimplemented!("completion: insert_and_replace {:?}", item) + // TODO: support using "insert" instead of "replace" via user config + lsp::TextEdit::new(item.replace, item.new_text.clone()) } };