Skip to content

Commit f647faa

Browse files
committed
Refactor search
1 parent 532e178 commit f647faa

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

crates/ra_ide_db/src/search.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ use hir::{DefWithBody, HasSource, ModuleSource, Semantics};
1010
use once_cell::unsync::Lazy;
1111
use ra_db::{FileId, FileRange, SourceDatabaseExt};
1212
use ra_prof::profile;
13-
use ra_syntax::{
14-
algo::find_node_at_offset, ast, match_ast, AstNode, TextRange, TextUnit, TokenAtOffset,
15-
};
13+
use ra_syntax::{ast, match_ast, AstNode, TextRange, TextUnit};
1614
use rustc_hash::FxHashMap;
1715
use test_utils::tested_by;
1816

@@ -219,21 +217,11 @@ impl Definition {
219217
continue;
220218
}
221219

222-
let name_ref =
223-
if let Some(name_ref) = find_node_at_offset::<ast::NameRef>(&tree, offset) {
220+
let name_ref: ast::NameRef =
221+
if let Some(name_ref) = sema.find_node_at_offset_with_descend(&tree, offset) {
224222
name_ref
225223
} else {
226-
// Handle macro token cases
227-
let token = match tree.token_at_offset(offset) {
228-
TokenAtOffset::None => continue,
229-
TokenAtOffset::Single(t) => t,
230-
TokenAtOffset::Between(_, t) => t,
231-
};
232-
let expanded = sema.descend_into_macros(token);
233-
match ast::NameRef::cast(expanded.parent()) {
234-
Some(name_ref) => name_ref,
235-
_ => continue,
236-
}
224+
continue;
237225
};
238226

239227
// FIXME: reuse sb

0 commit comments

Comments
 (0)