diff options
author | Aleksey Kladov <[email protected]> | 2019-11-16 10:33:25 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-16 10:33:25 +0000 |
commit | 272af56a5c5a0e89fc3c2db41e125f0f16df0d0c (patch) | |
tree | 958f763ff024903635a4450cf5aec0000e837446 /crates/ra_ide_api/src/references.rs | |
parent | d9d99369b2765eaef7f49cd519990769191c3381 (diff) |
Sourcify classify_name_ref
Diffstat (limited to 'crates/ra_ide_api/src/references.rs')
-rw-r--r-- | crates/ra_ide_api/src/references.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index faa88d988..1af7e8a9f 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs | |||
@@ -14,6 +14,7 @@ mod name_definition; | |||
14 | mod rename; | 14 | mod rename; |
15 | mod search_scope; | 15 | mod search_scope; |
16 | 16 | ||
17 | use hir::Source; | ||
17 | use once_cell::unsync::Lazy; | 18 | use once_cell::unsync::Lazy; |
18 | use ra_db::{SourceDatabase, SourceDatabaseExt}; | 19 | use ra_db::{SourceDatabase, SourceDatabaseExt}; |
19 | use ra_prof::profile; | 20 | use ra_prof::profile; |
@@ -114,7 +115,7 @@ fn find_name<'a>( | |||
114 | return Some(RangeInfo::new(range, (name.text().to_string(), def))); | 115 | return Some(RangeInfo::new(range, (name.text().to_string(), def))); |
115 | } | 116 | } |
116 | let name_ref = find_node_at_offset::<ast::NameRef>(&syntax, position.offset)?; | 117 | let name_ref = find_node_at_offset::<ast::NameRef>(&syntax, position.offset)?; |
117 | let def = classify_name_ref(db, position.file_id, &name_ref)?; | 118 | let def = classify_name_ref(db, Source::new(position.file_id.into(), &name_ref))?; |
118 | let range = name_ref.syntax().text_range(); | 119 | let range = name_ref.syntax().text_range(); |
119 | Some(RangeInfo::new(range, (name_ref.text().to_string(), def))) | 120 | Some(RangeInfo::new(range, (name_ref.text().to_string(), def))) |
120 | } | 121 | } |
@@ -146,7 +147,7 @@ fn process_definition( | |||
146 | continue; | 147 | continue; |
147 | } | 148 | } |
148 | } | 149 | } |
149 | if let Some(d) = classify_name_ref(db, file_id, &name_ref) { | 150 | if let Some(d) = classify_name_ref(db, Source::new(file_id.into(), &name_ref)) { |
150 | if d == def { | 151 | if d == def { |
151 | refs.push(FileRange { file_id, range }); | 152 | refs.push(FileRange { file_id, range }); |
152 | } | 153 | } |