From 19d042dde6ac7aad5b597c791c1f142f5c7f7198 Mon Sep 17 00:00:00 2001 From: ttys3 Date: Sat, 23 Apr 2022 16:09:16 +0800 Subject: chore(lsp): check rename capabilities before send rename action (#2203) --- helix-term/src/commands/lsp.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'helix-term/src/commands') diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 0a12ae39..90a1ad7f 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -674,8 +674,10 @@ pub fn rename_symbol(cx: &mut Context) { let pos = doc.position(view.id, offset_encoding); let task = language_server.rename_symbol(doc.identifier(), pos, input.to_string()); - let edits = block_on(task).unwrap_or_default(); - apply_workspace_edit(cx.editor, offset_encoding, &edits); + match block_on(task) { + Ok(edits) => apply_workspace_edit(cx.editor, offset_encoding, &edits), + Err(err) => cx.editor.set_error(err.to_string()), + } }, ); } -- cgit v1.2.3-70-g09d2