diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs index e0368b3b22..a35f315118 100644 --- a/crates/ra_ide_api/src/completion/complete_snippet.rs +++ b/crates/ra_ide_api/src/completion/complete_snippet.rs @@ -84,33 +84,31 @@ mod tests { #[test] fn completes_snippets_in_items() { assert_debug_snapshot_matches!( - do_snippet_completion( - r" + do_snippet_completion( + r" #[cfg(test)] mod tests { <|> } " - ), - @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "Test function", - ⋮ source_range: [78; 78), - ⋮ delete: [78; 78), - ⋮ insert: "#[test]\nfn ${1:feature}() {\n $0\n}", - ⋮ kind: Snippet, - ⋮ lookup: "tfn", - ⋮ }, - ⋮ CompletionItem { - ⋮ label: "pub(crate)", - ⋮ source_range: [78; 78), - ⋮ delete: [78; 78), - ⋮ insert: "pub(crate) $0", - ⋮ kind: Snippet, - ⋮ }, - ⋮] - "### - ); + ), + @r###"[ + CompletionItem { + label: "Test function", + source_range: [78; 78), + delete: [78; 78), + insert: "#[test]\nfn ${1:feature}() {\n $0\n}", + kind: Snippet, + lookup: "tfn", + }, + CompletionItem { + label: "pub(crate)", + source_range: [78; 78), + delete: [78; 78), + insert: "pub(crate) $0", + kind: Snippet, + }, +]"### + ); } } diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index 5df19990ca..6878008d3f 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs @@ -194,64 +194,60 @@ mod tests { fn inserts_parens_for_function_calls() { covers!(inserts_parens_for_function_calls); assert_debug_snapshot_matches!( - do_reference_completion( - r" + do_reference_completion( + r" fn no_args() {} fn main() { no_<|> } " - ), - @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "main", - ⋮ source_range: [61; 64), - ⋮ delete: [61; 64), - ⋮ insert: "main()$0", - ⋮ kind: Function, - ⋮ detail: "fn main()", - ⋮ }, - ⋮ CompletionItem { - ⋮ label: "no_args", - ⋮ source_range: [61; 64), - ⋮ delete: [61; 64), - ⋮ insert: "no_args()$0", - ⋮ kind: Function, - ⋮ detail: "fn no_args()", - ⋮ }, - ⋮] - "### - ); + ), + @r###"[ + CompletionItem { + label: "main", + source_range: [61; 64), + delete: [61; 64), + insert: "main()$0", + kind: Function, + detail: "fn main()", + }, + CompletionItem { + label: "no_args", + source_range: [61; 64), + delete: [61; 64), + insert: "no_args()$0", + kind: Function, + detail: "fn no_args()", + }, +]"### + ); assert_debug_snapshot_matches!( - do_reference_completion( - r" + do_reference_completion( + r" fn with_args(x: i32, y: String) {} fn main() { with_<|> } " - ), - @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "main", - ⋮ source_range: [80; 85), - ⋮ delete: [80; 85), - ⋮ insert: "main()$0", - ⋮ kind: Function, - ⋮ detail: "fn main()", - ⋮ }, - ⋮ CompletionItem { - ⋮ label: "with_args", - ⋮ source_range: [80; 85), - ⋮ delete: [80; 85), - ⋮ insert: "with_args($0)", - ⋮ kind: Function, - ⋮ detail: "fn with_args(x: i32, y: String)", - ⋮ }, - ⋮] - "### - ); + ), + @r###"[ + CompletionItem { + label: "main", + source_range: [80; 85), + delete: [80; 85), + insert: "main()$0", + kind: Function, + detail: "fn main()", + }, + CompletionItem { + label: "with_args", + source_range: [80; 85), + delete: [80; 85), + insert: "with_args($0)", + kind: Function, + detail: "fn with_args(x: i32, y: String)", + }, +]"### + ); assert_debug_snapshot_matches!( - do_reference_completion( - r" + do_reference_completion( + r" struct S {} impl S { fn foo(&self) {} @@ -260,33 +256,31 @@ mod tests { s.f<|> } " - ), - @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "foo", - ⋮ source_range: [163; 164), - ⋮ delete: [163; 164), - ⋮ insert: "foo()$0", - ⋮ kind: Method, - ⋮ detail: "fn foo(&self)", - ⋮ }, - ⋮] - "### - ); + ), + @r###"[ + CompletionItem { + label: "foo", + source_range: [163; 164), + delete: [163; 164), + insert: "foo()$0", + kind: Method, + detail: "fn foo(&self)", + }, +]"### + ); } #[test] fn dont_render_function_parens_in_use_item() { assert_debug_snapshot_matches!( - do_reference_completion( - " + do_reference_completion( + " //- /lib.rs mod m { pub fn foo() {} } use crate::m::f<|>; " - ), - @r#"[ + ), + @r#"[ CompletionItem { label: "foo", source_range: [40; 41), @@ -296,22 +290,22 @@ mod tests { detail: "pub fn foo()", }, ]"# - ); + ); } #[test] fn dont_render_function_parens_if_already_call() { assert_debug_snapshot_matches!( - do_reference_completion( - " + do_reference_completion( + " //- /lib.rs fn frobnicate() {} fn main() { frob<|>(); } " - ), - @r#"[ + ), + @r#"[ CompletionItem { label: "frobnicate", source_range: [35; 39), @@ -329,10 +323,10 @@ mod tests { detail: "fn main()", }, ]"# - ); + ); assert_debug_snapshot_matches!( - do_reference_completion( - " + do_reference_completion( + " //- /lib.rs struct Foo {} impl Foo { fn new() -> Foo {} } @@ -340,8 +334,8 @@ mod tests { Foo::ne<|>(); } " - ), - @r#"[ + ), + @r#"[ CompletionItem { label: "new", source_range: [67; 69), @@ -351,6 +345,6 @@ mod tests { detail: "fn new() -> Foo", }, ]"# - ); + ); } }