aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-06 16:00:03 +0000
committerGitHub <[email protected]>2020-12-06 16:00:03 +0000
commita0fa522fdaf25daff6a2a9794214f0e0bedc5c24 (patch)
tree0229c35d77ef4a759ed02256863e73c472046e9c /crates/completion/src
parent1403ddf029a6a4ced904146ac7b475c923f6129f (diff)
parent2ff1ebe8f3eb820e13e08f8cfbdac2f12a921e15 (diff)
Merge #6733
6733: Update attributes completion list r=jonas-schievink a=Veykril Might be nice to have them grouped for readability/maintainability similar to how the [reference](https://doc.rust-lang.org/reference/attributes.html#built-in-attributes-index) does it but that would require the use of a `OnceCell` for sorting the entries back after construction. Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/completion/src')
-rw-r--r--crates/completion/src/completions/attribute.rs42
1 files changed, 39 insertions, 3 deletions
diff --git a/crates/completion/src/completions/attribute.rs b/crates/completion/src/completions/attribute.rs
index f3d669458..5404145d5 100644
--- a/crates/completion/src/completions/attribute.rs
+++ b/crates/completion/src/completions/attribute.rs
@@ -87,13 +87,23 @@ const fn attr(
87 AttrCompletion { label, lookup, snippet, prefer_inner: false } 87 AttrCompletion { label, lookup, snippet, prefer_inner: false }
88} 88}
89 89
90/// https://doc.rust-lang.org/reference/attributes.html#built-in-attributes-index
90const ATTRIBUTES: &[AttrCompletion] = &[ 91const ATTRIBUTES: &[AttrCompletion] = &[
91 attr("allow(…)", Some("allow"), Some("allow(${0:lint})")), 92 attr("allow(…)", Some("allow"), Some("allow(${0:lint})")),
93 attr("automatically_derived", None, None),
92 attr("cfg_attr(…)", Some("cfg_attr"), Some("cfg_attr(${1:predicate}, ${0:attr})")), 94 attr("cfg_attr(…)", Some("cfg_attr"), Some("cfg_attr(${1:predicate}, ${0:attr})")),
93 attr("cfg(…)", Some("cfg"), Some("cfg(${0:predicate})")), 95 attr("cfg(…)", Some("cfg"), Some("cfg(${0:predicate})")),
96 attr("cold", None, None),
97 attr(r#"crate_name = """#, Some("crate_name"), Some(r#"crate_name = "${0:crate_name}""#))
98 .prefer_inner(),
94 attr("deny(…)", Some("deny"), Some("deny(${0:lint})")), 99 attr("deny(…)", Some("deny"), Some("deny(${0:lint})")),
95 attr(r#"deprecated = "…""#, Some("deprecated"), Some(r#"deprecated = "${0:reason}""#)), 100 attr(r#"deprecated = "…""#, Some("deprecated"), Some(r#"deprecated = "${0:reason}""#)),
96 attr("derive(…)", Some("derive"), Some(r#"derive(${0:Debug})"#)), 101 attr("derive(…)", Some("derive"), Some(r#"derive(${0:Debug})"#)),
102 attr(
103 r#"export_name = "…""#,
104 Some("export_name"),
105 Some(r#"export_name = "${0:exported_symbol_name}""#),
106 ),
97 attr(r#"doc = "…""#, Some("doc"), Some(r#"doc = "${0:docs}""#)), 107 attr(r#"doc = "…""#, Some("doc"), Some(r#"doc = "${0:docs}""#)),
98 attr("feature(…)", Some("feature"), Some("feature(${0:flag})")).prefer_inner(), 108 attr("feature(…)", Some("feature"), Some("feature(${0:flag})")).prefer_inner(),
99 attr("forbid(…)", Some("forbid"), Some("forbid(${0:lint})")), 109 attr("forbid(…)", Some("forbid"), Some("forbid(${0:lint})")),
@@ -101,16 +111,24 @@ const ATTRIBUTES: &[AttrCompletion] = &[
101 attr("global_allocator", None, None).prefer_inner(), 111 attr("global_allocator", None, None).prefer_inner(),
102 attr(r#"ignore = "…""#, Some("ignore"), Some(r#"ignore = "${0:reason}""#)), 112 attr(r#"ignore = "…""#, Some("ignore"), Some(r#"ignore = "${0:reason}""#)),
103 attr("inline(…)", Some("inline"), Some("inline(${0:lint})")), 113 attr("inline(…)", Some("inline"), Some("inline(${0:lint})")),
104 attr(r#"link_name = "…""#, Some("link_name"), Some(r#"link_name = "${0:symbol_name}""#)),
105 attr("link", None, None), 114 attr("link", None, None),
115 attr(r#"link_name = "…""#, Some("link_name"), Some(r#"link_name = "${0:symbol_name}""#)),
116 attr(
117 r#"link_section = "…""#,
118 Some("link_section"),
119 Some(r#"link_section = "${0:section_name}""#),
120 ),
106 attr("macro_export", None, None), 121 attr("macro_export", None, None),
107 attr("macro_use", None, None), 122 attr("macro_use", None, None),
108 attr(r#"must_use = "…""#, Some("must_use"), Some(r#"must_use = "${0:reason}""#)), 123 attr(r#"must_use = "…""#, Some("must_use"), Some(r#"must_use = "${0:reason}""#)),
124 attr("no_link", None, None).prefer_inner(),
125 attr("no_implicit_prelude", None, None).prefer_inner(),
126 attr("no_main", None, None).prefer_inner(),
109 attr("no_mangle", None, None), 127 attr("no_mangle", None, None),
110 attr("no_std", None, None).prefer_inner(), 128 attr("no_std", None, None).prefer_inner(),
111 attr("non_exhaustive", None, None), 129 attr("non_exhaustive", None, None),
112 attr("panic_handler", None, None).prefer_inner(), 130 attr("panic_handler", None, None).prefer_inner(),
113 attr("path = \"…\"", Some("path"), Some("path =\"${0:path}\"")), 131 attr(r#"path = "…""#, Some("path"), Some(r#"path ="${0:path}""#)),
114 attr("proc_macro", None, None), 132 attr("proc_macro", None, None),
115 attr("proc_macro_attribute", None, None), 133 attr("proc_macro_attribute", None, None),
116 attr("proc_macro_derive(…)", Some("proc_macro_derive"), Some("proc_macro_derive(${0:Trait})")), 134 attr("proc_macro_derive(…)", Some("proc_macro_derive"), Some("proc_macro_derive(${0:Trait})")),
@@ -125,9 +143,12 @@ const ATTRIBUTES: &[AttrCompletion] = &[
125 attr( 143 attr(
126 r#"target_feature = "…""#, 144 r#"target_feature = "…""#,
127 Some("target_feature"), 145 Some("target_feature"),
128 Some("target_feature = \"${0:feature}\""), 146 Some(r#"target_feature = "${0:feature}""#),
129 ), 147 ),
130 attr("test", None, None), 148 attr("test", None, None),
149 attr("track_caller", None, None),
150 attr("type_length_limit = …", Some("type_length_limit"), Some("type_length_limit = ${0:128}"))
151 .prefer_inner(),
131 attr("used", None, None), 152 attr("used", None, None),
132 attr("warn(…)", Some("warn"), Some("warn(${0:lint})")), 153 attr("warn(…)", Some("warn"), Some("warn(${0:lint})")),
133 attr( 154 attr(
@@ -449,17 +470,21 @@ struct Test {}
449 r#"#[<|>]"#, 470 r#"#[<|>]"#,
450 expect![[r#" 471 expect![[r#"
451 at allow(…) 472 at allow(…)
473 at automatically_derived
452 at cfg(…) 474 at cfg(…)
453 at cfg_attr(…) 475 at cfg_attr(…)
476 at cold
454 at deny(…) 477 at deny(…)
455 at deprecated = "…" 478 at deprecated = "…"
456 at derive(…) 479 at derive(…)
457 at doc = "…" 480 at doc = "…"
481 at export_name = "…"
458 at forbid(…) 482 at forbid(…)
459 at ignore = "…" 483 at ignore = "…"
460 at inline(…) 484 at inline(…)
461 at link 485 at link
462 at link_name = "…" 486 at link_name = "…"
487 at link_section = "…"
463 at macro_export 488 at macro_export
464 at macro_use 489 at macro_use
465 at must_use = "…" 490 at must_use = "…"
@@ -473,6 +498,7 @@ struct Test {}
473 at should_panic(…) 498 at should_panic(…)
474 at target_feature = "…" 499 at target_feature = "…"
475 at test 500 at test
501 at track_caller
476 at used 502 at used
477 at warn(…) 503 at warn(…)
478 "#]], 504 "#]],
@@ -490,12 +516,16 @@ struct Test {}
490 r"#![<|>]", 516 r"#![<|>]",
491 expect![[r#" 517 expect![[r#"
492 at allow(…) 518 at allow(…)
519 at automatically_derived
493 at cfg(…) 520 at cfg(…)
494 at cfg_attr(…) 521 at cfg_attr(…)
522 at cold
523 at crate_name = ""
495 at deny(…) 524 at deny(…)
496 at deprecated = "…" 525 at deprecated = "…"
497 at derive(…) 526 at derive(…)
498 at doc = "…" 527 at doc = "…"
528 at export_name = "…"
499 at feature(…) 529 at feature(…)
500 at forbid(…) 530 at forbid(…)
501 at global_allocator 531 at global_allocator
@@ -503,9 +533,13 @@ struct Test {}
503 at inline(…) 533 at inline(…)
504 at link 534 at link
505 at link_name = "…" 535 at link_name = "…"
536 at link_section = "…"
506 at macro_export 537 at macro_export
507 at macro_use 538 at macro_use
508 at must_use = "…" 539 at must_use = "…"
540 at no_implicit_prelude
541 at no_link
542 at no_main
509 at no_mangle 543 at no_mangle
510 at no_std 544 at no_std
511 at non_exhaustive 545 at non_exhaustive
@@ -519,6 +553,8 @@ struct Test {}
519 at should_panic(…) 553 at should_panic(…)
520 at target_feature = "…" 554 at target_feature = "…"
521 at test 555 at test
556 at track_caller
557 at type_length_limit = …
522 at used 558 at used
523 at warn(…) 559 at warn(…)
524 at windows_subsystem = "…" 560 at windows_subsystem = "…"