From 09fc5e1dd7f8635d111c12e745cf782fe3b58d95 Mon Sep 17 00:00:00 2001 From: Danny Zhu Date: Sun, 25 Apr 2021 13:28:38 -0700 Subject: Check more carefully for cases where a rename can't be done Attempting to rename an element of a tuple field would previously replace the type with the new name, which doesn't make sense; now it fails instead. The check is done in both `prepare_rename` and `rename` so that the case is caught before the user is prompted for a new name. Some other existing failure cases are also now additionally checked in `prepare_rename`. --- crates/ide/src/display/navigation_target.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates/ide/src/display') diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 364be260c..2079c22a3 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs @@ -20,7 +20,7 @@ use syntax::{ use crate::FileSymbol; -/// `NavigationTarget` represents and element in the editor's UI which you can +/// `NavigationTarget` represents an element in the editor's UI which you can /// click on to navigate to a particular piece of code. /// /// Typically, a `NavigationTarget` corresponds to some element in the source @@ -35,12 +35,10 @@ pub struct NavigationTarget { /// Clients should use this range to answer "is the cursor inside the /// element?" question. pub full_range: TextRange, - /// A "most interesting" range withing the `full_range`. + /// A "most interesting" range within the `full_range`. /// /// Typically, `full_range` is the whole syntax node, including doc - /// comments, and `focus_range` is the range of the identifier. "Most - /// interesting" range within the full range, typically the range of - /// identifier. + /// comments, and `focus_range` is the range of the identifier. /// /// Clients should place the cursor on this range when navigating to this target. pub focus_range: Option, -- cgit v1.2.3