From f1671f460ba3a44baa49ca7413646f84f86be842 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 3 Jul 2020 15:38:20 +0200 Subject: Compress attribute completion tests --- crates/ra_ide/src/completion/complete_attribute.rs | 213 ++++++--------------- 1 file changed, 63 insertions(+), 150 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index 6beeca457..4e50a294f 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs @@ -46,7 +46,7 @@ fn complete_attribute_start(acc: &mut Completions, ctx: &CompletionContext, attr _ => {} } - if attribute.kind() == ast::AttrKind::Inner || !attr_completion.should_be_inner { + if attribute.kind() == ast::AttrKind::Inner || !attr_completion.prefer_inner { acc.add(item); } } @@ -56,159 +56,72 @@ struct AttrCompletion { label: &'static str, lookup: Option<&'static str>, snippet: Option<&'static str>, - should_be_inner: bool, + prefer_inner: bool, +} + +impl AttrCompletion { + const fn prefer_inner(self) -> AttrCompletion { + AttrCompletion { prefer_inner: true, ..self } + } +} + +const fn attr( + label: &'static str, + lookup: Option<&'static str>, + snippet: Option<&'static str>, +) -> AttrCompletion { + AttrCompletion { label, lookup, snippet, prefer_inner: false } } const ATTRIBUTES: &[AttrCompletion] = &[ - AttrCompletion { - label: "allow(…)", - snippet: Some("allow(${0:lint})"), - should_be_inner: false, - lookup: Some("allow"), - }, - AttrCompletion { - label: "cfg_attr(…)", - snippet: Some("cfg_attr(${1:predicate}, ${0:attr})"), - should_be_inner: false, - lookup: Some("cfg_attr"), - }, - AttrCompletion { - label: "cfg(…)", - snippet: Some("cfg(${0:predicate})"), - should_be_inner: false, - lookup: Some("cfg"), - }, - AttrCompletion { - label: "deny(…)", - snippet: Some("deny(${0:lint})"), - should_be_inner: false, - lookup: Some("deny"), - }, - AttrCompletion { - label: r#"deprecated = "…""#, - snippet: Some(r#"deprecated = "${0:reason}""#), - should_be_inner: false, - lookup: Some("deprecated"), - }, - AttrCompletion { - label: "derive(…)", - snippet: Some(r#"derive(${0:Debug})"#), - should_be_inner: false, - lookup: Some("derive"), - }, - AttrCompletion { - label: r#"doc = "…""#, - snippet: Some(r#"doc = "${0:docs}""#), - should_be_inner: false, - lookup: Some("doc"), - }, - AttrCompletion { - label: "feature(…)", - snippet: Some("feature(${0:flag})"), - should_be_inner: true, - lookup: Some("feature"), - }, - AttrCompletion { - label: "forbid(…)", - snippet: Some("forbid(${0:lint})"), - should_be_inner: false, - lookup: Some("forbid"), - }, + attr("allow(…)", Some("allow"), Some("allow(${0:lint})")), + attr("cfg_attr(…)", Some("cfg_attr"), Some("cfg_attr(${1:predicate}, ${0:attr})")), + attr("cfg(…)", Some("cfg"), Some("cfg(${0:predicate})")), + attr("deny(…)", Some("deny"), Some("deny(${0:lint})")), + attr(r#"deprecated = "…""#, Some("deprecated"), Some(r#"deprecated = "${0:reason}""#)), + attr("derive(…)", Some("derive"), Some(r#"derive(${0:Debug})"#)), + attr(r#"doc = "…""#, Some("doc"), Some(r#"doc = "${0:docs}""#)), + attr("feature(…)", Some("feature"), Some("feature(${0:flag})")).prefer_inner(), + attr("forbid(…)", Some("forbid"), Some("forbid(${0:lint})")), // FIXME: resolve through macro resolution? - AttrCompletion { - label: "global_allocator", - snippet: None, - should_be_inner: true, - lookup: None, - }, - AttrCompletion { - label: "ignore(…)", - snippet: Some("ignore(${0:lint})"), - should_be_inner: false, - lookup: Some("ignore"), - }, - AttrCompletion { - label: "inline(…)", - snippet: Some("inline(${0:lint})"), - should_be_inner: false, - lookup: Some("inline"), - }, - AttrCompletion { - label: r#"link_name = "…""#, - snippet: Some(r#"link_name = "${0:symbol_name}""#), - should_be_inner: false, - lookup: Some("link_name"), - }, - AttrCompletion { label: "link", snippet: None, should_be_inner: false, lookup: None }, - AttrCompletion { label: "macro_export", snippet: None, should_be_inner: false, lookup: None }, - AttrCompletion { label: "macro_use", snippet: None, should_be_inner: false, lookup: None }, - AttrCompletion { - label: r#"must_use = "…""#, - snippet: Some(r#"must_use = "${0:reason}""#), - should_be_inner: false, - lookup: Some("must_use"), - }, - AttrCompletion { label: "no_mangle", snippet: None, should_be_inner: false, lookup: None }, - AttrCompletion { label: "no_std", snippet: None, should_be_inner: true, lookup: None }, - AttrCompletion { label: "non_exhaustive", snippet: None, should_be_inner: false, lookup: None }, - AttrCompletion { label: "panic_handler", snippet: None, should_be_inner: true, lookup: None }, - AttrCompletion { - label: "path = \"…\"", - snippet: Some("path =\"${0:path}\""), - should_be_inner: false, - lookup: Some("path"), - }, - AttrCompletion { label: "proc_macro", snippet: None, should_be_inner: false, lookup: None }, - AttrCompletion { - label: "proc_macro_attribute", - snippet: None, - should_be_inner: false, - lookup: None, - }, - AttrCompletion { - label: "proc_macro_derive(…)", - snippet: Some("proc_macro_derive(${0:Trait})"), - should_be_inner: false, - lookup: Some("proc_macro_derive"), - }, - AttrCompletion { - label: "recursion_limit = …", - snippet: Some("recursion_limit = ${0:128}"), - should_be_inner: true, - lookup: Some("recursion_limit"), - }, - AttrCompletion { - label: "repr(…)", - snippet: Some("repr(${0:C})"), - should_be_inner: false, - lookup: Some("repr"), - }, - AttrCompletion { - label: "should_panic(…)", - snippet: Some(r#"should_panic(expected = "${0:reason}")"#), - should_be_inner: false, - lookup: Some("should_panic"), - }, - AttrCompletion { - label: r#"target_feature = "…""#, - snippet: Some("target_feature = \"${0:feature}\""), - should_be_inner: false, - lookup: Some("target_feature"), - }, - AttrCompletion { label: "test", snippet: None, should_be_inner: false, lookup: None }, - AttrCompletion { label: "used", snippet: None, should_be_inner: false, lookup: None }, - AttrCompletion { - label: "warn(…)", - snippet: Some("warn(${0:lint})"), - should_be_inner: false, - lookup: Some("warn"), - }, - AttrCompletion { - label: r#"windows_subsystem = "…""#, - snippet: Some(r#"windows_subsystem = "${0:subsystem}""#), - should_be_inner: true, - lookup: Some("windows_subsystem"), - }, + attr("global_allocator", None, None).prefer_inner(), + attr("ignore(…)", Some("ignore"), Some("ignore(${0:lint})")), + attr("inline(…)", Some("inline"), Some("inline(${0:lint})")), + attr(r#"link_name = "…""#, Some("link_name"), Some(r#"link_name = "${0:symbol_name}""#)), + attr("link", None, None), + attr("macro_export", None, None), + attr("macro_use", None, None), + attr(r#"must_use = "…""#, Some("must_use"), Some(r#"must_use = "${0:reason}""#)), + attr("no_mangle", None, None), + attr("no_std", None, None).prefer_inner(), + attr("non_exhaustive", None, None), + attr("panic_handler", None, None).prefer_inner(), + attr("path = \"…\"", Some("path"), Some("path =\"${0:path}\"")), + attr("proc_macro", None, None), + attr("proc_macro_attribute", None, None), + attr("proc_macro_derive(…)", Some("proc_macro_derive"), Some("proc_macro_derive(${0:Trait})")), + attr("recursion_limit = …", Some("recursion_limit"), Some("recursion_limit = ${0:128}")) + .prefer_inner(), + attr("repr(…)", Some("repr"), Some("repr(${0:C})")), + attr( + "should_panic(…)", + Some("should_panic"), + Some(r#"should_panic(expected = "${0:reason}")"#), + ), + attr( + r#"target_feature = "…""#, + Some("target_feature"), + Some("target_feature = \"${0:feature}\""), + ), + attr("test", None, None), + attr("used", None, None), + attr("warn(…)", Some("warn"), Some("warn(${0:lint})")), + attr( + r#"windows_subsystem = "…""#, + Some("windows_subsystem"), + Some(r#"windows_subsystem = "${0:subsystem}""#), + ) + .prefer_inner(), ]; fn complete_derive(acc: &mut Completions, ctx: &CompletionContext, derive_input: ast::TokenTree) { -- cgit v1.2.3 From 314efae29d42d2adae990e70eb4ccbaa141a5a06 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 3 Jul 2020 15:46:37 +0200 Subject: Refactor attribut completion tests --- crates/ra_ide/src/completion/complete_attribute.rs | 760 ++++----------------- 1 file changed, 115 insertions(+), 645 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index 4e50a294f..9db317509 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs @@ -226,677 +226,147 @@ const DEFAULT_DERIVE_COMPLETIONS: &[DeriveCompletion] = &[ #[cfg(test)] mod tests { - use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot; + use expect::{expect, Expect}; - fn do_attr_completion(code: &str) -> Vec { - do_completion(code, CompletionKind::Attribute) + use crate::completion::{test_utils::completion_list, CompletionKind}; + + fn check(ra_fixture: &str, expect: Expect) { + let actual = completion_list(ra_fixture, CompletionKind::Attribute); + expect.assert_eq(&actual); } #[test] fn empty_derive_completion() { - assert_debug_snapshot!( - do_attr_completion( - r" - #[derive(<|>)] - struct Test {} - ", - ), - @r###" - [ - CompletionItem { - label: "Clone", - source_range: 9..9, - delete: 9..9, - insert: "Clone", - kind: Attribute, - }, - CompletionItem { - label: "Copy, Clone", - source_range: 9..9, - delete: 9..9, - insert: "Copy, Clone", - kind: Attribute, - }, - CompletionItem { - label: "Debug", - source_range: 9..9, - delete: 9..9, - insert: "Debug", - kind: Attribute, - }, - CompletionItem { - label: "Default", - source_range: 9..9, - delete: 9..9, - insert: "Default", - kind: Attribute, - }, - CompletionItem { - label: "Eq, PartialEq", - source_range: 9..9, - delete: 9..9, - insert: "Eq, PartialEq", - kind: Attribute, - }, - CompletionItem { - label: "Hash", - source_range: 9..9, - delete: 9..9, - insert: "Hash", - kind: Attribute, - }, - CompletionItem { - label: "Ord, PartialOrd, Eq, PartialEq", - source_range: 9..9, - delete: 9..9, - insert: "Ord, PartialOrd, Eq, PartialEq", - kind: Attribute, - }, - CompletionItem { - label: "PartialEq", - source_range: 9..9, - delete: 9..9, - insert: "PartialEq", - kind: Attribute, - }, - CompletionItem { - label: "PartialOrd, PartialEq", - source_range: 9..9, - delete: 9..9, - insert: "PartialOrd, PartialEq", - kind: Attribute, - }, - ] - "### + check( + r#" +#[derive(<|>)] +struct Test {} + "#, + expect![[r#" + at Clone + at Copy, Clone + at Debug + at Default + at Eq, PartialEq + at Hash + at Ord, PartialOrd, Eq, PartialEq + at PartialEq + at PartialOrd, PartialEq + "#]], ); } #[test] fn no_completion_for_incorrect_derive() { - assert_debug_snapshot!( - do_attr_completion( - r" - #[derive{<|>)] - struct Test {} - ", - ), - @"[]" - ); + check( + r#" +#[derive{<|>)] +struct Test {} +"#, + expect![[r#""#]], + ) } #[test] fn derive_with_input_completion() { - assert_debug_snapshot!( - do_attr_completion( - r" - #[derive(serde::Serialize, PartialEq, <|>)] - struct Test {} - ", - ), - @r###" - [ - CompletionItem { - label: "Clone", - source_range: 38..38, - delete: 38..38, - insert: "Clone", - kind: Attribute, - }, - CompletionItem { - label: "Copy, Clone", - source_range: 38..38, - delete: 38..38, - insert: "Copy, Clone", - kind: Attribute, - }, - CompletionItem { - label: "Debug", - source_range: 38..38, - delete: 38..38, - insert: "Debug", - kind: Attribute, - }, - CompletionItem { - label: "Default", - source_range: 38..38, - delete: 38..38, - insert: "Default", - kind: Attribute, - }, - CompletionItem { - label: "Eq", - source_range: 38..38, - delete: 38..38, - insert: "Eq", - kind: Attribute, - }, - CompletionItem { - label: "Hash", - source_range: 38..38, - delete: 38..38, - insert: "Hash", - kind: Attribute, - }, - CompletionItem { - label: "Ord, PartialOrd, Eq", - source_range: 38..38, - delete: 38..38, - insert: "Ord, PartialOrd, Eq", - kind: Attribute, - }, - CompletionItem { - label: "PartialOrd", - source_range: 38..38, - delete: 38..38, - insert: "PartialOrd", - kind: Attribute, - }, - ] - "### - ); + check( + r#" +#[derive(serde::Serialize, PartialEq, <|>)] +struct Test {} +"#, + expect![[r#" + at Clone + at Copy, Clone + at Debug + at Default + at Eq + at Hash + at Ord, PartialOrd, Eq + at PartialOrd + "#]], + ) } #[test] fn test_attribute_completion() { - assert_debug_snapshot!( - do_attr_completion( - r" - #[<|>] - ", - ), - @r###" - [ - CompletionItem { - label: "allow(…)", - source_range: 2..2, - delete: 2..2, - insert: "allow(${0:lint})", - kind: Attribute, - lookup: "allow", - }, - CompletionItem { - label: "cfg(…)", - source_range: 2..2, - delete: 2..2, - insert: "cfg(${0:predicate})", - kind: Attribute, - lookup: "cfg", - }, - CompletionItem { - label: "cfg_attr(…)", - source_range: 2..2, - delete: 2..2, - insert: "cfg_attr(${1:predicate}, ${0:attr})", - kind: Attribute, - lookup: "cfg_attr", - }, - CompletionItem { - label: "deny(…)", - source_range: 2..2, - delete: 2..2, - insert: "deny(${0:lint})", - kind: Attribute, - lookup: "deny", - }, - CompletionItem { - label: "deprecated = \"…\"", - source_range: 2..2, - delete: 2..2, - insert: "deprecated = \"${0:reason}\"", - kind: Attribute, - lookup: "deprecated", - }, - CompletionItem { - label: "derive(…)", - source_range: 2..2, - delete: 2..2, - insert: "derive(${0:Debug})", - kind: Attribute, - lookup: "derive", - }, - CompletionItem { - label: "doc = \"…\"", - source_range: 2..2, - delete: 2..2, - insert: "doc = \"${0:docs}\"", - kind: Attribute, - lookup: "doc", - }, - CompletionItem { - label: "forbid(…)", - source_range: 2..2, - delete: 2..2, - insert: "forbid(${0:lint})", - kind: Attribute, - lookup: "forbid", - }, - CompletionItem { - label: "ignore(…)", - source_range: 2..2, - delete: 2..2, - insert: "ignore(${0:lint})", - kind: Attribute, - lookup: "ignore", - }, - CompletionItem { - label: "inline(…)", - source_range: 2..2, - delete: 2..2, - insert: "inline(${0:lint})", - kind: Attribute, - lookup: "inline", - }, - CompletionItem { - label: "link", - source_range: 2..2, - delete: 2..2, - insert: "link", - kind: Attribute, - }, - CompletionItem { - label: "link_name = \"…\"", - source_range: 2..2, - delete: 2..2, - insert: "link_name = \"${0:symbol_name}\"", - kind: Attribute, - lookup: "link_name", - }, - CompletionItem { - label: "macro_export", - source_range: 2..2, - delete: 2..2, - insert: "macro_export", - kind: Attribute, - }, - CompletionItem { - label: "macro_use", - source_range: 2..2, - delete: 2..2, - insert: "macro_use", - kind: Attribute, - }, - CompletionItem { - label: "must_use = \"…\"", - source_range: 2..2, - delete: 2..2, - insert: "must_use = \"${0:reason}\"", - kind: Attribute, - lookup: "must_use", - }, - CompletionItem { - label: "no_mangle", - source_range: 2..2, - delete: 2..2, - insert: "no_mangle", - kind: Attribute, - }, - CompletionItem { - label: "non_exhaustive", - source_range: 2..2, - delete: 2..2, - insert: "non_exhaustive", - kind: Attribute, - }, - CompletionItem { - label: "path = \"…\"", - source_range: 2..2, - delete: 2..2, - insert: "path =\"${0:path}\"", - kind: Attribute, - lookup: "path", - }, - CompletionItem { - label: "proc_macro", - source_range: 2..2, - delete: 2..2, - insert: "proc_macro", - kind: Attribute, - }, - CompletionItem { - label: "proc_macro_attribute", - source_range: 2..2, - delete: 2..2, - insert: "proc_macro_attribute", - kind: Attribute, - }, - CompletionItem { - label: "proc_macro_derive(…)", - source_range: 2..2, - delete: 2..2, - insert: "proc_macro_derive(${0:Trait})", - kind: Attribute, - lookup: "proc_macro_derive", - }, - CompletionItem { - label: "repr(…)", - source_range: 2..2, - delete: 2..2, - insert: "repr(${0:C})", - kind: Attribute, - lookup: "repr", - }, - CompletionItem { - label: "should_panic(…)", - source_range: 2..2, - delete: 2..2, - insert: "should_panic(expected = \"${0:reason}\")", - kind: Attribute, - lookup: "should_panic", - }, - CompletionItem { - label: "target_feature = \"…\"", - source_range: 2..2, - delete: 2..2, - insert: "target_feature = \"${0:feature}\"", - kind: Attribute, - lookup: "target_feature", - }, - CompletionItem { - label: "test", - source_range: 2..2, - delete: 2..2, - insert: "test", - kind: Attribute, - }, - CompletionItem { - label: "used", - source_range: 2..2, - delete: 2..2, - insert: "used", - kind: Attribute, - }, - CompletionItem { - label: "warn(…)", - source_range: 2..2, - delete: 2..2, - insert: "warn(${0:lint})", - kind: Attribute, - lookup: "warn", - }, - ] - "### - ); + check( + r#"#[<|>]"#, + expect![[r#" + at allow(…) + at cfg(…) + at cfg_attr(…) + at deny(…) + at deprecated = "…" + at derive(…) + at doc = "…" + at forbid(…) + at ignore(…) + at inline(…) + at link + at link_name = "…" + at macro_export + at macro_use + at must_use = "…" + at no_mangle + at non_exhaustive + at path = "…" + at proc_macro + at proc_macro_attribute + at proc_macro_derive(…) + at repr(…) + at should_panic(…) + at target_feature = "…" + at test + at used + at warn(…) + "#]], + ) } #[test] fn test_attribute_completion_inside_nested_attr() { - assert_debug_snapshot!( - do_attr_completion( - r" - #[allow(<|>)] - ", - ), - @r###" - [] - "### - ); + check(r#"#[allow(<|>)]"#, expect![[]]) } #[test] fn test_inner_attribute_completion() { - assert_debug_snapshot!( - do_attr_completion( - r" - #![<|>] - ", - ), - @r###" - [ - CompletionItem { - label: "allow(…)", - source_range: 3..3, - delete: 3..3, - insert: "allow(${0:lint})", - kind: Attribute, - lookup: "allow", - }, - CompletionItem { - label: "cfg(…)", - source_range: 3..3, - delete: 3..3, - insert: "cfg(${0:predicate})", - kind: Attribute, - lookup: "cfg", - }, - CompletionItem { - label: "cfg_attr(…)", - source_range: 3..3, - delete: 3..3, - insert: "cfg_attr(${1:predicate}, ${0:attr})", - kind: Attribute, - lookup: "cfg_attr", - }, - CompletionItem { - label: "deny(…)", - source_range: 3..3, - delete: 3..3, - insert: "deny(${0:lint})", - kind: Attribute, - lookup: "deny", - }, - CompletionItem { - label: "deprecated = \"…\"", - source_range: 3..3, - delete: 3..3, - insert: "deprecated = \"${0:reason}\"", - kind: Attribute, - lookup: "deprecated", - }, - CompletionItem { - label: "derive(…)", - source_range: 3..3, - delete: 3..3, - insert: "derive(${0:Debug})", - kind: Attribute, - lookup: "derive", - }, - CompletionItem { - label: "doc = \"…\"", - source_range: 3..3, - delete: 3..3, - insert: "doc = \"${0:docs}\"", - kind: Attribute, - lookup: "doc", - }, - CompletionItem { - label: "feature(…)", - source_range: 3..3, - delete: 3..3, - insert: "feature(${0:flag})", - kind: Attribute, - lookup: "feature", - }, - CompletionItem { - label: "forbid(…)", - source_range: 3..3, - delete: 3..3, - insert: "forbid(${0:lint})", - kind: Attribute, - lookup: "forbid", - }, - CompletionItem { - label: "global_allocator", - source_range: 3..3, - delete: 3..3, - insert: "global_allocator", - kind: Attribute, - }, - CompletionItem { - label: "ignore(…)", - source_range: 3..3, - delete: 3..3, - insert: "ignore(${0:lint})", - kind: Attribute, - lookup: "ignore", - }, - CompletionItem { - label: "inline(…)", - source_range: 3..3, - delete: 3..3, - insert: "inline(${0:lint})", - kind: Attribute, - lookup: "inline", - }, - CompletionItem { - label: "link", - source_range: 3..3, - delete: 3..3, - insert: "link", - kind: Attribute, - }, - CompletionItem { - label: "link_name = \"…\"", - source_range: 3..3, - delete: 3..3, - insert: "link_name = \"${0:symbol_name}\"", - kind: Attribute, - lookup: "link_name", - }, - CompletionItem { - label: "macro_export", - source_range: 3..3, - delete: 3..3, - insert: "macro_export", - kind: Attribute, - }, - CompletionItem { - label: "macro_use", - source_range: 3..3, - delete: 3..3, - insert: "macro_use", - kind: Attribute, - }, - CompletionItem { - label: "must_use = \"…\"", - source_range: 3..3, - delete: 3..3, - insert: "must_use = \"${0:reason}\"", - kind: Attribute, - lookup: "must_use", - }, - CompletionItem { - label: "no_mangle", - source_range: 3..3, - delete: 3..3, - insert: "no_mangle", - kind: Attribute, - }, - CompletionItem { - label: "no_std", - source_range: 3..3, - delete: 3..3, - insert: "no_std", - kind: Attribute, - }, - CompletionItem { - label: "non_exhaustive", - source_range: 3..3, - delete: 3..3, - insert: "non_exhaustive", - kind: Attribute, - }, - CompletionItem { - label: "panic_handler", - source_range: 3..3, - delete: 3..3, - insert: "panic_handler", - kind: Attribute, - }, - CompletionItem { - label: "path = \"…\"", - source_range: 3..3, - delete: 3..3, - insert: "path =\"${0:path}\"", - kind: Attribute, - lookup: "path", - }, - CompletionItem { - label: "proc_macro", - source_range: 3..3, - delete: 3..3, - insert: "proc_macro", - kind: Attribute, - }, - CompletionItem { - label: "proc_macro_attribute", - source_range: 3..3, - delete: 3..3, - insert: "proc_macro_attribute", - kind: Attribute, - }, - CompletionItem { - label: "proc_macro_derive(…)", - source_range: 3..3, - delete: 3..3, - insert: "proc_macro_derive(${0:Trait})", - kind: Attribute, - lookup: "proc_macro_derive", - }, - CompletionItem { - label: "recursion_limit = …", - source_range: 3..3, - delete: 3..3, - insert: "recursion_limit = ${0:128}", - kind: Attribute, - lookup: "recursion_limit", - }, - CompletionItem { - label: "repr(…)", - source_range: 3..3, - delete: 3..3, - insert: "repr(${0:C})", - kind: Attribute, - lookup: "repr", - }, - CompletionItem { - label: "should_panic(…)", - source_range: 3..3, - delete: 3..3, - insert: "should_panic(expected = \"${0:reason}\")", - kind: Attribute, - lookup: "should_panic", - }, - CompletionItem { - label: "target_feature = \"…\"", - source_range: 3..3, - delete: 3..3, - insert: "target_feature = \"${0:feature}\"", - kind: Attribute, - lookup: "target_feature", - }, - CompletionItem { - label: "test", - source_range: 3..3, - delete: 3..3, - insert: "test", - kind: Attribute, - }, - CompletionItem { - label: "used", - source_range: 3..3, - delete: 3..3, - insert: "used", - kind: Attribute, - }, - CompletionItem { - label: "warn(…)", - source_range: 3..3, - delete: 3..3, - insert: "warn(${0:lint})", - kind: Attribute, - lookup: "warn", - }, - CompletionItem { - label: "windows_subsystem = \"…\"", - source_range: 3..3, - delete: 3..3, - insert: "windows_subsystem = \"${0:subsystem}\"", - kind: Attribute, - lookup: "windows_subsystem", - }, - ] - "### + check( + r"#![<|>]", + expect![[r#" + at allow(…) + at cfg(…) + at cfg_attr(…) + at deny(…) + at deprecated = "…" + at derive(…) + at doc = "…" + at feature(…) + at forbid(…) + at global_allocator + at ignore(…) + at inline(…) + at link + at link_name = "…" + at macro_export + at macro_use + at must_use = "…" + at no_mangle + at no_std + at non_exhaustive + at panic_handler + at path = "…" + at proc_macro + at proc_macro_attribute + at proc_macro_derive(…) + at recursion_limit = … + at repr(…) + at should_panic(…) + at target_feature = "…" + at test + at used + at warn(…) + at windows_subsystem = "…" + "#]], ); } } -- cgit v1.2.3