diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-25 22:18:57 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-25 22:18:57 +0100 |
commit | 617535393bb5ccc7adf0bac8a3b9a9c306454e79 (patch) | |
tree | c0271bccd902abfbbc429e186d208b9a92ca79db /crates/ide/src/display/navigation_target.rs | |
parent | d8578bf9bf36708ca0095c77e2856c78ed3fd8ec (diff) | |
parent | 09fc5e1dd7f8635d111c12e745cf782fe3b58d95 (diff) |
Merge #8658
8658: Check more carefully for cases where a rename can't be done r=Veykril a=dzhu
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`.
Closes: #8592
(I threw in some doc edits for a relevant type; of course, I can remove those if the policy here is to be strict about scope of changes within a PR.)
Co-authored-by: Danny Zhu <[email protected]>
Diffstat (limited to 'crates/ide/src/display/navigation_target.rs')
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 8 |
1 files changed, 3 insertions, 5 deletions
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::{ | |||
20 | 20 | ||
21 | use crate::FileSymbol; | 21 | use crate::FileSymbol; |
22 | 22 | ||
23 | /// `NavigationTarget` represents and element in the editor's UI which you can | 23 | /// `NavigationTarget` represents an element in the editor's UI which you can |
24 | /// click on to navigate to a particular piece of code. | 24 | /// click on to navigate to a particular piece of code. |
25 | /// | 25 | /// |
26 | /// Typically, a `NavigationTarget` corresponds to some element in the source | 26 | /// Typically, a `NavigationTarget` corresponds to some element in the source |
@@ -35,12 +35,10 @@ pub struct NavigationTarget { | |||
35 | /// Clients should use this range to answer "is the cursor inside the | 35 | /// Clients should use this range to answer "is the cursor inside the |
36 | /// element?" question. | 36 | /// element?" question. |
37 | pub full_range: TextRange, | 37 | pub full_range: TextRange, |
38 | /// A "most interesting" range withing the `full_range`. | 38 | /// A "most interesting" range within the `full_range`. |
39 | /// | 39 | /// |
40 | /// Typically, `full_range` is the whole syntax node, including doc | 40 | /// Typically, `full_range` is the whole syntax node, including doc |
41 | /// comments, and `focus_range` is the range of the identifier. "Most | 41 | /// comments, and `focus_range` is the range of the identifier. |
42 | /// interesting" range within the full range, typically the range of | ||
43 | /// identifier. | ||
44 | /// | 42 | /// |
45 | /// Clients should place the cursor on this range when navigating to this target. | 43 | /// Clients should place the cursor on this range when navigating to this target. |
46 | pub focus_range: Option<TextRange>, | 44 | pub focus_range: Option<TextRange>, |