aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/references.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/references.rs')
-rw-r--r--crates/ra_ide/src/references.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index f763013ae..2eb047c96 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -27,7 +27,10 @@ use test_utils::tested_by;
27 27
28use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeInfo}; 28use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeInfo};
29 29
30pub(crate) use self::{classify::classify_name_ref, rename::rename}; 30pub(crate) use self::{
31 classify::{classify_name_ref, NameRefClass},
32 rename::rename,
33};
31pub(crate) use ra_ide_db::defs::{classify_name, NameDefinition}; 34pub(crate) use ra_ide_db::defs::{classify_name, NameDefinition};
32 35
33pub use self::search_scope::SearchScope; 36pub use self::search_scope::SearchScope;
@@ -160,7 +163,7 @@ fn find_name(
160 return Some(RangeInfo::new(range, (name.text().to_string(), def))); 163 return Some(RangeInfo::new(range, (name.text().to_string(), def)));
161 } 164 }
162 let name_ref = find_node_at_offset::<ast::NameRef>(&syntax, position.offset)?; 165 let name_ref = find_node_at_offset::<ast::NameRef>(&syntax, position.offset)?;
163 let def = classify_name_ref(sema, &name_ref)?; 166 let def = classify_name_ref(sema, &name_ref)?.definition();
164 let range = name_ref.syntax().text_range(); 167 let range = name_ref.syntax().text_range();
165 Some(RangeInfo::new(range, (name_ref.text().to_string(), def))) 168 Some(RangeInfo::new(range, (name_ref.text().to_string(), def)))
166} 169}
@@ -212,6 +215,7 @@ fn process_definition(
212 // See https://github.com/rust-lang/rust/pull/68198#issuecomment-574269098 215 // See https://github.com/rust-lang/rust/pull/68198#issuecomment-574269098
213 216
214 if let Some(d) = classify_name_ref(&sema, &name_ref) { 217 if let Some(d) = classify_name_ref(&sema, &name_ref) {
218 let d = d.definition();
215 if d == def { 219 if d == def {
216 let kind = 220 let kind =
217 if is_record_lit_name_ref(&name_ref) || is_call_expr_name_ref(&name_ref) { 221 if is_record_lit_name_ref(&name_ref) || is_call_expr_name_ref(&name_ref) {