diff options
Diffstat (limited to 'crates/ra_ide/src/references.rs')
-rw-r--r-- | crates/ra_ide/src/references.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index fe1c074d1..519e4bf1a 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -172,16 +172,16 @@ fn get_struct_def_name_for_struct_literal_search( | |||
172 | if let Some(name) = | 172 | if let Some(name) = |
173 | sema.find_node_at_offset_with_descend::<ast::Name>(&syntax, left.text_range().start()) | 173 | sema.find_node_at_offset_with_descend::<ast::Name>(&syntax, left.text_range().start()) |
174 | { | 174 | { |
175 | return name.syntax().ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); | 175 | return name.syntax().ancestors().find_map(ast::Struct::cast).and_then(|l| l.name()); |
176 | } | 176 | } |
177 | if sema | 177 | if sema |
178 | .find_node_at_offset_with_descend::<ast::TypeParamList>( | 178 | .find_node_at_offset_with_descend::<ast::GenericParamList>( |
179 | &syntax, | 179 | &syntax, |
180 | left.text_range().start(), | 180 | left.text_range().start(), |
181 | ) | 181 | ) |
182 | .is_some() | 182 | .is_some() |
183 | { | 183 | { |
184 | return left.ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); | 184 | return left.ancestors().find_map(ast::Struct::cast).and_then(|l| l.name()); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | None | 187 | None |
@@ -212,7 +212,7 @@ fn main() { | |||
212 | ); | 212 | ); |
213 | check_result( | 213 | check_result( |
214 | refs, | 214 | refs, |
215 | "Foo STRUCT_DEF FileId(1) 0..26 7..10 Other", | 215 | "Foo STRUCT FileId(1) 0..26 7..10 Other", |
216 | &["FileId(1) 101..104 StructLiteral"], | 216 | &["FileId(1) 101..104 StructLiteral"], |
217 | ); | 217 | ); |
218 | } | 218 | } |
@@ -230,7 +230,7 @@ struct Foo<|> {} | |||
230 | ); | 230 | ); |
231 | check_result( | 231 | check_result( |
232 | refs, | 232 | refs, |
233 | "Foo STRUCT_DEF FileId(1) 0..13 7..10 Other", | 233 | "Foo STRUCT FileId(1) 0..13 7..10 Other", |
234 | &["FileId(1) 41..44 Other", "FileId(1) 54..57 StructLiteral"], | 234 | &["FileId(1) 41..44 Other", "FileId(1) 54..57 StructLiteral"], |
235 | ); | 235 | ); |
236 | } | 236 | } |
@@ -248,7 +248,7 @@ struct Foo<T> <|>{} | |||
248 | ); | 248 | ); |
249 | check_result( | 249 | check_result( |
250 | refs, | 250 | refs, |
251 | "Foo STRUCT_DEF FileId(1) 0..16 7..10 Other", | 251 | "Foo STRUCT FileId(1) 0..16 7..10 Other", |
252 | &["FileId(1) 64..67 StructLiteral"], | 252 | &["FileId(1) 64..67 StructLiteral"], |
253 | ); | 253 | ); |
254 | } | 254 | } |
@@ -267,7 +267,7 @@ fn main() { | |||
267 | ); | 267 | ); |
268 | check_result( | 268 | check_result( |
269 | refs, | 269 | refs, |
270 | "Foo STRUCT_DEF FileId(1) 0..16 7..10 Other", | 270 | "Foo STRUCT FileId(1) 0..16 7..10 Other", |
271 | &["FileId(1) 54..57 StructLiteral"], | 271 | &["FileId(1) 54..57 StructLiteral"], |
272 | ); | 272 | ); |
273 | } | 273 | } |
@@ -361,7 +361,7 @@ fn main(s: Foo) { | |||
361 | ); | 361 | ); |
362 | check_result( | 362 | check_result( |
363 | refs, | 363 | refs, |
364 | "spam RECORD_FIELD_DEF FileId(1) 17..30 21..25 Other", | 364 | "spam RECORD_FIELD FileId(1) 17..30 21..25 Other", |
365 | &["FileId(1) 67..71 Other Read"], | 365 | &["FileId(1) 67..71 Other Read"], |
366 | ); | 366 | ); |
367 | } | 367 | } |
@@ -376,7 +376,7 @@ impl Foo { | |||
376 | } | 376 | } |
377 | "#, | 377 | "#, |
378 | ); | 378 | ); |
379 | check_result(refs, "f FN_DEF FileId(1) 27..43 30..31 Other", &[]); | 379 | check_result(refs, "f FN FileId(1) 27..43 30..31 Other", &[]); |
380 | } | 380 | } |
381 | 381 | ||
382 | #[test] | 382 | #[test] |
@@ -390,7 +390,7 @@ enum Foo { | |||
390 | } | 390 | } |
391 | "#, | 391 | "#, |
392 | ); | 392 | ); |
393 | check_result(refs, "B ENUM_VARIANT FileId(1) 22..23 22..23 Other", &[]); | 393 | check_result(refs, "B VARIANT FileId(1) 22..23 22..23 Other", &[]); |
394 | } | 394 | } |
395 | 395 | ||
396 | #[test] | 396 | #[test] |
@@ -431,7 +431,7 @@ fn f() { | |||
431 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 431 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
432 | check_result( | 432 | check_result( |
433 | refs, | 433 | refs, |
434 | "Foo STRUCT_DEF FileId(2) 17..51 28..31 Other", | 434 | "Foo STRUCT FileId(2) 17..51 28..31 Other", |
435 | &["FileId(1) 53..56 StructLiteral", "FileId(3) 79..82 StructLiteral"], | 435 | &["FileId(1) 53..56 StructLiteral", "FileId(3) 79..82 StructLiteral"], |
436 | ); | 436 | ); |
437 | } | 437 | } |
@@ -486,7 +486,7 @@ pub(super) struct Foo<|> { | |||
486 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 486 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
487 | check_result( | 487 | check_result( |
488 | refs, | 488 | refs, |
489 | "Foo STRUCT_DEF FileId(3) 0..41 18..21 Other", | 489 | "Foo STRUCT FileId(3) 0..41 18..21 Other", |
490 | &["FileId(2) 20..23 Other", "FileId(2) 47..50 StructLiteral"], | 490 | &["FileId(2) 20..23 Other", "FileId(2) 47..50 StructLiteral"], |
491 | ); | 491 | ); |
492 | } | 492 | } |
@@ -514,7 +514,7 @@ pub(super) struct Foo<|> { | |||
514 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 514 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
515 | check_result( | 515 | check_result( |
516 | refs, | 516 | refs, |
517 | "quux FN_DEF FileId(1) 19..35 26..30 Other", | 517 | "quux FN FileId(1) 19..35 26..30 Other", |
518 | &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"], | 518 | &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"], |
519 | ); | 519 | ); |
520 | 520 | ||
@@ -522,7 +522,7 @@ pub(super) struct Foo<|> { | |||
522 | analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); | 522 | analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); |
523 | check_result( | 523 | check_result( |
524 | refs, | 524 | refs, |
525 | "quux FN_DEF FileId(1) 19..35 26..30 Other", | 525 | "quux FN FileId(1) 19..35 26..30 Other", |
526 | &["FileId(3) 16..20 StructLiteral"], | 526 | &["FileId(3) 16..20 StructLiteral"], |
527 | ); | 527 | ); |
528 | } | 528 | } |
@@ -580,7 +580,7 @@ fn foo() { | |||
580 | ); | 580 | ); |
581 | check_result( | 581 | check_result( |
582 | refs, | 582 | refs, |
583 | "f RECORD_FIELD_DEF FileId(1) 15..21 15..16 Other", | 583 | "f RECORD_FIELD FileId(1) 15..21 15..16 Other", |
584 | &["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"], | 584 | &["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"], |
585 | ); | 585 | ); |
586 | } | 586 | } |
@@ -619,7 +619,7 @@ fn main() { | |||
619 | ); | 619 | ); |
620 | check_result( | 620 | check_result( |
621 | refs, | 621 | refs, |
622 | "new FN_DEF FileId(1) 54..101 61..64 Other", | 622 | "new FN FileId(1) 54..101 61..64 Other", |
623 | &["FileId(1) 146..149 StructLiteral"], | 623 | &["FileId(1) 146..149 StructLiteral"], |
624 | ); | 624 | ); |
625 | } | 625 | } |
@@ -646,7 +646,7 @@ fn main() { | |||
646 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 646 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
647 | check_result( | 647 | check_result( |
648 | refs, | 648 | refs, |
649 | "f FN_DEF FileId(1) 26..35 29..30 Other", | 649 | "f FN FileId(1) 26..35 29..30 Other", |
650 | &["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"], | 650 | &["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"], |
651 | ); | 651 | ); |
652 | } | 652 | } |