diff options
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/completion/complete_attribute.rs | 186 |
1 files changed, 123 insertions, 63 deletions
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index fb3f0b743..814d7109d 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs | |||
@@ -20,12 +20,26 @@ pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) | |||
20 | { | 20 | { |
21 | complete_derive(acc, ctx, token_tree) | 21 | complete_derive(acc, ctx, token_tree) |
22 | } | 22 | } |
23 | _ => complete_attribute_start(acc, ctx, attribute), | 23 | (_, Some(ast::AttrInput::TokenTree(token_tree))) => { |
24 | let token_tree_str = token_tree.to_string(); | ||
25 | complete_attribute_start( | ||
26 | acc, | ||
27 | ctx, | ||
28 | attribute, | ||
29 | token_tree_str.starts_with('(') && token_tree_str.ends_with(')'), | ||
30 | ) | ||
31 | } | ||
32 | _ => complete_attribute_start(acc, ctx, attribute, false), | ||
24 | } | 33 | } |
25 | Some(()) | 34 | Some(()) |
26 | } | 35 | } |
27 | 36 | ||
28 | fn complete_attribute_start(acc: &mut Completions, ctx: &CompletionContext, attribute: &ast::Attr) { | 37 | fn complete_attribute_start( |
38 | acc: &mut Completions, | ||
39 | ctx: &CompletionContext, | ||
40 | attribute: &ast::Attr, | ||
41 | nested: bool, | ||
42 | ) { | ||
29 | for attr_completion in ATTRIBUTES { | 43 | for attr_completion in ATTRIBUTES { |
30 | let mut item = CompletionItem::new( | 44 | let mut item = CompletionItem::new( |
31 | CompletionKind::Attribute, | 45 | CompletionKind::Attribute, |
@@ -42,7 +56,9 @@ fn complete_attribute_start(acc: &mut Completions, ctx: &CompletionContext, attr | |||
42 | } | 56 | } |
43 | 57 | ||
44 | if attribute.kind() == ast::AttrKind::Inner || !attr_completion.should_be_inner { | 58 | if attribute.kind() == ast::AttrKind::Inner || !attr_completion.should_be_inner { |
45 | acc.add(item); | 59 | if (nested && attr_completion.should_be_inner) || !nested { |
60 | acc.add(item); | ||
61 | } | ||
46 | } | 62 | } |
47 | } | 63 | } |
48 | } | 64 | } |
@@ -54,33 +70,59 @@ struct AttrCompletion { | |||
54 | } | 70 | } |
55 | 71 | ||
56 | const ATTRIBUTES: &[AttrCompletion] = &[ | 72 | const ATTRIBUTES: &[AttrCompletion] = &[ |
57 | AttrCompletion { label: "allow", snippet: Some("allow(${0:lint})"), should_be_inner: false }, | ||
58 | AttrCompletion { | 73 | AttrCompletion { |
59 | label: "cfg_attr", | 74 | label: "allow(…)", snippet: Some("allow(${0:lint})"), should_be_inner: false |
75 | }, | ||
76 | AttrCompletion { | ||
77 | label: "cfg_attr(…)", | ||
60 | snippet: Some("cfg_attr(${1:predicate}, ${0:attr})"), | 78 | snippet: Some("cfg_attr(${1:predicate}, ${0:attr})"), |
61 | should_be_inner: false, | 79 | should_be_inner: false, |
62 | }, | 80 | }, |
63 | AttrCompletion { label: "cfg", snippet: Some("cfg(${0:predicate})"), should_be_inner: false }, | ||
64 | AttrCompletion { label: "deny", snippet: Some("deny(${0:lint})"), should_be_inner: false }, | ||
65 | AttrCompletion { | 81 | AttrCompletion { |
66 | label: "deprecated", | 82 | label: "cfg(…)", |
83 | snippet: Some("cfg(${0:predicate})"), | ||
84 | should_be_inner: false, | ||
85 | }, | ||
86 | AttrCompletion { label: "deny(…)", snippet: Some("deny(${0:lint})"), should_be_inner: false }, | ||
87 | AttrCompletion { | ||
88 | label: r#"deprecated = "…""#, | ||
67 | snippet: Some(r#"deprecated = "${0:reason}""#), | 89 | snippet: Some(r#"deprecated = "${0:reason}""#), |
68 | should_be_inner: false, | 90 | should_be_inner: false, |
69 | }, | 91 | }, |
70 | AttrCompletion { | 92 | AttrCompletion { |
71 | label: "derive", | 93 | label: "derive(…)", |
72 | snippet: Some(r#"derive(${0:Debug})"#), | 94 | snippet: Some(r#"derive(${0:Debug})"#), |
73 | should_be_inner: false, | 95 | should_be_inner: false, |
74 | }, | 96 | }, |
75 | AttrCompletion { label: "doc", snippet: Some(r#"doc = "${0:docs}""#), should_be_inner: false }, | 97 | AttrCompletion { |
76 | AttrCompletion { label: "feature", snippet: Some("feature(${0:flag})"), should_be_inner: true }, | 98 | label: r#"doc = "…""#, |
77 | AttrCompletion { label: "forbid", snippet: Some("forbid(${0:lint})"), should_be_inner: false }, | 99 | snippet: Some(r#"doc = "${0:docs}""#), |
100 | should_be_inner: false, | ||
101 | }, | ||
102 | AttrCompletion { | ||
103 | label: "feature(…)", | ||
104 | snippet: Some("feature(${0:flag})"), | ||
105 | should_be_inner: true, | ||
106 | }, | ||
107 | AttrCompletion { | ||
108 | label: "forbid(…)", | ||
109 | snippet: Some("forbid(${0:lint})"), | ||
110 | should_be_inner: false, | ||
111 | }, | ||
78 | // FIXME: resolve through macro resolution? | 112 | // FIXME: resolve through macro resolution? |
79 | AttrCompletion { label: "global_allocator", snippet: None, should_be_inner: true }, | 113 | AttrCompletion { label: "global_allocator", snippet: None, should_be_inner: true }, |
80 | AttrCompletion { label: "ignore", snippet: Some("ignore(${0:lint})"), should_be_inner: false }, | ||
81 | AttrCompletion { label: "inline", snippet: Some("inline(${0:lint})"), should_be_inner: false }, | ||
82 | AttrCompletion { | 114 | AttrCompletion { |
83 | label: "link_name", | 115 | label: "ignore(…)", |
116 | snippet: Some("ignore(${0:lint})"), | ||
117 | should_be_inner: false, | ||
118 | }, | ||
119 | AttrCompletion { | ||
120 | label: "inline(…)", | ||
121 | snippet: Some("inline(${0:lint})"), | ||
122 | should_be_inner: false, | ||
123 | }, | ||
124 | AttrCompletion { | ||
125 | label: r#"link_name = "…""#, | ||
84 | snippet: Some(r#"link_name = "${0:symbol_name}""#), | 126 | snippet: Some(r#"link_name = "${0:symbol_name}""#), |
85 | should_be_inner: false, | 127 | should_be_inner: false, |
86 | }, | 128 | }, |
@@ -88,7 +130,7 @@ const ATTRIBUTES: &[AttrCompletion] = &[ | |||
88 | AttrCompletion { label: "macro_export", snippet: None, should_be_inner: false }, | 130 | AttrCompletion { label: "macro_export", snippet: None, should_be_inner: false }, |
89 | AttrCompletion { label: "macro_use", snippet: None, should_be_inner: false }, | 131 | AttrCompletion { label: "macro_use", snippet: None, should_be_inner: false }, |
90 | AttrCompletion { | 132 | AttrCompletion { |
91 | label: "must_use", | 133 | label: r#"must_use = "…""#, |
92 | snippet: Some(r#"must_use = "${0:reason}""#), | 134 | snippet: Some(r#"must_use = "${0:reason}""#), |
93 | should_be_inner: false, | 135 | should_be_inner: false, |
94 | }, | 136 | }, |
@@ -96,35 +138,39 @@ const ATTRIBUTES: &[AttrCompletion] = &[ | |||
96 | AttrCompletion { label: "no_std", snippet: None, should_be_inner: true }, | 138 | AttrCompletion { label: "no_std", snippet: None, should_be_inner: true }, |
97 | AttrCompletion { label: "non_exhaustive", snippet: None, should_be_inner: false }, | 139 | AttrCompletion { label: "non_exhaustive", snippet: None, should_be_inner: false }, |
98 | AttrCompletion { label: "panic_handler", snippet: None, should_be_inner: true }, | 140 | AttrCompletion { label: "panic_handler", snippet: None, should_be_inner: true }, |
99 | AttrCompletion { label: "path", snippet: Some("path =\"${0:path}\""), should_be_inner: false }, | 141 | AttrCompletion { |
142 | label: "path = \"…\"", | ||
143 | snippet: Some("path =\"${0:path}\""), | ||
144 | should_be_inner: false, | ||
145 | }, | ||
100 | AttrCompletion { label: "proc_macro", snippet: None, should_be_inner: false }, | 146 | AttrCompletion { label: "proc_macro", snippet: None, should_be_inner: false }, |
101 | AttrCompletion { label: "proc_macro_attribute", snippet: None, should_be_inner: false }, | 147 | AttrCompletion { label: "proc_macro_attribute", snippet: None, should_be_inner: false }, |
102 | AttrCompletion { | 148 | AttrCompletion { |
103 | label: "proc_macro_derive", | 149 | label: "proc_macro_derive(…)", |
104 | snippet: Some("proc_macro_derive(${0:Trait})"), | 150 | snippet: Some("proc_macro_derive(${0:Trait})"), |
105 | should_be_inner: false, | 151 | should_be_inner: false, |
106 | }, | 152 | }, |
107 | AttrCompletion { | 153 | AttrCompletion { |
108 | label: "recursion_limit", | 154 | label: "recursion_limit = …", |
109 | snippet: Some("recursion_limit = ${0:128}"), | 155 | snippet: Some("recursion_limit = ${0:128}"), |
110 | should_be_inner: true, | 156 | should_be_inner: true, |
111 | }, | 157 | }, |
112 | AttrCompletion { label: "repr", snippet: Some("repr(${0:C})"), should_be_inner: false }, | 158 | AttrCompletion { label: "repr(…)", snippet: Some("repr(${0:C})"), should_be_inner: false }, |
113 | AttrCompletion { | 159 | AttrCompletion { |
114 | label: "should_panic", | 160 | label: "should_panic(…)", |
115 | snippet: Some(r#"should_panic(expected = "${0:reason}")"#), | 161 | snippet: Some(r#"should_panic(expected = "${0:reason}")"#), |
116 | should_be_inner: false, | 162 | should_be_inner: false, |
117 | }, | 163 | }, |
118 | AttrCompletion { | 164 | AttrCompletion { |
119 | label: "target_feature", | 165 | label: r#"target_feature = "…""#, |
120 | snippet: Some("target_feature = \"${0:feature}\""), | 166 | snippet: Some("target_feature = \"${0:feature}\""), |
121 | should_be_inner: false, | 167 | should_be_inner: false, |
122 | }, | 168 | }, |
123 | AttrCompletion { label: "test", snippet: None, should_be_inner: false }, | 169 | AttrCompletion { label: "test", snippet: None, should_be_inner: false }, |
124 | AttrCompletion { label: "used", snippet: None, should_be_inner: false }, | 170 | AttrCompletion { label: "used", snippet: None, should_be_inner: false }, |
125 | AttrCompletion { label: "warn", snippet: Some("warn(${0:lint})"), should_be_inner: false }, | 171 | AttrCompletion { label: "warn(…)", snippet: Some("warn(${0:lint})"), should_be_inner: false }, |
126 | AttrCompletion { | 172 | AttrCompletion { |
127 | label: "windows_subsystem", | 173 | label: r#"windows_subsystem = "…""#, |
128 | snippet: Some(r#"windows_subsystem = "${0:subsystem}""#), | 174 | snippet: Some(r#"windows_subsystem = "${0:subsystem}""#), |
129 | should_be_inner: true, | 175 | should_be_inner: true, |
130 | }, | 176 | }, |
@@ -414,70 +460,70 @@ mod tests { | |||
414 | @r###" | 460 | @r###" |
415 | [ | 461 | [ |
416 | CompletionItem { | 462 | CompletionItem { |
417 | label: "allow", | 463 | label: "allow(…)", |
418 | source_range: 19..19, | 464 | source_range: 19..19, |
419 | delete: 19..19, | 465 | delete: 19..19, |
420 | insert: "allow(${0:lint})", | 466 | insert: "allow(${0:lint})", |
421 | kind: Attribute, | 467 | kind: Attribute, |
422 | }, | 468 | }, |
423 | CompletionItem { | 469 | CompletionItem { |
424 | label: "cfg", | 470 | label: "cfg(…)", |
425 | source_range: 19..19, | 471 | source_range: 19..19, |
426 | delete: 19..19, | 472 | delete: 19..19, |
427 | insert: "cfg(${0:predicate})", | 473 | insert: "cfg(${0:predicate})", |
428 | kind: Attribute, | 474 | kind: Attribute, |
429 | }, | 475 | }, |
430 | CompletionItem { | 476 | CompletionItem { |
431 | label: "cfg_attr", | 477 | label: "cfg_attr(…)", |
432 | source_range: 19..19, | 478 | source_range: 19..19, |
433 | delete: 19..19, | 479 | delete: 19..19, |
434 | insert: "cfg_attr(${1:predicate}, ${0:attr})", | 480 | insert: "cfg_attr(${1:predicate}, ${0:attr})", |
435 | kind: Attribute, | 481 | kind: Attribute, |
436 | }, | 482 | }, |
437 | CompletionItem { | 483 | CompletionItem { |
438 | label: "deny", | 484 | label: "deny(…)", |
439 | source_range: 19..19, | 485 | source_range: 19..19, |
440 | delete: 19..19, | 486 | delete: 19..19, |
441 | insert: "deny(${0:lint})", | 487 | insert: "deny(${0:lint})", |
442 | kind: Attribute, | 488 | kind: Attribute, |
443 | }, | 489 | }, |
444 | CompletionItem { | 490 | CompletionItem { |
445 | label: "deprecated", | 491 | label: "deprecated = \"…\"", |
446 | source_range: 19..19, | 492 | source_range: 19..19, |
447 | delete: 19..19, | 493 | delete: 19..19, |
448 | insert: "deprecated = \"${0:reason}\"", | 494 | insert: "deprecated = \"${0:reason}\"", |
449 | kind: Attribute, | 495 | kind: Attribute, |
450 | }, | 496 | }, |
451 | CompletionItem { | 497 | CompletionItem { |
452 | label: "derive", | 498 | label: "derive(…)", |
453 | source_range: 19..19, | 499 | source_range: 19..19, |
454 | delete: 19..19, | 500 | delete: 19..19, |
455 | insert: "derive(${0:Debug})", | 501 | insert: "derive(${0:Debug})", |
456 | kind: Attribute, | 502 | kind: Attribute, |
457 | }, | 503 | }, |
458 | CompletionItem { | 504 | CompletionItem { |
459 | label: "doc", | 505 | label: "doc = \"…\"", |
460 | source_range: 19..19, | 506 | source_range: 19..19, |
461 | delete: 19..19, | 507 | delete: 19..19, |
462 | insert: "doc = \"${0:docs}\"", | 508 | insert: "doc = \"${0:docs}\"", |
463 | kind: Attribute, | 509 | kind: Attribute, |
464 | }, | 510 | }, |
465 | CompletionItem { | 511 | CompletionItem { |
466 | label: "forbid", | 512 | label: "forbid(…)", |
467 | source_range: 19..19, | 513 | source_range: 19..19, |
468 | delete: 19..19, | 514 | delete: 19..19, |
469 | insert: "forbid(${0:lint})", | 515 | insert: "forbid(${0:lint})", |
470 | kind: Attribute, | 516 | kind: Attribute, |
471 | }, | 517 | }, |
472 | CompletionItem { | 518 | CompletionItem { |
473 | label: "ignore", | 519 | label: "ignore(…)", |
474 | source_range: 19..19, | 520 | source_range: 19..19, |
475 | delete: 19..19, | 521 | delete: 19..19, |
476 | insert: "ignore(${0:lint})", | 522 | insert: "ignore(${0:lint})", |
477 | kind: Attribute, | 523 | kind: Attribute, |
478 | }, | 524 | }, |
479 | CompletionItem { | 525 | CompletionItem { |
480 | label: "inline", | 526 | label: "inline(…)", |
481 | source_range: 19..19, | 527 | source_range: 19..19, |
482 | delete: 19..19, | 528 | delete: 19..19, |
483 | insert: "inline(${0:lint})", | 529 | insert: "inline(${0:lint})", |
@@ -491,7 +537,7 @@ mod tests { | |||
491 | kind: Attribute, | 537 | kind: Attribute, |
492 | }, | 538 | }, |
493 | CompletionItem { | 539 | CompletionItem { |
494 | label: "link_name", | 540 | label: "link_name = \"…\"", |
495 | source_range: 19..19, | 541 | source_range: 19..19, |
496 | delete: 19..19, | 542 | delete: 19..19, |
497 | insert: "link_name = \"${0:symbol_name}\"", | 543 | insert: "link_name = \"${0:symbol_name}\"", |
@@ -512,7 +558,7 @@ mod tests { | |||
512 | kind: Attribute, | 558 | kind: Attribute, |
513 | }, | 559 | }, |
514 | CompletionItem { | 560 | CompletionItem { |
515 | label: "must_use", | 561 | label: "must_use = \"…\"", |
516 | source_range: 19..19, | 562 | source_range: 19..19, |
517 | delete: 19..19, | 563 | delete: 19..19, |
518 | insert: "must_use = \"${0:reason}\"", | 564 | insert: "must_use = \"${0:reason}\"", |
@@ -533,7 +579,7 @@ mod tests { | |||
533 | kind: Attribute, | 579 | kind: Attribute, |
534 | }, | 580 | }, |
535 | CompletionItem { | 581 | CompletionItem { |
536 | label: "path", | 582 | label: "path = \"…\"", |
537 | source_range: 19..19, | 583 | source_range: 19..19, |
538 | delete: 19..19, | 584 | delete: 19..19, |
539 | insert: "path =\"${0:path}\"", | 585 | insert: "path =\"${0:path}\"", |
@@ -554,28 +600,28 @@ mod tests { | |||
554 | kind: Attribute, | 600 | kind: Attribute, |
555 | }, | 601 | }, |
556 | CompletionItem { | 602 | CompletionItem { |
557 | label: "proc_macro_derive", | 603 | label: "proc_macro_derive(…)", |
558 | source_range: 19..19, | 604 | source_range: 19..19, |
559 | delete: 19..19, | 605 | delete: 19..19, |
560 | insert: "proc_macro_derive(${0:Trait})", | 606 | insert: "proc_macro_derive(${0:Trait})", |
561 | kind: Attribute, | 607 | kind: Attribute, |
562 | }, | 608 | }, |
563 | CompletionItem { | 609 | CompletionItem { |
564 | label: "repr", | 610 | label: "repr(…)", |
565 | source_range: 19..19, | 611 | source_range: 19..19, |
566 | delete: 19..19, | 612 | delete: 19..19, |
567 | insert: "repr(${0:C})", | 613 | insert: "repr(${0:C})", |
568 | kind: Attribute, | 614 | kind: Attribute, |
569 | }, | 615 | }, |
570 | CompletionItem { | 616 | CompletionItem { |
571 | label: "should_panic", | 617 | label: "should_panic(…)", |
572 | source_range: 19..19, | 618 | source_range: 19..19, |
573 | delete: 19..19, | 619 | delete: 19..19, |
574 | insert: "should_panic(expected = \"${0:reason}\")", | 620 | insert: "should_panic(expected = \"${0:reason}\")", |
575 | kind: Attribute, | 621 | kind: Attribute, |
576 | }, | 622 | }, |
577 | CompletionItem { | 623 | CompletionItem { |
578 | label: "target_feature", | 624 | label: "target_feature = \"…\"", |
579 | source_range: 19..19, | 625 | source_range: 19..19, |
580 | delete: 19..19, | 626 | delete: 19..19, |
581 | insert: "target_feature = \"${0:feature}\"", | 627 | insert: "target_feature = \"${0:feature}\"", |
@@ -596,7 +642,7 @@ mod tests { | |||
596 | kind: Attribute, | 642 | kind: Attribute, |
597 | }, | 643 | }, |
598 | CompletionItem { | 644 | CompletionItem { |
599 | label: "warn", | 645 | label: "warn(…)", |
600 | source_range: 19..19, | 646 | source_range: 19..19, |
601 | delete: 19..19, | 647 | delete: 19..19, |
602 | insert: "warn(${0:lint})", | 648 | insert: "warn(${0:lint})", |
@@ -608,6 +654,20 @@ mod tests { | |||
608 | } | 654 | } |
609 | 655 | ||
610 | #[test] | 656 | #[test] |
657 | fn test_attribute_completion_inside_nested_attr() { | ||
658 | assert_debug_snapshot!( | ||
659 | do_attr_completion( | ||
660 | r" | ||
661 | #[allow(<|>)] | ||
662 | ", | ||
663 | ), | ||
664 | @r###" | ||
665 | [] | ||
666 | "### | ||
667 | ); | ||
668 | } | ||
669 | |||
670 | #[test] | ||
611 | fn test_inner_attribute_completion() { | 671 | fn test_inner_attribute_completion() { |
612 | assert_debug_snapshot!( | 672 | assert_debug_snapshot!( |
613 | do_attr_completion( | 673 | do_attr_completion( |
@@ -618,63 +678,63 @@ mod tests { | |||
618 | @r###" | 678 | @r###" |
619 | [ | 679 | [ |
620 | CompletionItem { | 680 | CompletionItem { |
621 | label: "allow", | 681 | label: "allow(…)", |
622 | source_range: 20..20, | 682 | source_range: 20..20, |
623 | delete: 20..20, | 683 | delete: 20..20, |
624 | insert: "allow(${0:lint})", | 684 | insert: "allow(${0:lint})", |
625 | kind: Attribute, | 685 | kind: Attribute, |
626 | }, | 686 | }, |
627 | CompletionItem { | 687 | CompletionItem { |
628 | label: "cfg", | 688 | label: "cfg(…)", |
629 | source_range: 20..20, | 689 | source_range: 20..20, |
630 | delete: 20..20, | 690 | delete: 20..20, |
631 | insert: "cfg(${0:predicate})", | 691 | insert: "cfg(${0:predicate})", |
632 | kind: Attribute, | 692 | kind: Attribute, |
633 | }, | 693 | }, |
634 | CompletionItem { | 694 | CompletionItem { |
635 | label: "cfg_attr", | 695 | label: "cfg_attr(…)", |
636 | source_range: 20..20, | 696 | source_range: 20..20, |
637 | delete: 20..20, | 697 | delete: 20..20, |
638 | insert: "cfg_attr(${1:predicate}, ${0:attr})", | 698 | insert: "cfg_attr(${1:predicate}, ${0:attr})", |
639 | kind: Attribute, | 699 | kind: Attribute, |
640 | }, | 700 | }, |
641 | CompletionItem { | 701 | CompletionItem { |
642 | label: "deny", | 702 | label: "deny(…)", |
643 | source_range: 20..20, | 703 | source_range: 20..20, |
644 | delete: 20..20, | 704 | delete: 20..20, |
645 | insert: "deny(${0:lint})", | 705 | insert: "deny(${0:lint})", |
646 | kind: Attribute, | 706 | kind: Attribute, |
647 | }, | 707 | }, |
648 | CompletionItem { | 708 | CompletionItem { |
649 | label: "deprecated", | 709 | label: "deprecated = \"…\"", |
650 | source_range: 20..20, | 710 | source_range: 20..20, |
651 | delete: 20..20, | 711 | delete: 20..20, |
652 | insert: "deprecated = \"${0:reason}\"", | 712 | insert: "deprecated = \"${0:reason}\"", |
653 | kind: Attribute, | 713 | kind: Attribute, |
654 | }, | 714 | }, |
655 | CompletionItem { | 715 | CompletionItem { |
656 | label: "derive", | 716 | label: "derive(…)", |
657 | source_range: 20..20, | 717 | source_range: 20..20, |
658 | delete: 20..20, | 718 | delete: 20..20, |
659 | insert: "derive(${0:Debug})", | 719 | insert: "derive(${0:Debug})", |
660 | kind: Attribute, | 720 | kind: Attribute, |
661 | }, | 721 | }, |
662 | CompletionItem { | 722 | CompletionItem { |
663 | label: "doc", | 723 | label: "doc = \"…\"", |
664 | source_range: 20..20, | 724 | source_range: 20..20, |
665 | delete: 20..20, | 725 | delete: 20..20, |
666 | insert: "doc = \"${0:docs}\"", | 726 | insert: "doc = \"${0:docs}\"", |
667 | kind: Attribute, | 727 | kind: Attribute, |
668 | }, | 728 | }, |
669 | CompletionItem { | 729 | CompletionItem { |
670 | label: "feature", | 730 | label: "feature(…)", |
671 | source_range: 20..20, | 731 | source_range: 20..20, |
672 | delete: 20..20, | 732 | delete: 20..20, |
673 | insert: "feature(${0:flag})", | 733 | insert: "feature(${0:flag})", |
674 | kind: Attribute, | 734 | kind: Attribute, |
675 | }, | 735 | }, |
676 | CompletionItem { | 736 | CompletionItem { |
677 | label: "forbid", | 737 | label: "forbid(…)", |
678 | source_range: 20..20, | 738 | source_range: 20..20, |
679 | delete: 20..20, | 739 | delete: 20..20, |
680 | insert: "forbid(${0:lint})", | 740 | insert: "forbid(${0:lint})", |
@@ -688,14 +748,14 @@ mod tests { | |||
688 | kind: Attribute, | 748 | kind: Attribute, |
689 | }, | 749 | }, |
690 | CompletionItem { | 750 | CompletionItem { |
691 | label: "ignore", | 751 | label: "ignore(…)", |
692 | source_range: 20..20, | 752 | source_range: 20..20, |
693 | delete: 20..20, | 753 | delete: 20..20, |
694 | insert: "ignore(${0:lint})", | 754 | insert: "ignore(${0:lint})", |
695 | kind: Attribute, | 755 | kind: Attribute, |
696 | }, | 756 | }, |
697 | CompletionItem { | 757 | CompletionItem { |
698 | label: "inline", | 758 | label: "inline(…)", |
699 | source_range: 20..20, | 759 | source_range: 20..20, |
700 | delete: 20..20, | 760 | delete: 20..20, |
701 | insert: "inline(${0:lint})", | 761 | insert: "inline(${0:lint})", |
@@ -709,7 +769,7 @@ mod tests { | |||
709 | kind: Attribute, | 769 | kind: Attribute, |
710 | }, | 770 | }, |
711 | CompletionItem { | 771 | CompletionItem { |
712 | label: "link_name", | 772 | label: "link_name = \"…\"", |
713 | source_range: 20..20, | 773 | source_range: 20..20, |
714 | delete: 20..20, | 774 | delete: 20..20, |
715 | insert: "link_name = \"${0:symbol_name}\"", | 775 | insert: "link_name = \"${0:symbol_name}\"", |
@@ -730,7 +790,7 @@ mod tests { | |||
730 | kind: Attribute, | 790 | kind: Attribute, |
731 | }, | 791 | }, |
732 | CompletionItem { | 792 | CompletionItem { |
733 | label: "must_use", | 793 | label: "must_use = \"…\"", |
734 | source_range: 20..20, | 794 | source_range: 20..20, |
735 | delete: 20..20, | 795 | delete: 20..20, |
736 | insert: "must_use = \"${0:reason}\"", | 796 | insert: "must_use = \"${0:reason}\"", |
@@ -765,7 +825,7 @@ mod tests { | |||
765 | kind: Attribute, | 825 | kind: Attribute, |
766 | }, | 826 | }, |
767 | CompletionItem { | 827 | CompletionItem { |
768 | label: "path", | 828 | label: "path = \"…\"", |
769 | source_range: 20..20, | 829 | source_range: 20..20, |
770 | delete: 20..20, | 830 | delete: 20..20, |
771 | insert: "path =\"${0:path}\"", | 831 | insert: "path =\"${0:path}\"", |
@@ -786,35 +846,35 @@ mod tests { | |||
786 | kind: Attribute, | 846 | kind: Attribute, |
787 | }, | 847 | }, |
788 | CompletionItem { | 848 | CompletionItem { |
789 | label: "proc_macro_derive", | 849 | label: "proc_macro_derive(…)", |
790 | source_range: 20..20, | 850 | source_range: 20..20, |
791 | delete: 20..20, | 851 | delete: 20..20, |
792 | insert: "proc_macro_derive(${0:Trait})", | 852 | insert: "proc_macro_derive(${0:Trait})", |
793 | kind: Attribute, | 853 | kind: Attribute, |
794 | }, | 854 | }, |
795 | CompletionItem { | 855 | CompletionItem { |
796 | label: "recursion_limit", | 856 | label: "recursion_limit = …", |
797 | source_range: 20..20, | 857 | source_range: 20..20, |
798 | delete: 20..20, | 858 | delete: 20..20, |
799 | insert: "recursion_limit = ${0:128}", | 859 | insert: "recursion_limit = ${0:128}", |
800 | kind: Attribute, | 860 | kind: Attribute, |
801 | }, | 861 | }, |
802 | CompletionItem { | 862 | CompletionItem { |
803 | label: "repr", | 863 | label: "repr(…)", |
804 | source_range: 20..20, | 864 | source_range: 20..20, |
805 | delete: 20..20, | 865 | delete: 20..20, |
806 | insert: "repr(${0:C})", | 866 | insert: "repr(${0:C})", |
807 | kind: Attribute, | 867 | kind: Attribute, |
808 | }, | 868 | }, |
809 | CompletionItem { | 869 | CompletionItem { |
810 | label: "should_panic", | 870 | label: "should_panic(…)", |
811 | source_range: 20..20, | 871 | source_range: 20..20, |
812 | delete: 20..20, | 872 | delete: 20..20, |
813 | insert: "should_panic(expected = \"${0:reason}\")", | 873 | insert: "should_panic(expected = \"${0:reason}\")", |
814 | kind: Attribute, | 874 | kind: Attribute, |
815 | }, | 875 | }, |
816 | CompletionItem { | 876 | CompletionItem { |
817 | label: "target_feature", | 877 | label: "target_feature = \"…\"", |
818 | source_range: 20..20, | 878 | source_range: 20..20, |
819 | delete: 20..20, | 879 | delete: 20..20, |
820 | insert: "target_feature = \"${0:feature}\"", | 880 | insert: "target_feature = \"${0:feature}\"", |
@@ -835,14 +895,14 @@ mod tests { | |||
835 | kind: Attribute, | 895 | kind: Attribute, |
836 | }, | 896 | }, |
837 | CompletionItem { | 897 | CompletionItem { |
838 | label: "warn", | 898 | label: "warn(…)", |
839 | source_range: 20..20, | 899 | source_range: 20..20, |
840 | delete: 20..20, | 900 | delete: 20..20, |
841 | insert: "warn(${0:lint})", | 901 | insert: "warn(${0:lint})", |
842 | kind: Attribute, | 902 | kind: Attribute, |
843 | }, | 903 | }, |
844 | CompletionItem { | 904 | CompletionItem { |
845 | label: "windows_subsystem", | 905 | label: "windows_subsystem = \"…\"", |
846 | source_range: 20..20, | 906 | source_range: 20..20, |
847 | delete: 20..20, | 907 | delete: 20..20, |
848 | insert: "windows_subsystem = \"${0:subsystem}\"", | 908 | insert: "windows_subsystem = \"${0:subsystem}\"", |