mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Sourcify classify_name_ref
This commit is contained in:
parent
d9d99369b2
commit
272af56a5c
5 changed files with 22 additions and 21 deletions
|
@ -14,6 +14,7 @@ mod name_definition;
|
|||
mod rename;
|
||||
mod search_scope;
|
||||
|
||||
use hir::Source;
|
||||
use once_cell::unsync::Lazy;
|
||||
use ra_db::{SourceDatabase, SourceDatabaseExt};
|
||||
use ra_prof::profile;
|
||||
|
@ -114,7 +115,7 @@ fn find_name<'a>(
|
|||
return Some(RangeInfo::new(range, (name.text().to_string(), def)));
|
||||
}
|
||||
let name_ref = find_node_at_offset::<ast::NameRef>(&syntax, position.offset)?;
|
||||
let def = classify_name_ref(db, position.file_id, &name_ref)?;
|
||||
let def = classify_name_ref(db, Source::new(position.file_id.into(), &name_ref))?;
|
||||
let range = name_ref.syntax().text_range();
|
||||
Some(RangeInfo::new(range, (name_ref.text().to_string(), def)))
|
||||
}
|
||||
|
@ -146,7 +147,7 @@ fn process_definition(
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if let Some(d) = classify_name_ref(db, file_id, &name_ref) {
|
||||
if let Some(d) = classify_name_ref(db, Source::new(file_id.into(), &name_ref)) {
|
||||
if d == def {
|
||||
refs.push(FileRange { file_id, range });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue