aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/references.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-12-17 11:29:05 +0000
committerAleksey Kladov <[email protected]>2020-12-18 16:28:48 +0000
commit55ba353b39db1e9d850f1df943ab6a16e7c15838 (patch)
treec29c3a31ea9e046d2767dfc189e0ab77b8ffdafe /crates/ide/src/references.rs
parent2465fa02b7aa268d7d711b81417e7717427217c3 (diff)
Don't expose SyntaxKind from IDE API
SyntaxKind is somewhat of an internal type, but IDE is using it to basically specify an icon. Let's have a dedicated entity for this instead.
Diffstat (limited to 'crates/ide/src/references.rs')
-rw-r--r--crates/ide/src/references.rs72
1 files changed, 36 insertions, 36 deletions
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index 98190a86b..d8069eb64 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -24,7 +24,7 @@ use syntax::{
24 match_ast, AstNode, SyntaxKind, SyntaxNode, TextRange, TokenAtOffset, 24 match_ast, AstNode, SyntaxKind, SyntaxNode, TextRange, TokenAtOffset,
25}; 25};
26 26
27use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeInfo}; 27use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeInfo, SymbolKind};
28 28
29#[derive(Debug, Clone)] 29#[derive(Debug, Clone)]
30pub struct ReferenceSearchResult { 30pub struct ReferenceSearchResult {
@@ -278,7 +278,7 @@ fn try_find_self_references(
278 full_range: self_param.syntax().text_range(), 278 full_range: self_param.syntax().text_range(),
279 focus_range: Some(param_self_token.text_range()), 279 focus_range: Some(param_self_token.text_range()),
280 name: param_self_token.text().clone(), 280 name: param_self_token.text().clone(),
281 kind: param_self_token.kind(), 281 kind: SymbolKind::SelfParam,
282 container_name: None, 282 container_name: None,
283 description: None, 283 description: None,
284 docs: None, 284 docs: None,
@@ -343,7 +343,7 @@ fn main() {
343} 343}
344"#, 344"#,
345 expect![[r#" 345 expect![[r#"
346 Foo STRUCT FileId(0) 0..26 7..10 Other 346 Foo Struct FileId(0) 0..26 7..10 Other
347 347
348 FileId(0) 101..104 StructLiteral 348 FileId(0) 101..104 StructLiteral
349 "#]], 349 "#]],
@@ -361,7 +361,7 @@ struct Foo<|> {}
361} 361}
362"#, 362"#,
363 expect![[r#" 363 expect![[r#"
364 Foo STRUCT FileId(0) 0..13 7..10 Other 364 Foo Struct FileId(0) 0..13 7..10 Other
365 365
366 FileId(0) 41..44 Other 366 FileId(0) 41..44 Other
367 FileId(0) 54..57 StructLiteral 367 FileId(0) 54..57 StructLiteral
@@ -380,7 +380,7 @@ struct Foo<T> <|>{}
380} 380}
381"#, 381"#,
382 expect![[r#" 382 expect![[r#"
383 Foo STRUCT FileId(0) 0..16 7..10 Other 383 Foo Struct FileId(0) 0..16 7..10 Other
384 384
385 FileId(0) 64..67 StructLiteral 385 FileId(0) 64..67 StructLiteral
386 "#]], 386 "#]],
@@ -399,7 +399,7 @@ fn main() {
399} 399}
400"#, 400"#,
401 expect![[r#" 401 expect![[r#"
402 Foo STRUCT FileId(0) 0..16 7..10 Other 402 Foo Struct FileId(0) 0..16 7..10 Other
403 403
404 FileId(0) 54..57 StructLiteral 404 FileId(0) 54..57 StructLiteral
405 "#]], 405 "#]],
@@ -420,7 +420,7 @@ fn main() {
420} 420}
421"#, 421"#,
422 expect![[r#" 422 expect![[r#"
423 Foo ENUM FileId(0) 0..26 5..8 Other 423 Foo Enum FileId(0) 0..26 5..8 Other
424 424
425 FileId(0) 63..66 EnumLiteral 425 FileId(0) 63..66 EnumLiteral
426 "#]], 426 "#]],
@@ -441,7 +441,7 @@ fn main() {
441} 441}
442"#, 442"#,
443 expect![[r#" 443 expect![[r#"
444 Foo ENUM FileId(0) 0..26 5..8 Other 444 Foo Enum FileId(0) 0..26 5..8 Other
445 445
446 FileId(0) 50..53 Other 446 FileId(0) 50..53 Other
447 FileId(0) 63..66 EnumLiteral 447 FileId(0) 63..66 EnumLiteral
@@ -463,7 +463,7 @@ fn main() {
463} 463}
464"#, 464"#,
465 expect![[r#" 465 expect![[r#"
466 Foo ENUM FileId(0) 0..32 5..8 Other 466 Foo Enum FileId(0) 0..32 5..8 Other
467 467
468 FileId(0) 73..76 EnumLiteral 468 FileId(0) 73..76 EnumLiteral
469 "#]], 469 "#]],
@@ -484,7 +484,7 @@ fn main() {
484} 484}
485"#, 485"#,
486 expect![[r#" 486 expect![[r#"
487 Foo ENUM FileId(0) 0..33 5..8 Other 487 Foo Enum FileId(0) 0..33 5..8 Other
488 488
489 FileId(0) 70..73 EnumLiteral 489 FileId(0) 70..73 EnumLiteral
490 "#]], 490 "#]],
@@ -507,7 +507,7 @@ fn main() {
507 i = 5; 507 i = 5;
508}"#, 508}"#,
509 expect![[r#" 509 expect![[r#"
510 i IDENT_PAT FileId(0) 24..25 Other Write 510 i Local FileId(0) 24..25 Other Write
511 511
512 FileId(0) 50..51 Other Write 512 FileId(0) 50..51 Other Write
513 FileId(0) 54..55 Other Read 513 FileId(0) 54..55 Other Read
@@ -531,7 +531,7 @@ fn bar() {
531} 531}
532"#, 532"#,
533 expect![[r#" 533 expect![[r#"
534 spam IDENT_PAT FileId(0) 19..23 Other 534 spam Local FileId(0) 19..23 Other
535 535
536 FileId(0) 34..38 Other Read 536 FileId(0) 34..38 Other Read
537 FileId(0) 41..45 Other Read 537 FileId(0) 41..45 Other Read
@@ -546,7 +546,7 @@ fn bar() {
546fn foo(i : u32) -> u32 { i<|> } 546fn foo(i : u32) -> u32 { i<|> }
547"#, 547"#,
548 expect![[r#" 548 expect![[r#"
549 i IDENT_PAT FileId(0) 7..8 Other 549 i Local FileId(0) 7..8 Other
550 550
551 FileId(0) 25..26 Other Read 551 FileId(0) 25..26 Other Read
552 "#]], 552 "#]],
@@ -560,7 +560,7 @@ fn foo(i : u32) -> u32 { i<|> }
560fn foo(i<|> : u32) -> u32 { i } 560fn foo(i<|> : u32) -> u32 { i }
561"#, 561"#,
562 expect![[r#" 562 expect![[r#"
563 i IDENT_PAT FileId(0) 7..8 Other 563 i Local FileId(0) 7..8 Other
564 564
565 FileId(0) 25..26 Other Read 565 FileId(0) 25..26 Other Read
566 "#]], 566 "#]],
@@ -581,7 +581,7 @@ fn main(s: Foo) {
581} 581}
582"#, 582"#,
583 expect![[r#" 583 expect![[r#"
584 spam RECORD_FIELD FileId(0) 17..30 21..25 Other 584 spam Field FileId(0) 17..30 21..25 Other
585 585
586 FileId(0) 67..71 Other Read 586 FileId(0) 67..71 Other Read
587 "#]], 587 "#]],
@@ -598,7 +598,7 @@ impl Foo {
598} 598}
599"#, 599"#,
600 expect![[r#" 600 expect![[r#"
601 f FN FileId(0) 27..43 30..31 Other 601 f Function FileId(0) 27..43 30..31 Other
602 602
603 "#]], 603 "#]],
604 ); 604 );
@@ -615,7 +615,7 @@ enum Foo {
615} 615}
616"#, 616"#,
617 expect![[r#" 617 expect![[r#"
618 B VARIANT FileId(0) 22..23 22..23 Other 618 B Variant FileId(0) 22..23 22..23 Other
619 619
620 "#]], 620 "#]],
621 ); 621 );
@@ -632,7 +632,7 @@ enum Foo {
632} 632}
633"#, 633"#,
634 expect![[r#" 634 expect![[r#"
635 field RECORD_FIELD FileId(0) 26..35 26..31 Other 635 field Field FileId(0) 26..35 26..31 Other
636 636
637 "#]], 637 "#]],
638 ); 638 );
@@ -673,7 +673,7 @@ fn f() {
673} 673}
674"#, 674"#,
675 expect![[r#" 675 expect![[r#"
676 Foo STRUCT FileId(1) 17..51 28..31 Other 676 Foo Struct FileId(1) 17..51 28..31 Other
677 677
678 FileId(0) 53..56 StructLiteral 678 FileId(0) 53..56 StructLiteral
679 FileId(2) 79..82 StructLiteral 679 FileId(2) 79..82 StructLiteral
@@ -703,7 +703,7 @@ pub struct Foo {
703} 703}
704"#, 704"#,
705 expect![[r#" 705 expect![[r#"
706 foo SOURCE_FILE FileId(1) 0..35 Other 706 foo Module FileId(1) 0..35 Other
707 707
708 FileId(0) 14..17 Other 708 FileId(0) 14..17 Other
709 "#]], 709 "#]],
@@ -731,7 +731,7 @@ pub(super) struct Foo<|> {
731} 731}
732"#, 732"#,
733 expect![[r#" 733 expect![[r#"
734 Foo STRUCT FileId(2) 0..41 18..21 Other 734 Foo Struct FileId(2) 0..41 18..21 Other
735 735
736 FileId(1) 20..23 Other 736 FileId(1) 20..23 Other
737 FileId(1) 47..50 StructLiteral 737 FileId(1) 47..50 StructLiteral
@@ -759,7 +759,7 @@ pub(super) struct Foo<|> {
759 code, 759 code,
760 None, 760 None,
761 expect![[r#" 761 expect![[r#"
762 quux FN FileId(0) 19..35 26..30 Other 762 quux Function FileId(0) 19..35 26..30 Other
763 763
764 FileId(1) 16..20 StructLiteral 764 FileId(1) 16..20 StructLiteral
765 FileId(2) 16..20 StructLiteral 765 FileId(2) 16..20 StructLiteral
@@ -770,7 +770,7 @@ pub(super) struct Foo<|> {
770 code, 770 code,
771 Some(SearchScope::single_file(FileId(2))), 771 Some(SearchScope::single_file(FileId(2))),
772 expect![[r#" 772 expect![[r#"
773 quux FN FileId(0) 19..35 26..30 Other 773 quux Function FileId(0) 19..35 26..30 Other
774 774
775 FileId(2) 16..20 StructLiteral 775 FileId(2) 16..20 StructLiteral
776 "#]], 776 "#]],
@@ -790,7 +790,7 @@ fn foo() {
790} 790}
791"#, 791"#,
792 expect![[r#" 792 expect![[r#"
793 m1 MACRO_RULES FileId(0) 0..46 29..31 Other 793 m1 Macro FileId(0) 0..46 29..31 Other
794 794
795 FileId(0) 63..65 StructLiteral 795 FileId(0) 63..65 StructLiteral
796 FileId(0) 73..75 StructLiteral 796 FileId(0) 73..75 StructLiteral
@@ -808,7 +808,7 @@ fn foo() {
808} 808}
809"#, 809"#,
810 expect![[r#" 810 expect![[r#"
811 i IDENT_PAT FileId(0) 23..24 Other Write 811 i Local FileId(0) 23..24 Other Write
812 812
813 FileId(0) 34..35 Other Write 813 FileId(0) 34..35 Other Write
814 FileId(0) 38..39 Other Read 814 FileId(0) 38..39 Other Read
@@ -830,7 +830,7 @@ fn foo() {
830} 830}
831"#, 831"#,
832 expect![[r#" 832 expect![[r#"
833 f RECORD_FIELD FileId(0) 15..21 15..16 Other 833 f Field FileId(0) 15..21 15..16 Other
834 834
835 FileId(0) 55..56 RecordFieldExprOrPat Read 835 FileId(0) 55..56 RecordFieldExprOrPat Read
836 FileId(0) 68..69 Other Write 836 FileId(0) 68..69 Other Write
@@ -848,7 +848,7 @@ fn foo() {
848} 848}
849"#, 849"#,
850 expect![[r#" 850 expect![[r#"
851 i IDENT_PAT FileId(0) 19..20 Other 851 i Local FileId(0) 19..20 Other
852 852
853 FileId(0) 26..27 Other Write 853 FileId(0) 26..27 Other Write
854 "#]], 854 "#]],
@@ -872,7 +872,7 @@ fn main() {
872} 872}
873"#, 873"#,
874 expect![[r#" 874 expect![[r#"
875 new FN FileId(0) 54..81 61..64 Other 875 new Function FileId(0) 54..81 61..64 Other
876 876
877 FileId(0) 126..129 StructLiteral 877 FileId(0) 126..129 StructLiteral
878 "#]], 878 "#]],
@@ -894,7 +894,7 @@ use crate::f;
894fn g() { f(); } 894fn g() { f(); }
895"#, 895"#,
896 expect![[r#" 896 expect![[r#"
897 f FN FileId(0) 22..31 25..26 Other 897 f Function FileId(0) 22..31 25..26 Other
898 898
899 FileId(1) 11..12 Other 899 FileId(1) 11..12 Other
900 FileId(1) 24..25 StructLiteral 900 FileId(1) 24..25 StructLiteral
@@ -917,7 +917,7 @@ fn f(s: S) {
917} 917}
918"#, 918"#,
919 expect![[r#" 919 expect![[r#"
920 field RECORD_FIELD FileId(0) 15..24 15..20 Other 920 field Field FileId(0) 15..24 15..20 Other
921 921
922 FileId(0) 68..73 FieldShorthandForField Read 922 FileId(0) 68..73 FieldShorthandForField Read
923 "#]], 923 "#]],
@@ -941,7 +941,7 @@ fn f(e: En) {
941} 941}
942"#, 942"#,
943 expect![[r#" 943 expect![[r#"
944 field RECORD_FIELD FileId(0) 32..41 32..37 Other 944 field Field FileId(0) 32..41 32..37 Other
945 945
946 FileId(0) 102..107 FieldShorthandForField Read 946 FileId(0) 102..107 FieldShorthandForField Read
947 "#]], 947 "#]],
@@ -965,7 +965,7 @@ fn f() -> m::En {
965} 965}
966"#, 966"#,
967 expect![[r#" 967 expect![[r#"
968 field RECORD_FIELD FileId(0) 56..65 56..61 Other 968 field Field FileId(0) 56..65 56..61 Other
969 969
970 FileId(0) 125..130 RecordFieldExprOrPat Read 970 FileId(0) 125..130 RecordFieldExprOrPat Read
971 "#]], 971 "#]],
@@ -990,7 +990,7 @@ impl Foo {
990} 990}
991"#, 991"#,
992 expect![[r#" 992 expect![[r#"
993 self SELF_KW FileId(0) 47..51 47..51 SelfKw Read 993 self SelfParam FileId(0) 47..51 47..51 SelfKw Read
994 994
995 FileId(0) 71..75 SelfKw Read 995 FileId(0) 71..75 SelfKw Read
996 FileId(0) 152..156 SelfKw Read 996 FileId(0) 152..156 SelfKw Read
@@ -1038,7 +1038,7 @@ fn foo<'a, 'b: 'a>(x: &'a<|> ()) -> &'a () where &'a (): Foo<'a> {
1038} 1038}
1039"#, 1039"#,
1040 expect![[r#" 1040 expect![[r#"
1041 'a LIFETIME_PARAM FileId(0) 55..57 55..57 Lifetime 1041 'a LifetimeParam FileId(0) 55..57 55..57 Lifetime
1042 1042
1043 FileId(0) 63..65 Lifetime 1043 FileId(0) 63..65 Lifetime
1044 FileId(0) 71..73 Lifetime 1044 FileId(0) 71..73 Lifetime
@@ -1056,7 +1056,7 @@ fn foo<'a, 'b: 'a>(x: &'a<|> ()) -> &'a () where &'a (): Foo<'a> {
1056type Foo<'a, T> where T: 'a<|> = &'a T; 1056type Foo<'a, T> where T: 'a<|> = &'a T;
1057"#, 1057"#,
1058 expect![[r#" 1058 expect![[r#"
1059 'a LIFETIME_PARAM FileId(0) 9..11 9..11 Lifetime 1059 'a LifetimeParam FileId(0) 9..11 9..11 Lifetime
1060 1060
1061 FileId(0) 25..27 Lifetime 1061 FileId(0) 25..27 Lifetime
1062 FileId(0) 31..33 Lifetime 1062 FileId(0) 31..33 Lifetime
@@ -1078,7 +1078,7 @@ impl<'a> Foo<'a> for &'a () {
1078} 1078}
1079"#, 1079"#,
1080 expect![[r#" 1080 expect![[r#"
1081 'a LIFETIME_PARAM FileId(0) 47..49 47..49 Lifetime 1081 'a LifetimeParam FileId(0) 47..49 47..49 Lifetime
1082 1082
1083 FileId(0) 55..57 Lifetime 1083 FileId(0) 55..57 Lifetime
1084 FileId(0) 64..66 Lifetime 1084 FileId(0) 64..66 Lifetime