This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,32 @@ pub(crate) fn find_all_refs(
115
115
}
116
116
117
117
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 {
119
121
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
+ } ) ,
122
127
None => true ,
123
128
}
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
+ // }
124
144
} ) ;
125
145
}
126
146
}
You can’t perform that action at this time.
0 commit comments