aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-06-21 18:14:08 +0100
committerBenjamin Coenen <[email protected]>2020-06-21 18:14:08 +0100
commit3df879f139b0a40f400c23cb495eaf776b325047 (patch)
treed4b3ee2869b6410b02577087aea915961ea3a05c /crates
parent3f26c5758d7beb1207ed187b71fe9fa6fcaa03ec (diff)
don't complete top level attrs inside nested attrs and add better labels #4899
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/completion/complete_attribute.rs121
1 files changed, 105 insertions, 16 deletions
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs
index 9c7ccc950..443b3b87d 100644
--- a/crates/ra_ide/src/completion/complete_attribute.rs
+++ b/crates/ra_ide/src/completion/complete_attribute.rs
@@ -42,6 +42,10 @@ fn complete_attribute_start(acc: &mut Completions, ctx: &CompletionContext, attr
42 ) 42 )
43 .kind(CompletionItemKind::Attribute); 43 .kind(CompletionItemKind::Attribute);
44 44
45 if let Some(lookup) = attr_completion.lookup {
46 item = item.lookup_by(lookup);
47 }
48
45 match (attr_completion.snippet, ctx.config.snippet_cap) { 49 match (attr_completion.snippet, ctx.config.snippet_cap) {
46 (Some(snippet), Some(cap)) => { 50 (Some(snippet), Some(cap)) => {
47 item = item.insert_snippet(cap, snippet); 51 item = item.insert_snippet(cap, snippet);
@@ -57,114 +61,160 @@ fn complete_attribute_start(acc: &mut Completions, ctx: &CompletionContext, attr
57 61
58struct AttrCompletion { 62struct AttrCompletion {
59 label: &'static str, 63 label: &'static str,
64 lookup: Option<&'static str>,
60 snippet: Option<&'static str>, 65 snippet: Option<&'static str>,
61 should_be_inner: bool, 66 should_be_inner: bool,
62} 67}
63 68
64const ATTRIBUTES: &[AttrCompletion] = &[ 69const ATTRIBUTES: &[AttrCompletion] = &[
65 AttrCompletion { 70 AttrCompletion {
66 label: "allow(…)", snippet: Some("allow(${0:lint})"), should_be_inner: false 71 label: "allow(…)",
72 snippet: Some("allow(${0:lint})"),
73 should_be_inner: false,
74 lookup: Some("allow"),
67 }, 75 },
68 AttrCompletion { 76 AttrCompletion {
69 label: "cfg_attr(…)", 77 label: "cfg_attr(…)",
70 snippet: Some("cfg_attr(${1:predicate}, ${0:attr})"), 78 snippet: Some("cfg_attr(${1:predicate}, ${0:attr})"),
71 should_be_inner: false, 79 should_be_inner: false,
80 lookup: Some("cfg_attr"),
72 }, 81 },
73 AttrCompletion { 82 AttrCompletion {
74 label: "cfg(…)", 83 label: "cfg(…)",
75 snippet: Some("cfg(${0:predicate})"), 84 snippet: Some("cfg(${0:predicate})"),
76 should_be_inner: false, 85 should_be_inner: false,
86 lookup: Some("cfg"),
87 },
88 AttrCompletion {
89 label: "deny(…)",
90 snippet: Some("deny(${0:lint})"),
91 should_be_inner: false,
92 lookup: Some("deny"),
77 }, 93 },
78 AttrCompletion { label: "deny(…)", snippet: Some("deny(${0:lint})"), should_be_inner: false },
79 AttrCompletion { 94 AttrCompletion {
80 label: r#"deprecated = "…""#, 95 label: r#"deprecated = "…""#,
81 snippet: Some(r#"deprecated = "${0:reason}""#), 96 snippet: Some(r#"deprecated = "${0:reason}""#),
82 should_be_inner: false, 97 should_be_inner: false,
98 lookup: Some("deprecated"),
83 }, 99 },
84 AttrCompletion { 100 AttrCompletion {
85 label: "derive(…)", 101 label: "derive(…)",
86 snippet: Some(r#"derive(${0:Debug})"#), 102 snippet: Some(r#"derive(${0:Debug})"#),
87 should_be_inner: false, 103 should_be_inner: false,
104 lookup: Some("derive"),
88 }, 105 },
89 AttrCompletion { 106 AttrCompletion {
90 label: r#"doc = "…""#, 107 label: r#"doc = "…""#,
91 snippet: Some(r#"doc = "${0:docs}""#), 108 snippet: Some(r#"doc = "${0:docs}""#),
92 should_be_inner: false, 109 should_be_inner: false,
110 lookup: Some("doc"),
93 }, 111 },
94 AttrCompletion { 112 AttrCompletion {
95 label: "feature(…)", 113 label: "feature(…)",
96 snippet: Some("feature(${0:flag})"), 114 snippet: Some("feature(${0:flag})"),
97 should_be_inner: true, 115 should_be_inner: true,
116 lookup: Some("feature"),
98 }, 117 },
99 AttrCompletion { 118 AttrCompletion {
100 label: "forbid(…)", 119 label: "forbid(…)",
101 snippet: Some("forbid(${0:lint})"), 120 snippet: Some("forbid(${0:lint})"),
102 should_be_inner: false, 121 should_be_inner: false,
122 lookup: Some("forbid"),
103 }, 123 },
104 // FIXME: resolve through macro resolution? 124 // FIXME: resolve through macro resolution?
105 AttrCompletion { label: "global_allocator", snippet: None, should_be_inner: true }, 125 AttrCompletion {
126 label: "global_allocator",
127 snippet: None,
128 should_be_inner: true,
129 lookup: None,
130 },
106 AttrCompletion { 131 AttrCompletion {
107 label: "ignore(…)", 132 label: "ignore(…)",
108 snippet: Some("ignore(${0:lint})"), 133 snippet: Some("ignore(${0:lint})"),
109 should_be_inner: false, 134 should_be_inner: false,
135 lookup: Some("ignore"),
110 }, 136 },
111 AttrCompletion { 137 AttrCompletion {
112 label: "inline(…)", 138 label: "inline(…)",
113 snippet: Some("inline(${0:lint})"), 139 snippet: Some("inline(${0:lint})"),
114 should_be_inner: false, 140 should_be_inner: false,
141 lookup: Some("inline"),
115 }, 142 },
116 AttrCompletion { 143 AttrCompletion {
117 label: r#"link_name = "…""#, 144 label: r#"link_name = "…""#,
118 snippet: Some(r#"link_name = "${0:symbol_name}""#), 145 snippet: Some(r#"link_name = "${0:symbol_name}""#),
119 should_be_inner: false, 146 should_be_inner: false,
147 lookup: Some("link_name"),
120 }, 148 },
121 AttrCompletion { label: "link", snippet: None, should_be_inner: false }, 149 AttrCompletion { label: "link", snippet: None, should_be_inner: false, lookup: None },
122 AttrCompletion { label: "macro_export", snippet: None, should_be_inner: false }, 150 AttrCompletion { label: "macro_export", snippet: None, should_be_inner: false, lookup: None },
123 AttrCompletion { label: "macro_use", snippet: None, should_be_inner: false }, 151 AttrCompletion { label: "macro_use", snippet: None, should_be_inner: false, lookup: None },
124 AttrCompletion { 152 AttrCompletion {
125 label: r#"must_use = "…""#, 153 label: r#"must_use = "…""#,
126 snippet: Some(r#"must_use = "${0:reason}""#), 154 snippet: Some(r#"must_use = "${0:reason}""#),
127 should_be_inner: false, 155 should_be_inner: false,
156 lookup: Some("must_use"),
128 }, 157 },
129 AttrCompletion { label: "no_mangle", snippet: None, should_be_inner: false }, 158 AttrCompletion { label: "no_mangle", snippet: None, should_be_inner: false, lookup: None },
130 AttrCompletion { label: "no_std", snippet: None, should_be_inner: true }, 159 AttrCompletion { label: "no_std", snippet: None, should_be_inner: true, lookup: None },
131 AttrCompletion { label: "non_exhaustive", snippet: None, should_be_inner: false }, 160 AttrCompletion { label: "non_exhaustive", snippet: None, should_be_inner: false, lookup: None },
132 AttrCompletion { label: "panic_handler", snippet: None, should_be_inner: true }, 161 AttrCompletion { label: "panic_handler", snippet: None, should_be_inner: true, lookup: None },
133 AttrCompletion { 162 AttrCompletion {
134 label: "path = \"…\"", 163 label: "path = \"…\"",
135 snippet: Some("path =\"${0:path}\""), 164 snippet: Some("path =\"${0:path}\""),
136 should_be_inner: false, 165 should_be_inner: false,
166 lookup: Some("path"),
167 },
168 AttrCompletion { label: "proc_macro", snippet: None, should_be_inner: false, lookup: None },
169 AttrCompletion {
170 label: "proc_macro_attribute",
171 snippet: None,
172 should_be_inner: false,
173 lookup: None,
137 }, 174 },
138 AttrCompletion { label: "proc_macro", snippet: None, should_be_inner: false },
139 AttrCompletion { label: "proc_macro_attribute", snippet: None, should_be_inner: false },
140 AttrCompletion { 175 AttrCompletion {
141 label: "proc_macro_derive(…)", 176 label: "proc_macro_derive(…)",
142 snippet: Some("proc_macro_derive(${0:Trait})"), 177 snippet: Some("proc_macro_derive(${0:Trait})"),
143 should_be_inner: false, 178 should_be_inner: false,
179 lookup: Some("proc_macro_derive"),
144 }, 180 },
145 AttrCompletion { 181 AttrCompletion {
146 label: "recursion_limit = …", 182 label: "recursion_limit = …",
147 snippet: Some("recursion_limit = ${0:128}"), 183 snippet: Some("recursion_limit = ${0:128}"),
148 should_be_inner: true, 184 should_be_inner: true,
185 lookup: Some("recursion_limit"),
186 },
187 AttrCompletion {
188 label: "repr(…)",
189 snippet: Some("repr(${0:C})"),
190 should_be_inner: false,
191 lookup: Some("repr"),
149 }, 192 },
150 AttrCompletion { label: "repr(…)", snippet: Some("repr(${0:C})"), should_be_inner: false },
151 AttrCompletion { 193 AttrCompletion {
152 label: "should_panic(…)", 194 label: "should_panic(…)",
153 snippet: Some(r#"should_panic(expected = "${0:reason}")"#), 195 snippet: Some(r#"should_panic(expected = "${0:reason}")"#),
154 should_be_inner: false, 196 should_be_inner: false,
197 lookup: Some("should_panic"),
155 }, 198 },
156 AttrCompletion { 199 AttrCompletion {
157 label: r#"target_feature = "…""#, 200 label: r#"target_feature = "…""#,
158 snippet: Some("target_feature = \"${0:feature}\""), 201 snippet: Some("target_feature = \"${0:feature}\""),
159 should_be_inner: false, 202 should_be_inner: false,
203 lookup: Some("target_feature"),
204 },
205 AttrCompletion { label: "test", snippet: None, should_be_inner: false, lookup: None },
206 AttrCompletion { label: "used", snippet: None, should_be_inner: false, lookup: None },
207 AttrCompletion {
208 label: "warn(…)",
209 snippet: Some("warn(${0:lint})"),
210 should_be_inner: false,
211 lookup: Some("warn"),
160 }, 212 },
161 AttrCompletion { label: "test", snippet: None, should_be_inner: false },
162 AttrCompletion { label: "used", snippet: None, should_be_inner: false },
163 AttrCompletion { label: "warn(…)", snippet: Some("warn(${0:lint})"), should_be_inner: false },
164 AttrCompletion { 213 AttrCompletion {
165 label: r#"windows_subsystem = "…""#, 214 label: r#"windows_subsystem = "…""#,
166 snippet: Some(r#"windows_subsystem = "${0:subsystem}""#), 215 snippet: Some(r#"windows_subsystem = "${0:subsystem}""#),
167 should_be_inner: true, 216 should_be_inner: true,
217 lookup: Some("windows_subsystem"),
168 }, 218 },
169]; 219];
170 220
@@ -457,6 +507,7 @@ mod tests {
457 delete: 19..19, 507 delete: 19..19,
458 insert: "allow(${0:lint})", 508 insert: "allow(${0:lint})",
459 kind: Attribute, 509 kind: Attribute,
510 lookup: "allow",
460 }, 511 },
461 CompletionItem { 512 CompletionItem {
462 label: "cfg(…)", 513 label: "cfg(…)",
@@ -464,6 +515,7 @@ mod tests {
464 delete: 19..19, 515 delete: 19..19,
465 insert: "cfg(${0:predicate})", 516 insert: "cfg(${0:predicate})",
466 kind: Attribute, 517 kind: Attribute,
518 lookup: "cfg",
467 }, 519 },
468 CompletionItem { 520 CompletionItem {
469 label: "cfg_attr(…)", 521 label: "cfg_attr(…)",
@@ -471,6 +523,7 @@ mod tests {
471 delete: 19..19, 523 delete: 19..19,
472 insert: "cfg_attr(${1:predicate}, ${0:attr})", 524 insert: "cfg_attr(${1:predicate}, ${0:attr})",
473 kind: Attribute, 525 kind: Attribute,
526 lookup: "cfg_attr",
474 }, 527 },
475 CompletionItem { 528 CompletionItem {
476 label: "deny(…)", 529 label: "deny(…)",
@@ -478,6 +531,7 @@ mod tests {
478 delete: 19..19, 531 delete: 19..19,
479 insert: "deny(${0:lint})", 532 insert: "deny(${0:lint})",
480 kind: Attribute, 533 kind: Attribute,
534 lookup: "deny",
481 }, 535 },
482 CompletionItem { 536 CompletionItem {
483 label: "deprecated = \"…\"", 537 label: "deprecated = \"…\"",
@@ -485,6 +539,7 @@ mod tests {
485 delete: 19..19, 539 delete: 19..19,
486 insert: "deprecated = \"${0:reason}\"", 540 insert: "deprecated = \"${0:reason}\"",
487 kind: Attribute, 541 kind: Attribute,
542 lookup: "deprecated",
488 }, 543 },
489 CompletionItem { 544 CompletionItem {
490 label: "derive(…)", 545 label: "derive(…)",
@@ -492,6 +547,7 @@ mod tests {
492 delete: 19..19, 547 delete: 19..19,
493 insert: "derive(${0:Debug})", 548 insert: "derive(${0:Debug})",
494 kind: Attribute, 549 kind: Attribute,
550 lookup: "derive",
495 }, 551 },
496 CompletionItem { 552 CompletionItem {
497 label: "doc = \"…\"", 553 label: "doc = \"…\"",
@@ -499,6 +555,7 @@ mod tests {
499 delete: 19..19, 555 delete: 19..19,
500 insert: "doc = \"${0:docs}\"", 556 insert: "doc = \"${0:docs}\"",
501 kind: Attribute, 557 kind: Attribute,
558 lookup: "doc",
502 }, 559 },
503 CompletionItem { 560 CompletionItem {
504 label: "forbid(…)", 561 label: "forbid(…)",
@@ -506,6 +563,7 @@ mod tests {
506 delete: 19..19, 563 delete: 19..19,
507 insert: "forbid(${0:lint})", 564 insert: "forbid(${0:lint})",
508 kind: Attribute, 565 kind: Attribute,
566 lookup: "forbid",
509 }, 567 },
510 CompletionItem { 568 CompletionItem {
511 label: "ignore(…)", 569 label: "ignore(…)",
@@ -513,6 +571,7 @@ mod tests {
513 delete: 19..19, 571 delete: 19..19,
514 insert: "ignore(${0:lint})", 572 insert: "ignore(${0:lint})",
515 kind: Attribute, 573 kind: Attribute,
574 lookup: "ignore",
516 }, 575 },
517 CompletionItem { 576 CompletionItem {
518 label: "inline(…)", 577 label: "inline(…)",
@@ -520,6 +579,7 @@ mod tests {
520 delete: 19..19, 579 delete: 19..19,
521 insert: "inline(${0:lint})", 580 insert: "inline(${0:lint})",
522 kind: Attribute, 581 kind: Attribute,
582 lookup: "inline",
523 }, 583 },
524 CompletionItem { 584 CompletionItem {
525 label: "link", 585 label: "link",
@@ -534,6 +594,7 @@ mod tests {
534 delete: 19..19, 594 delete: 19..19,
535 insert: "link_name = \"${0:symbol_name}\"", 595 insert: "link_name = \"${0:symbol_name}\"",
536 kind: Attribute, 596 kind: Attribute,
597 lookup: "link_name",
537 }, 598 },
538 CompletionItem { 599 CompletionItem {
539 label: "macro_export", 600 label: "macro_export",
@@ -555,6 +616,7 @@ mod tests {
555 delete: 19..19, 616 delete: 19..19,
556 insert: "must_use = \"${0:reason}\"", 617 insert: "must_use = \"${0:reason}\"",
557 kind: Attribute, 618 kind: Attribute,
619 lookup: "must_use",
558 }, 620 },
559 CompletionItem { 621 CompletionItem {
560 label: "no_mangle", 622 label: "no_mangle",
@@ -576,6 +638,7 @@ mod tests {
576 delete: 19..19, 638 delete: 19..19,
577 insert: "path =\"${0:path}\"", 639 insert: "path =\"${0:path}\"",
578 kind: Attribute, 640 kind: Attribute,
641 lookup: "path",
579 }, 642 },
580 CompletionItem { 643 CompletionItem {
581 label: "proc_macro", 644 label: "proc_macro",
@@ -597,6 +660,7 @@ mod tests {
597 delete: 19..19, 660 delete: 19..19,
598 insert: "proc_macro_derive(${0:Trait})", 661 insert: "proc_macro_derive(${0:Trait})",
599 kind: Attribute, 662 kind: Attribute,
663 lookup: "proc_macro_derive",
600 }, 664 },
601 CompletionItem { 665 CompletionItem {
602 label: "repr(…)", 666 label: "repr(…)",
@@ -604,6 +668,7 @@ mod tests {
604 delete: 19..19, 668 delete: 19..19,
605 insert: "repr(${0:C})", 669 insert: "repr(${0:C})",
606 kind: Attribute, 670 kind: Attribute,
671 lookup: "repr",
607 }, 672 },
608 CompletionItem { 673 CompletionItem {
609 label: "should_panic(…)", 674 label: "should_panic(…)",
@@ -611,6 +676,7 @@ mod tests {
611 delete: 19..19, 676 delete: 19..19,
612 insert: "should_panic(expected = \"${0:reason}\")", 677 insert: "should_panic(expected = \"${0:reason}\")",
613 kind: Attribute, 678 kind: Attribute,
679 lookup: "should_panic",
614 }, 680 },
615 CompletionItem { 681 CompletionItem {
616 label: "target_feature = \"…\"", 682 label: "target_feature = \"…\"",
@@ -618,6 +684,7 @@ mod tests {
618 delete: 19..19, 684 delete: 19..19,
619 insert: "target_feature = \"${0:feature}\"", 685 insert: "target_feature = \"${0:feature}\"",
620 kind: Attribute, 686 kind: Attribute,
687 lookup: "target_feature",
621 }, 688 },
622 CompletionItem { 689 CompletionItem {
623 label: "test", 690 label: "test",
@@ -639,6 +706,7 @@ mod tests {
639 delete: 19..19, 706 delete: 19..19,
640 insert: "warn(${0:lint})", 707 insert: "warn(${0:lint})",
641 kind: Attribute, 708 kind: Attribute,
709 lookup: "warn",
642 }, 710 },
643 ] 711 ]
644 "### 712 "###
@@ -675,6 +743,7 @@ mod tests {
675 delete: 20..20, 743 delete: 20..20,
676 insert: "allow(${0:lint})", 744 insert: "allow(${0:lint})",
677 kind: Attribute, 745 kind: Attribute,
746 lookup: "allow",
678 }, 747 },
679 CompletionItem { 748 CompletionItem {
680 label: "cfg(…)", 749 label: "cfg(…)",
@@ -682,6 +751,7 @@ mod tests {
682 delete: 20..20, 751 delete: 20..20,
683 insert: "cfg(${0:predicate})", 752 insert: "cfg(${0:predicate})",
684 kind: Attribute, 753 kind: Attribute,
754 lookup: "cfg",
685 }, 755 },
686 CompletionItem { 756 CompletionItem {
687 label: "cfg_attr(…)", 757 label: "cfg_attr(…)",
@@ -689,6 +759,7 @@ mod tests {
689 delete: 20..20, 759 delete: 20..20,
690 insert: "cfg_attr(${1:predicate}, ${0:attr})", 760 insert: "cfg_attr(${1:predicate}, ${0:attr})",
691 kind: Attribute, 761 kind: Attribute,
762 lookup: "cfg_attr",
692 }, 763 },
693 CompletionItem { 764 CompletionItem {
694 label: "deny(…)", 765 label: "deny(…)",
@@ -696,6 +767,7 @@ mod tests {
696 delete: 20..20, 767 delete: 20..20,
697 insert: "deny(${0:lint})", 768 insert: "deny(${0:lint})",
698 kind: Attribute, 769 kind: Attribute,
770 lookup: "deny",
699 }, 771 },
700 CompletionItem { 772 CompletionItem {
701 label: "deprecated = \"…\"", 773 label: "deprecated = \"…\"",
@@ -703,6 +775,7 @@ mod tests {
703 delete: 20..20, 775 delete: 20..20,
704 insert: "deprecated = \"${0:reason}\"", 776 insert: "deprecated = \"${0:reason}\"",
705 kind: Attribute, 777 kind: Attribute,
778 lookup: "deprecated",
706 }, 779 },
707 CompletionItem { 780 CompletionItem {
708 label: "derive(…)", 781 label: "derive(…)",
@@ -710,6 +783,7 @@ mod tests {
710 delete: 20..20, 783 delete: 20..20,
711 insert: "derive(${0:Debug})", 784 insert: "derive(${0:Debug})",
712 kind: Attribute, 785 kind: Attribute,
786 lookup: "derive",
713 }, 787 },
714 CompletionItem { 788 CompletionItem {
715 label: "doc = \"…\"", 789 label: "doc = \"…\"",
@@ -717,6 +791,7 @@ mod tests {
717 delete: 20..20, 791 delete: 20..20,
718 insert: "doc = \"${0:docs}\"", 792 insert: "doc = \"${0:docs}\"",
719 kind: Attribute, 793 kind: Attribute,
794 lookup: "doc",
720 }, 795 },
721 CompletionItem { 796 CompletionItem {
722 label: "feature(…)", 797 label: "feature(…)",
@@ -724,6 +799,7 @@ mod tests {
724 delete: 20..20, 799 delete: 20..20,
725 insert: "feature(${0:flag})", 800 insert: "feature(${0:flag})",
726 kind: Attribute, 801 kind: Attribute,
802 lookup: "feature",
727 }, 803 },
728 CompletionItem { 804 CompletionItem {
729 label: "forbid(…)", 805 label: "forbid(…)",
@@ -731,6 +807,7 @@ mod tests {
731 delete: 20..20, 807 delete: 20..20,
732 insert: "forbid(${0:lint})", 808 insert: "forbid(${0:lint})",
733 kind: Attribute, 809 kind: Attribute,
810 lookup: "forbid",
734 }, 811 },
735 CompletionItem { 812 CompletionItem {
736 label: "global_allocator", 813 label: "global_allocator",
@@ -745,6 +822,7 @@ mod tests {
745 delete: 20..20, 822 delete: 20..20,
746 insert: "ignore(${0:lint})", 823 insert: "ignore(${0:lint})",
747 kind: Attribute, 824 kind: Attribute,
825 lookup: "ignore",
748 }, 826 },
749 CompletionItem { 827 CompletionItem {
750 label: "inline(…)", 828 label: "inline(…)",
@@ -752,6 +830,7 @@ mod tests {
752 delete: 20..20, 830 delete: 20..20,
753 insert: "inline(${0:lint})", 831 insert: "inline(${0:lint})",
754 kind: Attribute, 832 kind: Attribute,
833 lookup: "inline",
755 }, 834 },
756 CompletionItem { 835 CompletionItem {
757 label: "link", 836 label: "link",
@@ -766,6 +845,7 @@ mod tests {
766 delete: 20..20, 845 delete: 20..20,
767 insert: "link_name = \"${0:symbol_name}\"", 846 insert: "link_name = \"${0:symbol_name}\"",
768 kind: Attribute, 847 kind: Attribute,
848 lookup: "link_name",
769 }, 849 },
770 CompletionItem { 850 CompletionItem {
771 label: "macro_export", 851 label: "macro_export",
@@ -787,6 +867,7 @@ mod tests {
787 delete: 20..20, 867 delete: 20..20,
788 insert: "must_use = \"${0:reason}\"", 868 insert: "must_use = \"${0:reason}\"",
789 kind: Attribute, 869 kind: Attribute,
870 lookup: "must_use",
790 }, 871 },
791 CompletionItem { 872 CompletionItem {
792 label: "no_mangle", 873 label: "no_mangle",
@@ -822,6 +903,7 @@ mod tests {
822 delete: 20..20, 903 delete: 20..20,
823 insert: "path =\"${0:path}\"", 904 insert: "path =\"${0:path}\"",
824 kind: Attribute, 905 kind: Attribute,
906 lookup: "path",
825 }, 907 },
826 CompletionItem { 908 CompletionItem {
827 label: "proc_macro", 909 label: "proc_macro",
@@ -843,6 +925,7 @@ mod tests {
843 delete: 20..20, 925 delete: 20..20,
844 insert: "proc_macro_derive(${0:Trait})", 926 insert: "proc_macro_derive(${0:Trait})",
845 kind: Attribute, 927 kind: Attribute,
928 lookup: "proc_macro_derive",
846 }, 929 },
847 CompletionItem { 930 CompletionItem {
848 label: "recursion_limit = …", 931 label: "recursion_limit = …",
@@ -850,6 +933,7 @@ mod tests {
850 delete: 20..20, 933 delete: 20..20,
851 insert: "recursion_limit = ${0:128}", 934 insert: "recursion_limit = ${0:128}",
852 kind: Attribute, 935 kind: Attribute,
936 lookup: "recursion_limit",
853 }, 937 },
854 CompletionItem { 938 CompletionItem {
855 label: "repr(…)", 939 label: "repr(…)",
@@ -857,6 +941,7 @@ mod tests {
857 delete: 20..20, 941 delete: 20..20,
858 insert: "repr(${0:C})", 942 insert: "repr(${0:C})",
859 kind: Attribute, 943 kind: Attribute,
944 lookup: "repr",
860 }, 945 },
861 CompletionItem { 946 CompletionItem {
862 label: "should_panic(…)", 947 label: "should_panic(…)",
@@ -864,6 +949,7 @@ mod tests {
864 delete: 20..20, 949 delete: 20..20,
865 insert: "should_panic(expected = \"${0:reason}\")", 950 insert: "should_panic(expected = \"${0:reason}\")",
866 kind: Attribute, 951 kind: Attribute,
952 lookup: "should_panic",
867 }, 953 },
868 CompletionItem { 954 CompletionItem {
869 label: "target_feature = \"…\"", 955 label: "target_feature = \"…\"",
@@ -871,6 +957,7 @@ mod tests {
871 delete: 20..20, 957 delete: 20..20,
872 insert: "target_feature = \"${0:feature}\"", 958 insert: "target_feature = \"${0:feature}\"",
873 kind: Attribute, 959 kind: Attribute,
960 lookup: "target_feature",
874 }, 961 },
875 CompletionItem { 962 CompletionItem {
876 label: "test", 963 label: "test",
@@ -892,6 +979,7 @@ mod tests {
892 delete: 20..20, 979 delete: 20..20,
893 insert: "warn(${0:lint})", 980 insert: "warn(${0:lint})",
894 kind: Attribute, 981 kind: Attribute,
982 lookup: "warn",
895 }, 983 },
896 CompletionItem { 984 CompletionItem {
897 label: "windows_subsystem = \"…\"", 985 label: "windows_subsystem = \"…\"",
@@ -899,6 +987,7 @@ mod tests {
899 delete: 20..20, 987 delete: 20..20,
900 insert: "windows_subsystem = \"${0:subsystem}\"", 988 insert: "windows_subsystem = \"${0:subsystem}\"",
901 kind: Attribute, 989 kind: Attribute,
990 lookup: "windows_subsystem",
902 }, 991 },
903 ] 992 ]
904 "### 993 "###