From e90931a2047e6e38f173e2e2f2a24ad648e92e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Herrmann?= Date: Mon, 24 Aug 2020 16:37:45 +0200 Subject: Show reason for failed rename refactoring Return an error with a meaningful message for requests to `textDocument/rename` if the operation cannot be performed. Pass errors raised by rename handling code to the LSP runtime. As a consequence, the VS Code client shows and logs the request as if a server-side programming error occured. Resolves https://github.com/rust-analyzer/rust-analyzer/issues/3981 --- crates/ide/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/ide/src/lib.rs') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 57f3581b6..d54c06b14 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -77,7 +77,9 @@ pub use crate::{ hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, markup::Markup, - references::{Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult}, + references::{ + Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult, RenameError, + }, runnables::{Runnable, RunnableKind, TestId}, syntax_highlighting::{ Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange, @@ -490,7 +492,7 @@ impl Analysis { &self, position: FilePosition, new_name: &str, - ) -> Cancelable>> { + ) -> Cancelable, RenameError>> { self.with_db(|db| references::rename(db, position, new_name)) } -- cgit v1.2.3