Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 92d54f9

Browse files
committed
typo and draft
1 parent bd0eeb3 commit 92d54f9

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

crates/ide/src/references.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,32 @@ pub(crate) fn find_all_refs(
115115
}
116116

117117
fn retain_import_usages(usages: &mut UsageSearchResult, sema: &Semantics<'_, RootDatabase>) {
118-
for (file_id, refs) in &mut usages.references {
118+
// todo use this https://github.com/rust-lang/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs#L432
119+
120+
for (_file_id, refs) in &mut usages.references {
119121
refs.retain(|it| {
120-
match if.name.as_name_ref() {
121-
Some(name_ref) => name_ref.syntax().ancestors().any(|it| !matches(it.kind(), USE)),
122+
match it.name.as_name_ref() {
123+
Some(name_ref) => name_ref.syntax().ancestors().any(|it_ref| {
124+
dbg!(&it_ref);
125+
!matches!(it_ref.kind(), USE)
126+
}),
122127
None => true,
123128
}
129+
130+
// this works:
131+
// let file_sema = sema.parse(file_id.clone()).syntax().clone();
132+
133+
// let maybe_node = file_sema.child_or_token_at_range(it.range.clone());
134+
135+
// if let Some(node) = maybe_node {
136+
// let res = match node {
137+
// syntax::NodeOrToken::Node(x) => !matches!(x.kind(), USE),
138+
// syntax::NodeOrToken::Token(_) => true,
139+
// };
140+
// res
141+
// } else {
142+
// true
143+
// }
124144
});
125145
}
126146
}

0 commit comments

Comments
 (0)