From 3564fbb7f5fc7fc91530c441a6dacce88762fcc9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 15 Nov 2019 12:56:24 +0300 Subject: [PATCH] Auto-upgrade some insta snapshots --- crates/ra_hir/src/ty/tests.rs | 54 +- .../ra_ide_api/src/completion/complete_dot.rs | 94 +- .../src/completion/complete_fn_param.rs | 54 +- .../src/completion/complete_keyword.rs | 960 +++++++++--------- .../complete_macro_in_item_position.rs | 95 +- .../src/completion/complete_path.rs | 332 +++--- .../src/completion/complete_pattern.rs | 60 +- .../src/completion/complete_postfix.rs | 298 +++--- .../src/completion/complete_record_literal.rs | 102 +- .../src/completion/complete_record_pattern.rs | 56 +- .../src/completion/complete_scope.rs | 56 +- .../src/completion/complete_snippet.rs | 74 +- .../ra_ide_api/src/completion/presentation.rs | 146 +-- crates/ra_ide_api/src/diagnostics.rs | 44 +- crates/ra_ide_api/src/display/structure.rs | 372 +++---- crates/ra_ide_api/src/inlay_hints.rs | 314 +++--- crates/ra_ide_api/src/runnables.rs | 128 +-- 17 files changed, 1643 insertions(+), 1596 deletions(-) diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 8863c36087..fe9346c783 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -254,7 +254,6 @@ fn test(a: u32, b: isize, c: !, d: &str) { 1.0f32; }"#), @r###" - [9; 10) 'a': u32 [17; 18) 'b': isize [27; 28) 'c': ! @@ -317,7 +316,6 @@ fn test() { } "#), @r###" - [15; 20) '{ 1 }': u32 [17; 18) '1': u32 [48; 53) '{ 1 }': u32 @@ -354,7 +352,7 @@ fn test() { [66; 74) 'S::foo()': i32 [80; 88) '::foo': fn foo() -> i32 [80; 90) '::foo()': i32 -"### + "### ); } @@ -409,7 +407,6 @@ fn test() { } "#), @r###" - [72; 154) '{ ...a.c; }': () [82; 83) 'c': C [86; 87) 'C': C(usize) -> C @@ -443,7 +440,6 @@ fn test() { E::V2; }"#), @r###" - [48; 82) '{ E:...:V2; }': () [52; 70) 'E::V1 ...d: 1 }': E [67; 68) '1': u32 @@ -471,7 +467,6 @@ fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) { } "#), @r###" - [9; 10) 'a': &u32 [18; 19) 'b': &mut u32 [31; 32) 'c': *const u32 @@ -524,7 +519,6 @@ fn test() { } "##), @r###" - [11; 221) '{ ...o"#; }': () [17; 21) '5i32': i32 [27; 31) '5f32': f32 @@ -568,7 +562,6 @@ fn test(x: SomeType) { } "#), @r###" - [27; 28) 'x': SomeType [40; 272) '{ ...lo"; }': () [50; 51) 'b': bool @@ -632,7 +625,6 @@ fn test() -> &mut &f64 { } "#), @r###" - [14; 15) 'x': u32 [22; 24) '{}': () [78; 231) '{ ...t &c }': &mut &f64 @@ -679,7 +671,6 @@ impl S { } "#), @r###" - [34; 38) 'self': &S [40; 61) '{ ... }': () [50; 54) 'self': &S @@ -719,7 +710,6 @@ fn test() -> bool { } "#), @r###" - [6; 7) 'x': bool [22; 34) '{ 0i32 }': i32 [28; 32) '0i32': i32 @@ -802,7 +792,6 @@ fn test2(a1: *const A, a2: *mut A) { } "#), @r###" - [44; 45) 'a': A [50; 213) '{ ...5.b; }': () [60; 62) 'a1': A @@ -970,7 +959,7 @@ fn test(a: A) { [374; 375) 'B': B>(T) -> B [374; 378) 'B(a)': B> [376; 377) 'a': A -"### + "### ); } @@ -983,7 +972,6 @@ fn test() { } "#), @r###" - [11; 37) '{ l... {}; }': () [20; 21) 'x': () [24; 34) 'if true {}': () @@ -1105,7 +1093,6 @@ fn test(a: A) { } "#), @r###" - [32; 36) 'self': A [38; 39) 'x': u32 [53; 55) '{}': () @@ -1142,7 +1129,6 @@ fn test() { } "#), @r###" - [40; 44) 'self': &str [53; 55) '{}': () [69; 89) '{ ...o(); }': () @@ -1166,7 +1152,6 @@ fn test(x: &str, y: isize) { } "#), @r###" - [9; 10) 'x': &str [18; 19) 'y': isize [28; 170) '{ ...d"); }': () @@ -1367,7 +1352,6 @@ fn test() { } "#), @r###" - [28; 79) '{ ...(1); }': () [38; 42) 'A(n)': A [40; 41) 'n': &i32 @@ -1396,7 +1380,6 @@ fn test() { } "#), @r###" - [11; 57) '{ ...= v; }': () [21; 22) 'v': &(i32, &i32) [25; 33) '&(1, &2)': &(i32, &i32) @@ -1441,7 +1424,6 @@ fn test() { } "#), @r###" - [68; 289) '{ ... d; }': () [78; 79) 'e': E [82; 95) 'E::A { x: 3 }': E @@ -1488,7 +1470,6 @@ fn test(a1: A, i: i32) { } "#), @r###" - [36; 38) 'a1': A [48; 49) 'i': i32 [56; 147) '{ ...3.x; }': () @@ -1569,7 +1550,6 @@ fn test(a1: A, o: Option) { } "#), @r###" - [79; 81) 'a1': A [91; 92) 'o': Option [107; 244) '{ ... }; }': () @@ -1604,7 +1584,6 @@ fn test() { } "#), @r###" - [10; 11) 't': T [21; 26) '{ t }': T [23; 24) 't': T @@ -1652,7 +1631,6 @@ fn test() -> i128 { } "#), @r###" - [74; 78) 'self': A [85; 107) '{ ... }': X [95; 99) 'self': A @@ -1706,7 +1684,6 @@ fn test(o: Option) { } "#), @r###" - [78; 82) 'self': &Option [98; 100) '{}': () [111; 112) 'o': Option @@ -1744,7 +1721,6 @@ fn test() -> i128 { } "#), @r###" - [53; 57) 'self': A [65; 87) '{ ... }': T2 [75; 79) 'self': A @@ -1921,7 +1897,6 @@ fn test() { } "#), @r###" - [56; 64) '{ A {} }': A [58; 62) 'A {}': A [126; 132) '{ 99 }': u32 @@ -1961,7 +1936,6 @@ fn test() { } "#), @r###" - [64; 67) 'val': T [82; 109) '{ ... }': Gen [92; 103) 'Gen { val }': Gen @@ -2129,7 +2103,6 @@ fn test(x: X) { } "#), @r###" - [20; 21) 'x': X [26; 47) '{ ...eld; }': () [32; 33) 'x': X @@ -2151,7 +2124,6 @@ fn test() { } "#), @r###" - [11; 89) '{ ... } }': () [17; 21) 'X {}': {unknown} [27; 87) 'match ... }': () @@ -2174,7 +2146,6 @@ fn quux() { } "#), @r###" - [11; 41) '{ ...+ y; }': () [21; 22) 'y': i32 [25; 27) '92': i32 @@ -2300,7 +2271,6 @@ fn write() { } "#), @r###" - [54; 139) '{ ... } }': () [60; 137) 'match ... }': () [66; 83) 'someth...nknown': Maybe<{unknown}> @@ -2322,7 +2292,6 @@ fn test_line_buffer() { } "#), @r###" - [23; 53) '{ ...n']; }': () [29; 50) '&[0, b...b'\n']': &[u8;_] [30; 50) '[0, b'...b'\n']': [u8;_] @@ -2446,7 +2415,6 @@ fn test(query_response: Canonical>) { } "#), @r###" - [92; 106) 'query_response': Canonical> [137; 167) '{ ...lue; }': () [143; 164) '&query....value': &QueryResponse @@ -2472,7 +2440,6 @@ pub fn main_loop() { } "#), @r###" - [144; 146) '{}': () [169; 198) '{ ...t(); }': () [175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet @@ -2518,7 +2485,6 @@ fn test() { } "#), @r###" - [49; 50) '0': u32 [80; 83) '101': u32 [95; 213) '{ ...NST; }': () @@ -2549,7 +2515,6 @@ fn test() { } "#), @r###" - [29; 32) '101': u32 [70; 73) '101': u32 [85; 280) '{ ...MUT; }': () @@ -2588,7 +2553,6 @@ fn test() { } "#), @r###" - [31; 35) 'self': &Self [110; 114) 'self': &Self [170; 228) '{ ...i128 }': () @@ -2636,7 +2600,6 @@ mod bar_test { } "#), @r###" - [63; 67) 'self': &Self [169; 173) 'self': &Self [300; 337) '{ ... }': () @@ -2664,7 +2627,6 @@ fn test() { } "#), @r###" - [33; 37) 'self': &Self [92; 111) '{ ...d(); }': () [98; 99) 'S': S @@ -2694,7 +2656,6 @@ fn test() { } "#), @r###" - [43; 47) 'self': &Self [82; 86) 'self': &Self [210; 361) '{ ..., i8 }': () @@ -2725,7 +2686,6 @@ fn test() { } "#), @r###" - [33; 37) 'self': &Self [102; 127) '{ ...d(); }': () [108; 109) 'S': S(T) -> S @@ -3130,7 +3090,6 @@ fn test>() { } "#), @r###" - [67; 100) '{ ...own; }': () [77; 78) 'y': {unknown} [90; 97) 'unknown': {unknown} @@ -3146,7 +3105,6 @@ const A: u32 = 1 + 1; static B: u64 = { let x = 1; x }; "#), @r###" - [16; 17) '1': u32 [16; 21) '1 + 1': u32 [20; 21) '1': u32 @@ -3170,7 +3128,6 @@ fn test() -> u64 { } "#), @r###" - [38; 87) '{ ... a.1 }': u64 [48; 49) 'a': S [52; 53) 'S': S(i32, u64) -> S @@ -3225,7 +3182,6 @@ fn indexing_arrays() { assert_snapshot!( infer("fn main() { &mut [9][2]; }"), @r###" - [10; 26) '{ &mut...[2]; }': () [12; 23) '&mut [9][2]': &mut {unknown} [17; 20) '[9]': [i32;_] @@ -4822,9 +4778,9 @@ fn main() { } "#), @r###" - ![0; 1) '6': i32 - [64; 88) '{ ...!(); }': () - [74; 75) 'x': i32 + ![0; 1) '6': i32 + [64; 88) '{ ...!(); }': () + [74; 75) 'x': i32 "### ); } diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index b4df6ee2ad..4e2c497e1d 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs @@ -88,16 +88,16 @@ mod tests { ", ), @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "the_field", - ⋮ source_range: [94; 94), - ⋮ delete: [94; 94), - ⋮ insert: "the_field", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "the_field", + source_range: [94; 94), + delete: [94; 94), + insert: "the_field", + kind: Field, + detail: "u32", + }, + ] "### ); } @@ -349,24 +349,24 @@ mod tests { ", ), @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "0", - ⋮ source_range: [75; 75), - ⋮ delete: [75; 75), - ⋮ insert: "0", - ⋮ kind: Field, - ⋮ detail: "i32", - ⋮ }, - ⋮ CompletionItem { - ⋮ label: "1", - ⋮ source_range: [75; 75), - ⋮ delete: [75; 75), - ⋮ insert: "1", - ⋮ kind: Field, - ⋮ detail: "f64", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "0", + source_range: [75; 75), + delete: [75; 75), + insert: "0", + kind: Field, + detail: "i32", + }, + CompletionItem { + label: "1", + source_range: [75; 75), + delete: [75; 75), + insert: "1", + kind: Field, + detail: "f64", + }, + ] "### ); } @@ -419,16 +419,16 @@ mod tests { ", ), @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "the_field", - ⋮ source_range: [106; 106), - ⋮ delete: [106; 106), - ⋮ insert: "the_field", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "the_field", + source_range: [106; 106), + delete: [106; 106), + insert: "the_field", + kind: Field, + detail: "u32", + }, + ] "### ); } @@ -452,15 +452,15 @@ mod tests { } "###, CompletionKind::Keyword), @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "await", - ⋮ source_range: [74; 74), - ⋮ delete: [74; 74), - ⋮ insert: "await", - ⋮ detail: "expr.await", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "await", + source_range: [74; 74), + delete: [74; 74), + insert: "await", + detail: "expr.await", + }, + ] "### ) } diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs index 3e936e3ecb..5024587065 100644 --- a/crates/ra_ide_api/src/completion/complete_fn_param.rs +++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs @@ -70,15 +70,15 @@ mod tests { ", ), @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "file_id: FileId", - ⋮ source_range: [110; 114), - ⋮ delete: [110; 114), - ⋮ insert: "file_id: FileId", - ⋮ lookup: "file_id", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "file_id: FileId", + source_range: [110; 114), + delete: [110; 114), + insert: "file_id: FileId", + lookup: "file_id", + }, + ] "### ); } @@ -94,15 +94,15 @@ mod tests { ", ), @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "file_id: FileId", - ⋮ source_range: [110; 114), - ⋮ delete: [110; 114), - ⋮ insert: "file_id: FileId", - ⋮ lookup: "file_id", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "file_id: FileId", + source_range: [110; 114), + delete: [110; 114), + insert: "file_id: FileId", + lookup: "file_id", + }, + ] "### ); } @@ -121,15 +121,15 @@ mod tests { ", ), @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "file_id: FileId", - ⋮ source_range: [289; 293), - ⋮ delete: [289; 293), - ⋮ insert: "file_id: FileId", - ⋮ lookup: "file_id", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "file_id: FileId", + source_range: [289; 293), + delete: [289; 293), + insert: "file_id: FileId", + lookup: "file_id", + }, + ] "### ); } diff --git a/crates/ra_ide_api/src/completion/complete_keyword.rs b/crates/ra_ide_api/src/completion/complete_keyword.rs index 48c688a08a..eb7cd9ac20 100644 --- a/crates/ra_ide_api/src/completion/complete_keyword.rs +++ b/crates/ra_ide_api/src/completion/complete_keyword.rs @@ -131,29 +131,31 @@ mod tests { use <|> ", ), - @r###"[ - CompletionItem { - label: "crate", - source_range: [21; 21), - delete: [21; 21), - insert: "crate::", - kind: Keyword, - }, - CompletionItem { - label: "self", - source_range: [21; 21), - delete: [21; 21), - insert: "self", - kind: Keyword, - }, - CompletionItem { - label: "super", - source_range: [21; 21), - delete: [21; 21), - insert: "super::", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "crate", + source_range: [21; 21), + delete: [21; 21), + insert: "crate::", + kind: Keyword, + }, + CompletionItem { + label: "self", + source_range: [21; 21), + delete: [21; 21), + insert: "self", + kind: Keyword, + }, + CompletionItem { + label: "super", + source_range: [21; 21), + delete: [21; 21), + insert: "super::", + kind: Keyword, + }, + ] + "### ); assert_debug_snapshot!( @@ -162,22 +164,24 @@ mod tests { use a::<|> ", ), - @r###"[ - CompletionItem { - label: "self", - source_range: [24; 24), - delete: [24; 24), - insert: "self", - kind: Keyword, - }, - CompletionItem { - label: "super", - source_range: [24; 24), - delete: [24; 24), - insert: "super::", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "self", + source_range: [24; 24), + delete: [24; 24), + insert: "self", + kind: Keyword, + }, + CompletionItem { + label: "super", + source_range: [24; 24), + delete: [24; 24), + insert: "super::", + kind: Keyword, + }, + ] + "### ); assert_debug_snapshot!( @@ -186,22 +190,24 @@ mod tests { use a::{b, <|>} ", ), - @r###"[ - CompletionItem { - label: "self", - source_range: [28; 28), - delete: [28; 28), - insert: "self", - kind: Keyword, - }, - CompletionItem { - label: "super", - source_range: [28; 28), - delete: [28; 28), - insert: "super::", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "self", + source_range: [28; 28), + delete: [28; 28), + insert: "self", + kind: Keyword, + }, + CompletionItem { + label: "super", + source_range: [28; 28), + delete: [28; 28), + insert: "super::", + kind: Keyword, + }, + ] + "### ); } @@ -215,43 +221,45 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "if", - source_range: [49; 49), - delete: [49; 49), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [49; 49), - delete: [49; 49), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [49; 49), - delete: [49; 49), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [49; 49), - delete: [49; 49), - insert: "return;", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [49; 49), - delete: [49; 49), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "if", + source_range: [49; 49), + delete: [49; 49), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [49; 49), + delete: [49; 49), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [49; 49), + delete: [49; 49), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [49; 49), + delete: [49; 49), + insert: "return;", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [49; 49), + delete: [49; 49), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); } @@ -267,57 +275,59 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "else", - source_range: [108; 108), - delete: [108; 108), - insert: "else {$0}", - kind: Keyword, - }, - CompletionItem { - label: "else if", - source_range: [108; 108), - delete: [108; 108), - insert: "else if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "if", - source_range: [108; 108), - delete: [108; 108), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [108; 108), - delete: [108; 108), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [108; 108), - delete: [108; 108), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [108; 108), - delete: [108; 108), - insert: "return;", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [108; 108), - delete: [108; 108), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "else", + source_range: [108; 108), + delete: [108; 108), + insert: "else {$0}", + kind: Keyword, + }, + CompletionItem { + label: "else if", + source_range: [108; 108), + delete: [108; 108), + insert: "else if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "if", + source_range: [108; 108), + delete: [108; 108), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [108; 108), + delete: [108; 108), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [108; 108), + delete: [108; 108), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [108; 108), + delete: [108; 108), + insert: "return;", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [108; 108), + delete: [108; 108), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); } @@ -332,43 +342,45 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "if", - source_range: [56; 56), - delete: [56; 56), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [56; 56), - delete: [56; 56), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [56; 56), - delete: [56; 56), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [56; 56), - delete: [56; 56), - insert: "return $0;", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [56; 56), - delete: [56; 56), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "if", + source_range: [56; 56), + delete: [56; 56), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [56; 56), + delete: [56; 56), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [56; 56), + delete: [56; 56), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [56; 56), + delete: [56; 56), + insert: "return $0;", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [56; 56), + delete: [56; 56), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); assert_debug_snapshot!( do_keyword_completion( @@ -379,43 +391,45 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "if", - source_range: [49; 49), - delete: [49; 49), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [49; 49), - delete: [49; 49), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [49; 49), - delete: [49; 49), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [49; 49), - delete: [49; 49), - insert: "return;", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [49; 49), - delete: [49; 49), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "if", + source_range: [49; 49), + delete: [49; 49), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [49; 49), + delete: [49; 49), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [49; 49), + delete: [49; 49), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [49; 49), + delete: [49; 49), + insert: "return;", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [49; 49), + delete: [49; 49), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); } @@ -431,43 +445,45 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "if", - source_range: [97; 97), - delete: [97; 97), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [97; 97), - delete: [97; 97), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [97; 97), - delete: [97; 97), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [97; 97), - delete: [97; 97), - insert: "return $0", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [97; 97), - delete: [97; 97), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "if", + source_range: [97; 97), + delete: [97; 97), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [97; 97), + delete: [97; 97), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [97; 97), + delete: [97; 97), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [97; 97), + delete: [97; 97), + insert: "return $0", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [97; 97), + delete: [97; 97), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); } @@ -483,43 +499,45 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "if", - source_range: [95; 95), - delete: [95; 95), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [95; 95), - delete: [95; 95), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [95; 95), - delete: [95; 95), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [95; 95), - delete: [95; 95), - insert: "return $0;", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [95; 95), - delete: [95; 95), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "if", + source_range: [95; 95), + delete: [95; 95), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [95; 95), + delete: [95; 95), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [95; 95), + delete: [95; 95), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [95; 95), + delete: [95; 95), + insert: "return $0;", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [95; 95), + delete: [95; 95), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); assert_debug_snapshot!( do_keyword_completion( @@ -533,43 +551,45 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "if", - source_range: [95; 95), - delete: [95; 95), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [95; 95), - delete: [95; 95), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [95; 95), - delete: [95; 95), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [95; 95), - delete: [95; 95), - insert: "return $0;", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [95; 95), - delete: [95; 95), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "if", + source_range: [95; 95), + delete: [95; 95), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [95; 95), + delete: [95; 95), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [95; 95), + delete: [95; 95), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [95; 95), + delete: [95; 95), + insert: "return $0;", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [95; 95), + delete: [95; 95), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); } @@ -583,57 +603,59 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "break", - source_range: [63; 63), - delete: [63; 63), - insert: "break;", - kind: Keyword, - }, - CompletionItem { - label: "continue", - source_range: [63; 63), - delete: [63; 63), - insert: "continue;", - kind: Keyword, - }, - CompletionItem { - label: "if", - source_range: [63; 63), - delete: [63; 63), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [63; 63), - delete: [63; 63), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [63; 63), - delete: [63; 63), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [63; 63), - delete: [63; 63), - insert: "return $0;", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [63; 63), - delete: [63; 63), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "break", + source_range: [63; 63), + delete: [63; 63), + insert: "break;", + kind: Keyword, + }, + CompletionItem { + label: "continue", + source_range: [63; 63), + delete: [63; 63), + insert: "continue;", + kind: Keyword, + }, + CompletionItem { + label: "if", + source_range: [63; 63), + delete: [63; 63), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [63; 63), + delete: [63; 63), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [63; 63), + delete: [63; 63), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [63; 63), + delete: [63; 63), + insert: "return $0;", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [63; 63), + delete: [63; 63), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); // No completion: lambda isolates control flow @@ -645,43 +667,45 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "if", - source_range: [68; 68), - delete: [68; 68), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [68; 68), - delete: [68; 68), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [68; 68), - delete: [68; 68), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [68; 68), - delete: [68; 68), - insert: "return $0;", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [68; 68), - delete: [68; 68), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "if", + source_range: [68; 68), + delete: [68; 68), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [68; 68), + delete: [68; 68), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [68; 68), + delete: [68; 68), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [68; 68), + delete: [68; 68), + insert: "return $0;", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [68; 68), + delete: [68; 68), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ); } @@ -699,57 +723,59 @@ mod tests { } ", ), - @r###"[ - CompletionItem { - label: "break", - source_range: [122; 124), - delete: [122; 124), - insert: "break", - kind: Keyword, - }, - CompletionItem { - label: "continue", - source_range: [122; 124), - delete: [122; 124), - insert: "continue", - kind: Keyword, - }, - CompletionItem { - label: "if", - source_range: [122; 124), - delete: [122; 124), - insert: "if $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "loop", - source_range: [122; 124), - delete: [122; 124), - insert: "loop {$0}", - kind: Keyword, - }, - CompletionItem { - label: "match", - source_range: [122; 124), - delete: [122; 124), - insert: "match $0 {}", - kind: Keyword, - }, - CompletionItem { - label: "return", - source_range: [122; 124), - delete: [122; 124), - insert: "return", - kind: Keyword, - }, - CompletionItem { - label: "while", - source_range: [122; 124), - delete: [122; 124), - insert: "while $0 {}", - kind: Keyword, - }, -]"### + @r###" + [ + CompletionItem { + label: "break", + source_range: [122; 124), + delete: [122; 124), + insert: "break", + kind: Keyword, + }, + CompletionItem { + label: "continue", + source_range: [122; 124), + delete: [122; 124), + insert: "continue", + kind: Keyword, + }, + CompletionItem { + label: "if", + source_range: [122; 124), + delete: [122; 124), + insert: "if $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "loop", + source_range: [122; 124), + delete: [122; 124), + insert: "loop {$0}", + kind: Keyword, + }, + CompletionItem { + label: "match", + source_range: [122; 124), + delete: [122; 124), + insert: "match $0 {}", + kind: Keyword, + }, + CompletionItem { + label: "return", + source_range: [122; 124), + delete: [122; 124), + insert: "return", + kind: Keyword, + }, + CompletionItem { + label: "while", + source_range: [122; 124), + delete: [122; 124), + insert: "while $0 {}", + kind: Keyword, + }, + ] + "### ) } } diff --git a/crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs b/crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs index 09f743c660..faadd1e3f4 100644 --- a/crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs +++ b/crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs @@ -37,16 +37,18 @@ mod tests { <|> " ), - @r##"[ - CompletionItem { - label: "foo!", - source_range: [46; 46), - delete: [46; 46), - insert: "foo!($0)", - kind: Macro, - detail: "macro_rules! foo", - }, -]"## + @r###" + [ + CompletionItem { + label: "foo!", + source_range: [46; 46), + delete: [46; 46), + insert: "foo!($0)", + kind: Macro, + detail: "macro_rules! foo", + }, + ] + "### ); } @@ -75,19 +77,21 @@ mod tests { <|> " ), - @r##"[ - CompletionItem { - label: "vec!", - source_range: [280; 280), - delete: [280; 280), - insert: "vec![$0]", - kind: Macro, - detail: "macro_rules! vec", - documentation: Documentation( - "Creates a [`Vec`] containing the arguments.\n\n- Create a [`Vec`] containing a given list of elements:\n\n```\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```", - ), - }, -]"## + @r###" + [ + CompletionItem { + label: "vec!", + source_range: [280; 280), + delete: [280; 280), + insert: "vec![$0]", + kind: Macro, + detail: "macro_rules! vec", + documentation: Documentation( + "Creates a [`Vec`] containing the arguments.\n\n- Create a [`Vec`] containing a given list of elements:\n\n```\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```", + ), + }, + ] + "### ); } @@ -110,28 +114,29 @@ mod tests { } " ), - @r###"[ - CompletionItem { - label: "foo!", - source_range: [163; 163), - delete: [163; 163), - insert: "foo! {$0}", - kind: Macro, - detail: "macro_rules! foo", - documentation: Documentation( - "Foo\n\nNot call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`.\nCall as `let _=foo! { hello world };`", - ), - }, - CompletionItem { - label: "main()", - source_range: [163; 163), - delete: [163; 163), - insert: "main()$0", - kind: Function, - lookup: "main", - detail: "fn main()", - }, -] + @r###" + [ + CompletionItem { + label: "foo!", + source_range: [163; 163), + delete: [163; 163), + insert: "foo! {$0}", + kind: Macro, + detail: "macro_rules! foo", + documentation: Documentation( + "Foo\n\nNot call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`.\nCall as `let _=foo! { hello world };`", + ), + }, + CompletionItem { + label: "main()", + source_range: [163; 163), + delete: [163; 163), + insert: "main()$0", + kind: Function, + lookup: "main", + detail: "fn main()", + }, + ] "### ); } diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 09ca401794..5d974cf6d5 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -152,18 +152,20 @@ mod tests { } " ), - @r###"[ - CompletionItem { - label: "my", - source_range: [27; 29), - delete: [27; 29), - insert: "my", - kind: Module, - documentation: Documentation( - "Some simple\ndocs describing `mod my`.", - ), - }, -]"### + @r###" + [ + CompletionItem { + label: "my", + source_range: [27; 29), + delete: [27; 29), + insert: "my", + kind: Module, + documentation: Documentation( + "Some simple\ndocs describing `mod my`.", + ), + }, + ] + "### ); } @@ -179,15 +181,17 @@ mod tests { } " ), - @r###"[ - CompletionItem { - label: "Bar", - source_range: [30; 30), - delete: [30; 30), - insert: "Bar", - kind: Struct, - }, -]"### + @r###" + [ + CompletionItem { + label: "Bar", + source_range: [30; 30), + delete: [30; 30), + insert: "Bar", + kind: Struct, + }, + ] + "### ); } @@ -203,22 +207,24 @@ mod tests { use crate::Sp<|> " ), - @r###"[ - CompletionItem { - label: "Spam", - source_range: [11; 13), - delete: [11; 13), - insert: "Spam", - kind: Struct, - }, - CompletionItem { - label: "foo", - source_range: [11; 13), - delete: [11; 13), - insert: "foo", - kind: Module, - }, -]"### + @r###" + [ + CompletionItem { + label: "Spam", + source_range: [11; 13), + delete: [11; 13), + insert: "Spam", + kind: Struct, + }, + CompletionItem { + label: "foo", + source_range: [11; 13), + delete: [11; 13), + insert: "foo", + kind: Module, + }, + ] + "### ); } @@ -234,22 +240,24 @@ mod tests { use crate::{Sp<|>}; " ), - @r###"[ - CompletionItem { - label: "Spam", - source_range: [12; 14), - delete: [12; 14), - insert: "Spam", - kind: Struct, - }, - CompletionItem { - label: "foo", - source_range: [12; 14), - delete: [12; 14), - insert: "foo", - kind: Module, - }, -]"### + @r###" + [ + CompletionItem { + label: "Spam", + source_range: [12; 14), + delete: [12; 14), + insert: "Spam", + kind: Struct, + }, + CompletionItem { + label: "foo", + source_range: [12; 14), + delete: [12; 14), + insert: "foo", + kind: Module, + }, + ] + "### ); } @@ -269,15 +277,17 @@ mod tests { use crate::{bar::{baz::Sp<|>}}; " ), - @r###"[ - CompletionItem { - label: "Spam", - source_range: [23; 25), - delete: [23; 25), - insert: "Spam", - kind: Struct, - }, -]"### + @r###" + [ + CompletionItem { + label: "Spam", + source_range: [23; 25), + delete: [23; 25), + insert: "Spam", + kind: Struct, + }, + ] + "### ); } @@ -297,30 +307,32 @@ mod tests { fn foo() { let _ = E::<|> } " ), - @r###"[ - CompletionItem { - label: "Bar", - source_range: [116; 116), - delete: [116; 116), - insert: "Bar", - kind: EnumVariant, - detail: "(i32)", - documentation: Documentation( - "Bar Variant with i32", - ), - }, - CompletionItem { - label: "Foo", - source_range: [116; 116), - delete: [116; 116), - insert: "Foo", - kind: EnumVariant, - detail: "()", - documentation: Documentation( - "Foo Variant", - ), - }, -]"### + @r###" + [ + CompletionItem { + label: "Bar", + source_range: [116; 116), + delete: [116; 116), + insert: "Bar", + kind: EnumVariant, + detail: "(i32)", + documentation: Documentation( + "Bar Variant with i32", + ), + }, + CompletionItem { + label: "Foo", + source_range: [116; 116), + delete: [116; 116), + insert: "Foo", + kind: EnumVariant, + detail: "()", + documentation: Documentation( + "Foo Variant", + ), + }, + ] + "### ); } @@ -343,41 +355,43 @@ mod tests { fn foo() { let _ = E::<|> } " ), - @r###"[ - CompletionItem { - label: "Bar", - source_range: [180; 180), - delete: [180; 180), - insert: "Bar", - kind: EnumVariant, - detail: "(i32, u32)", - documentation: Documentation( - "Bar Variant with i32 and u32", - ), - }, - CompletionItem { - label: "Foo", - source_range: [180; 180), - delete: [180; 180), - insert: "Foo", - kind: EnumVariant, - detail: "()", - documentation: Documentation( - "Foo Variant (empty)", - ), - }, - CompletionItem { - label: "S", - source_range: [180; 180), - delete: [180; 180), - insert: "S", - kind: EnumVariant, - detail: "(S)", - documentation: Documentation( - "", - ), - }, -]"### + @r###" + [ + CompletionItem { + label: "Bar", + source_range: [180; 180), + delete: [180; 180), + insert: "Bar", + kind: EnumVariant, + detail: "(i32, u32)", + documentation: Documentation( + "Bar Variant with i32 and u32", + ), + }, + CompletionItem { + label: "Foo", + source_range: [180; 180), + delete: [180; 180), + insert: "Foo", + kind: EnumVariant, + detail: "()", + documentation: Documentation( + "Foo Variant (empty)", + ), + }, + CompletionItem { + label: "S", + source_range: [180; 180), + delete: [180; 180), + insert: "S", + kind: EnumVariant, + detail: "(S)", + documentation: Documentation( + "", + ), + }, + ] + "### ); } @@ -434,19 +448,21 @@ mod tests { fn foo() { let _ = S::<|> } " ), - @r###"[ - CompletionItem { - label: "C", - source_range: [107; 107), - delete: [107; 107), - insert: "C", - kind: Const, - detail: "const C: i32 = 42;", - documentation: Documentation( - "An associated const", - ), - }, -]"### + @r###" + [ + CompletionItem { + label: "C", + source_range: [107; 107), + delete: [107; 107), + insert: "C", + kind: Const, + detail: "const C: i32 = 42;", + documentation: Documentation( + "An associated const", + ), + }, + ] + "### ); } @@ -467,19 +483,21 @@ mod tests { fn foo() { let _ = S::<|> } " ), - @r###"[ - CompletionItem { - label: "T", - source_range: [101; 101), - delete: [101; 101), - insert: "T", - kind: TypeAlias, - detail: "type T = i32;", - documentation: Documentation( - "An associated type", - ), - }, -]"### + @r###" + [ + CompletionItem { + label: "T", + source_range: [101; 101), + delete: [101; 101), + insert: "T", + kind: TypeAlias, + detail: "type T = i32;", + documentation: Documentation( + "An associated type", + ), + }, + ] + "### ); } @@ -569,15 +587,17 @@ mod tests { } " ), - @r###"[ - CompletionItem { - label: "bar", - source_range: [9; 9), - delete: [9; 9), - insert: "bar", - kind: Module, - }, -]"### + @r###" + [ + CompletionItem { + label: "bar", + source_range: [9; 9), + delete: [9; 9), + insert: "bar", + kind: Module, + }, + ] + "### ); } diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs index 513ad6e5f0..fd03b1c405 100644 --- a/crates/ra_ide_api/src/completion/complete_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_pattern.rs @@ -54,36 +54,36 @@ mod tests { ", ); assert_debug_snapshot!(completions, @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "E", - ⋮ source_range: [246; 246), - ⋮ delete: [246; 246), - ⋮ insert: "E", - ⋮ kind: Enum, - ⋮ }, - ⋮ CompletionItem { - ⋮ label: "X", - ⋮ source_range: [246; 246), - ⋮ delete: [246; 246), - ⋮ insert: "X", - ⋮ kind: EnumVariant, - ⋮ }, - ⋮ CompletionItem { - ⋮ label: "Z", - ⋮ source_range: [246; 246), - ⋮ delete: [246; 246), - ⋮ insert: "Z", - ⋮ kind: Const, - ⋮ }, - ⋮ CompletionItem { - ⋮ label: "m", - ⋮ source_range: [246; 246), - ⋮ delete: [246; 246), - ⋮ insert: "m", - ⋮ kind: Module, - ⋮ }, - ⋮] + [ + CompletionItem { + label: "E", + source_range: [246; 246), + delete: [246; 246), + insert: "E", + kind: Enum, + }, + CompletionItem { + label: "X", + source_range: [246; 246), + delete: [246; 246), + insert: "X", + kind: EnumVariant, + }, + CompletionItem { + label: "Z", + source_range: [246; 246), + delete: [246; 246), + insert: "Z", + kind: Const, + }, + CompletionItem { + label: "m", + source_range: [246; 246), + delete: [246; 246), + insert: "m", + kind: Module, + }, + ] "###); } } diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs index 99fed8689d..17b75cf7eb 100644 --- a/crates/ra_ide_api/src/completion/complete_postfix.rs +++ b/crates/ra_ide_api/src/completion/complete_postfix.rs @@ -104,64 +104,66 @@ mod tests { } "#, ), - @r###"[ - CompletionItem { - label: "box", - source_range: [89; 89), - delete: [85; 89), - insert: "Box::new(bar)", - detail: "Box::new(expr)", - }, - CompletionItem { - label: "dbg", - source_range: [89; 89), - delete: [85; 89), - insert: "dbg!(bar)", - detail: "dbg!(expr)", - }, - CompletionItem { - label: "if", - source_range: [89; 89), - delete: [85; 89), - insert: "if bar {$0}", - detail: "if expr {}", - }, - CompletionItem { - label: "match", - source_range: [89; 89), - delete: [85; 89), - insert: "match bar {\n ${1:_} => {$0\\},\n}", - detail: "match expr {}", - }, - CompletionItem { - label: "not", - source_range: [89; 89), - delete: [85; 89), - insert: "!bar", - detail: "!expr", - }, - CompletionItem { - label: "ref", - source_range: [89; 89), - delete: [85; 89), - insert: "&bar", - detail: "&expr", - }, - CompletionItem { - label: "refm", - source_range: [89; 89), - delete: [85; 89), - insert: "&mut bar", - detail: "&mut expr", - }, - CompletionItem { - label: "while", - source_range: [89; 89), - delete: [85; 89), - insert: "while bar {\n$0\n}", - detail: "while expr {}", - }, -]"### + @r###" + [ + CompletionItem { + label: "box", + source_range: [89; 89), + delete: [85; 89), + insert: "Box::new(bar)", + detail: "Box::new(expr)", + }, + CompletionItem { + label: "dbg", + source_range: [89; 89), + delete: [85; 89), + insert: "dbg!(bar)", + detail: "dbg!(expr)", + }, + CompletionItem { + label: "if", + source_range: [89; 89), + delete: [85; 89), + insert: "if bar {$0}", + detail: "if expr {}", + }, + CompletionItem { + label: "match", + source_range: [89; 89), + delete: [85; 89), + insert: "match bar {\n ${1:_} => {$0\\},\n}", + detail: "match expr {}", + }, + CompletionItem { + label: "not", + source_range: [89; 89), + delete: [85; 89), + insert: "!bar", + detail: "!expr", + }, + CompletionItem { + label: "ref", + source_range: [89; 89), + delete: [85; 89), + insert: "&bar", + detail: "&expr", + }, + CompletionItem { + label: "refm", + source_range: [89; 89), + delete: [85; 89), + insert: "&mut bar", + detail: "&mut expr", + }, + CompletionItem { + label: "while", + source_range: [89; 89), + delete: [85; 89), + insert: "while bar {\n$0\n}", + detail: "while expr {}", + }, + ] + "### ); } @@ -176,50 +178,52 @@ mod tests { } "#, ), - @r###"[ - CompletionItem { - label: "box", - source_range: [91; 91), - delete: [87; 91), - insert: "Box::new(bar)", - detail: "Box::new(expr)", - }, - CompletionItem { - label: "dbg", - source_range: [91; 91), - delete: [87; 91), - insert: "dbg!(bar)", - detail: "dbg!(expr)", - }, - CompletionItem { - label: "match", - source_range: [91; 91), - delete: [87; 91), - insert: "match bar {\n ${1:_} => {$0\\},\n}", - detail: "match expr {}", - }, - CompletionItem { - label: "not", - source_range: [91; 91), - delete: [87; 91), - insert: "!bar", - detail: "!expr", - }, - CompletionItem { - label: "ref", - source_range: [91; 91), - delete: [87; 91), - insert: "&bar", - detail: "&expr", - }, - CompletionItem { - label: "refm", - source_range: [91; 91), - delete: [87; 91), - insert: "&mut bar", - detail: "&mut expr", - }, -]"### + @r###" + [ + CompletionItem { + label: "box", + source_range: [91; 91), + delete: [87; 91), + insert: "Box::new(bar)", + detail: "Box::new(expr)", + }, + CompletionItem { + label: "dbg", + source_range: [91; 91), + delete: [87; 91), + insert: "dbg!(bar)", + detail: "dbg!(expr)", + }, + CompletionItem { + label: "match", + source_range: [91; 91), + delete: [87; 91), + insert: "match bar {\n ${1:_} => {$0\\},\n}", + detail: "match expr {}", + }, + CompletionItem { + label: "not", + source_range: [91; 91), + delete: [87; 91), + insert: "!bar", + detail: "!expr", + }, + CompletionItem { + label: "ref", + source_range: [91; 91), + delete: [87; 91), + insert: "&bar", + detail: "&expr", + }, + CompletionItem { + label: "refm", + source_range: [91; 91), + delete: [87; 91), + insert: "&mut bar", + detail: "&mut expr", + }, + ] + "### ); } @@ -233,50 +237,52 @@ mod tests { } "#, ), - @r###"[ - CompletionItem { - label: "box", - source_range: [52; 52), - delete: [49; 52), - insert: "Box::new(42)", - detail: "Box::new(expr)", - }, - CompletionItem { - label: "dbg", - source_range: [52; 52), - delete: [49; 52), - insert: "dbg!(42)", - detail: "dbg!(expr)", - }, - CompletionItem { - label: "match", - source_range: [52; 52), - delete: [49; 52), - insert: "match 42 {\n ${1:_} => {$0\\},\n}", - detail: "match expr {}", - }, - CompletionItem { - label: "not", - source_range: [52; 52), - delete: [49; 52), - insert: "!42", - detail: "!expr", - }, - CompletionItem { - label: "ref", - source_range: [52; 52), - delete: [49; 52), - insert: "&42", - detail: "&expr", - }, - CompletionItem { - label: "refm", - source_range: [52; 52), - delete: [49; 52), - insert: "&mut 42", - detail: "&mut expr", - }, -]"### + @r###" + [ + CompletionItem { + label: "box", + source_range: [52; 52), + delete: [49; 52), + insert: "Box::new(42)", + detail: "Box::new(expr)", + }, + CompletionItem { + label: "dbg", + source_range: [52; 52), + delete: [49; 52), + insert: "dbg!(42)", + detail: "dbg!(expr)", + }, + CompletionItem { + label: "match", + source_range: [52; 52), + delete: [49; 52), + insert: "match 42 {\n ${1:_} => {$0\\},\n}", + detail: "match expr {}", + }, + CompletionItem { + label: "not", + source_range: [52; 52), + delete: [49; 52), + insert: "!42", + detail: "!expr", + }, + CompletionItem { + label: "ref", + source_range: [52; 52), + delete: [49; 52), + insert: "&42", + detail: "&expr", + }, + CompletionItem { + label: "refm", + source_range: [52; 52), + delete: [49; 52), + insert: "&mut 42", + detail: "&mut expr", + }, + ] + "### ); } } diff --git a/crates/ra_ide_api/src/completion/complete_record_literal.rs b/crates/ra_ide_api/src/completion/complete_record_literal.rs index 0295b81013..45a4a97382 100644 --- a/crates/ra_ide_api/src/completion/complete_record_literal.rs +++ b/crates/ra_ide_api/src/completion/complete_record_literal.rs @@ -45,17 +45,17 @@ mod tests { ", ); assert_debug_snapshot!(completions, @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "the_field", - ⋮ source_range: [142; 145), - ⋮ delete: [142; 145), - ⋮ insert: "the_field", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ deprecated: true, - ⋮ }, - ⋮] + [ + CompletionItem { + label: "the_field", + source_range: [142; 145), + delete: [142; 145), + insert: "the_field", + kind: Field, + detail: "u32", + deprecated: true, + }, + ] "###); } @@ -70,16 +70,16 @@ mod tests { ", ); assert_debug_snapshot!(completions, @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "the_field", - ⋮ source_range: [83; 86), - ⋮ delete: [83; 86), - ⋮ insert: "the_field", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "the_field", + source_range: [83; 86), + delete: [83; 86), + insert: "the_field", + kind: Field, + detail: "u32", + }, + ] "###); } @@ -96,16 +96,16 @@ mod tests { ", ); assert_debug_snapshot!(completions, @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "a", - ⋮ source_range: [119; 119), - ⋮ delete: [119; 119), - ⋮ insert: "a", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "a", + source_range: [119; 119), + delete: [119; 119), + insert: "a", + kind: Field, + detail: "u32", + }, + ] "###); } @@ -122,16 +122,16 @@ mod tests { ", ); assert_debug_snapshot!(completions, @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "b", - ⋮ source_range: [119; 119), - ⋮ delete: [119; 119), - ⋮ insert: "b", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "b", + source_range: [119; 119), + delete: [119; 119), + insert: "b", + kind: Field, + detail: "u32", + }, + ] "###); } @@ -147,16 +147,16 @@ mod tests { ", ); assert_debug_snapshot!(completions, @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "a", - ⋮ source_range: [93; 93), - ⋮ delete: [93; 93), - ⋮ insert: "a", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "a", + source_range: [93; 93), + delete: [93; 93), + insert: "a", + kind: Field, + detail: "u32", + }, + ] "###); } } diff --git a/crates/ra_ide_api/src/completion/complete_record_pattern.rs b/crates/ra_ide_api/src/completion/complete_record_pattern.rs index d20fa796c7..aa0fd6d24f 100644 --- a/crates/ra_ide_api/src/completion/complete_record_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_record_pattern.rs @@ -44,16 +44,16 @@ mod tests { ", ); assert_debug_snapshot!(completions, @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "foo", - ⋮ source_range: [117; 118), - ⋮ delete: [117; 118), - ⋮ insert: "foo", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "foo", + source_range: [117; 118), + delete: [117; 118), + insert: "foo", + kind: Field, + detail: "u32", + }, + ] "###); } @@ -73,24 +73,24 @@ mod tests { ", ); assert_debug_snapshot!(completions, @r###" - ⋮[ - ⋮ CompletionItem { - ⋮ label: "bar", - ⋮ source_range: [161; 161), - ⋮ delete: [161; 161), - ⋮ insert: "bar", - ⋮ kind: Field, - ⋮ detail: "()", - ⋮ }, - ⋮ CompletionItem { - ⋮ label: "foo", - ⋮ source_range: [161; 161), - ⋮ delete: [161; 161), - ⋮ insert: "foo", - ⋮ kind: Field, - ⋮ detail: "u32", - ⋮ }, - ⋮] + [ + CompletionItem { + label: "bar", + source_range: [161; 161), + delete: [161; 161), + insert: "bar", + kind: Field, + detail: "()", + }, + CompletionItem { + label: "foo", + source_range: [161; 161), + delete: [161; 161), + insert: "foo", + kind: Field, + detail: "u32", + }, + ] "###); } } diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 3e205efd12..8c57c907d9 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs @@ -409,15 +409,17 @@ mod tests { // nothing here " ), - @r#"[ - CompletionItem { - label: "other_crate", - source_range: [4; 4), - delete: [4; 4), - insert: "other_crate", - kind: Module, - }, -]"# + @r###" + [ + CompletionItem { + label: "other_crate", + source_range: [4; 4), + delete: [4; 4), + insert: "other_crate", + kind: Module, + }, + ] + "### ); } @@ -530,23 +532,25 @@ mod tests { fn completes_self_in_methods() { assert_debug_snapshot!( do_reference_completion(r"impl S { fn foo(&self) { <|> } }"), - @r#"[ - CompletionItem { - label: "Self", - source_range: [25; 25), - delete: [25; 25), - insert: "Self", - kind: TypeParam, - }, - CompletionItem { - label: "self", - source_range: [25; 25), - delete: [25; 25), - insert: "self", - kind: Binding, - detail: "&{unknown}", - }, -]"# + @r###" + [ + CompletionItem { + label: "Self", + source_range: [25; 25), + delete: [25; 25), + insert: "Self", + kind: TypeParam, + }, + CompletionItem { + label: "self", + source_range: [25; 25), + delete: [25; 25), + insert: "self", + kind: Binding, + detail: "&{unknown}", + }, + ] + "### ); } diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs index 2df79b6c3f..1f2988b36b 100644 --- a/crates/ra_ide_api/src/completion/complete_snippet.rs +++ b/crates/ra_ide_api/src/completion/complete_snippet.rs @@ -52,22 +52,24 @@ mod tests { fn completes_snippets_in_expressions() { assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { <|> }"), - @r#"[ - CompletionItem { - label: "pd", - source_range: [17; 17), - delete: [17; 17), - insert: "eprintln!(\"$0 = {:?}\", $0);", - kind: Snippet, - }, - CompletionItem { - label: "ppd", - source_range: [17; 17), - delete: [17; 17), - insert: "eprintln!(\"$0 = {:#?}\", $0);", - kind: Snippet, - }, -]"# + @r###" + [ + CompletionItem { + label: "pd", + source_range: [17; 17), + delete: [17; 17), + insert: "eprintln!(\"$0 = {:?}\", $0);", + kind: Snippet, + }, + CompletionItem { + label: "ppd", + source_range: [17; 17), + delete: [17; 17), + insert: "eprintln!(\"$0 = {:#?}\", $0);", + kind: Snippet, + }, + ] + "### ); } @@ -75,11 +77,11 @@ mod tests { fn should_not_complete_snippets_in_path() { assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"), - @r#"[]"# + @"[]" ); assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { ::<|> }"), - @r#"[]"# + @"[]" ); } @@ -94,23 +96,25 @@ 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 c343cece64..501b7da4e7 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs @@ -323,38 +323,38 @@ mod tests { "#, ), @r###" - [ - CompletionItem { - label: "main()", - source_range: [203; 206), - delete: [203; 206), - insert: "main()$0", - kind: Function, - lookup: "main", - detail: "fn main()", - }, - CompletionItem { - label: "something_deprecated()", - source_range: [203; 206), - delete: [203; 206), - insert: "something_deprecated()$0", - kind: Function, - lookup: "something_deprecated", - detail: "fn something_deprecated()", - deprecated: true, - }, - CompletionItem { - label: "something_else_deprecated()", - source_range: [203; 206), - delete: [203; 206), - insert: "something_else_deprecated()$0", - kind: Function, - lookup: "something_else_deprecated", - detail: "fn something_else_deprecated()", - deprecated: true, - }, - ] - "### + [ + CompletionItem { + label: "main()", + source_range: [203; 206), + delete: [203; 206), + insert: "main()$0", + kind: Function, + lookup: "main", + detail: "fn main()", + }, + CompletionItem { + label: "something_deprecated()", + source_range: [203; 206), + delete: [203; 206), + insert: "something_deprecated()$0", + kind: Function, + lookup: "something_deprecated", + detail: "fn something_deprecated()", + deprecated: true, + }, + CompletionItem { + label: "something_else_deprecated()", + source_range: [203; 206), + delete: [203; 206), + insert: "something_else_deprecated()$0", + kind: Function, + lookup: "something_else_deprecated", + detail: "fn something_else_deprecated()", + deprecated: true, + }, + ] + "### ); } @@ -459,16 +459,18 @@ mod tests { use crate::m::f<|>; " ), - @r#"[ - CompletionItem { - label: "foo", - source_range: [40; 41), - delete: [40; 41), - insert: "foo", - kind: Function, - detail: "pub fn foo()", - }, -]"# + @r###" + [ + CompletionItem { + label: "foo", + source_range: [40; 41), + delete: [40; 41), + insert: "foo", + kind: Function, + detail: "pub fn foo()", + }, + ] + "### ); } @@ -484,24 +486,26 @@ mod tests { } " ), - @r#"[ - CompletionItem { - label: "frobnicate", - source_range: [35; 39), - delete: [35; 39), - insert: "frobnicate", - kind: Function, - detail: "fn frobnicate()", - }, - CompletionItem { - label: "main", - source_range: [35; 39), - delete: [35; 39), - insert: "main", - kind: Function, - detail: "fn main()", - }, -]"# + @r###" + [ + CompletionItem { + label: "frobnicate", + source_range: [35; 39), + delete: [35; 39), + insert: "frobnicate", + kind: Function, + detail: "fn frobnicate()", + }, + CompletionItem { + label: "main", + source_range: [35; 39), + delete: [35; 39), + insert: "main", + kind: Function, + detail: "fn main()", + }, + ] + "### ); assert_debug_snapshot!( do_reference_completion( @@ -514,16 +518,18 @@ mod tests { } " ), - @r#"[ - CompletionItem { - label: "new", - source_range: [67; 69), - delete: [67; 69), - insert: "new", - kind: Function, - detail: "fn new() -> Foo", - }, -]"# + @r###" + [ + CompletionItem { + label: "new", + source_range: [67; 69), + delete: [67; 69), + insert: "new", + kind: Function, + detail: "fn new() -> Foo", + }, + ] + "### ); } diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 2890a3d2b5..e52ffefb36 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -526,28 +526,28 @@ mod tests { let (analysis, file_id) = single_file("mod foo;"); let diagnostics = analysis.diagnostics(file_id).unwrap(); assert_debug_snapshot!(diagnostics, @r###" - ⋮[ - ⋮ Diagnostic { - ⋮ message: "unresolved module", - ⋮ range: [0; 8), - ⋮ fix: Some( - ⋮ SourceChange { - ⋮ label: "create module", - ⋮ source_file_edits: [], - ⋮ file_system_edits: [ - ⋮ CreateFile { - ⋮ source_root: SourceRootId( - ⋮ 0, - ⋮ ), - ⋮ path: "foo.rs", - ⋮ }, - ⋮ ], - ⋮ cursor_position: None, - ⋮ }, - ⋮ ), - ⋮ severity: Error, - ⋮ }, - ⋮] + [ + Diagnostic { + message: "unresolved module", + range: [0; 8), + fix: Some( + SourceChange { + label: "create module", + source_file_edits: [], + file_system_edits: [ + CreateFile { + source_root: SourceRootId( + 0, + ), + path: "foo.rs", + }, + ], + cursor_position: None, + }, + ), + severity: Error, + }, + ] "###); } diff --git a/crates/ra_ide_api/src/display/structure.rs b/crates/ra_ide_api/src/display/structure.rs index ddd8b7b203..a80d65ac71 100644 --- a/crates/ra_ide_api/src/display/structure.rs +++ b/crates/ra_ide_api/src/display/structure.rs @@ -209,191 +209,193 @@ fn very_obsolete() {} .unwrap(); let structure = file_structure(&file); assert_debug_snapshot!(structure, - @r#"[ - StructureNode { - parent: None, - label: "Foo", - navigation_range: [8; 11), - node_range: [1; 26), - kind: STRUCT_DEF, - detail: None, - deprecated: false, - }, - StructureNode { - parent: Some( - 0, - ), - label: "x", - navigation_range: [18; 19), - node_range: [18; 24), - kind: RECORD_FIELD_DEF, - detail: Some( - "i32", - ), - deprecated: false, - }, - StructureNode { - parent: None, - label: "m", - navigation_range: [32; 33), - node_range: [28; 158), - kind: MODULE, - detail: None, - deprecated: false, - }, - StructureNode { - parent: Some( - 2, - ), - label: "bar1", - navigation_range: [43; 47), - node_range: [40; 52), - kind: FN_DEF, - detail: Some( - "fn()", - ), - deprecated: false, - }, - StructureNode { - parent: Some( - 2, - ), - label: "bar2", - navigation_range: [60; 64), - node_range: [57; 81), - kind: FN_DEF, - detail: Some( - "fn(t: T) -> T", - ), - deprecated: false, - }, - StructureNode { - parent: Some( - 2, - ), - label: "bar3", - navigation_range: [89; 93), - node_range: [86; 156), - kind: FN_DEF, - detail: Some( - "fn(a: A, b: B) -> Vec< u32 >", - ), - deprecated: false, - }, - StructureNode { - parent: None, - label: "E", - navigation_range: [165; 166), - node_range: [160; 180), - kind: ENUM_DEF, - detail: None, - deprecated: false, - }, - StructureNode { - parent: Some( - 6, - ), - label: "X", - navigation_range: [169; 170), - node_range: [169; 170), - kind: ENUM_VARIANT, - detail: None, - deprecated: false, - }, - StructureNode { - parent: Some( - 6, - ), - label: "Y", - navigation_range: [172; 173), - node_range: [172; 178), - kind: ENUM_VARIANT, - detail: None, - deprecated: false, - }, - StructureNode { - parent: None, - label: "T", - navigation_range: [186; 187), - node_range: [181; 193), - kind: TYPE_ALIAS_DEF, - detail: Some( - "()", - ), - deprecated: false, - }, - StructureNode { - parent: None, - label: "S", - navigation_range: [201; 202), - node_range: [194; 213), - kind: STATIC_DEF, - detail: Some( - "i32", - ), - deprecated: false, - }, - StructureNode { - parent: None, - label: "C", - navigation_range: [220; 221), - node_range: [214; 232), - kind: CONST_DEF, - detail: Some( - "i32", - ), - deprecated: false, - }, - StructureNode { - parent: None, - label: "impl E", - navigation_range: [239; 240), - node_range: [234; 243), - kind: IMPL_BLOCK, - detail: None, - deprecated: false, - }, - StructureNode { - parent: None, - label: "impl fmt::Debug for E", - navigation_range: [265; 266), - node_range: [245; 269), - kind: IMPL_BLOCK, - detail: None, - deprecated: false, - }, - StructureNode { - parent: None, - label: "mc", - navigation_range: [284; 286), - node_range: [271; 303), - kind: MACRO_CALL, - detail: None, - deprecated: false, - }, - StructureNode { - parent: None, - label: "obsolete", - navigation_range: [322; 330), - node_range: [305; 335), - kind: FN_DEF, - detail: Some( - "fn()", - ), - deprecated: true, - }, - StructureNode { - parent: None, - label: "very_obsolete", - navigation_range: [375; 388), - node_range: [337; 393), - kind: FN_DEF, - detail: Some( - "fn()", - ), - deprecated: true, - }, -]"# + @r###" + [ + StructureNode { + parent: None, + label: "Foo", + navigation_range: [8; 11), + node_range: [1; 26), + kind: STRUCT_DEF, + detail: None, + deprecated: false, + }, + StructureNode { + parent: Some( + 0, + ), + label: "x", + navigation_range: [18; 19), + node_range: [18; 24), + kind: RECORD_FIELD_DEF, + detail: Some( + "i32", + ), + deprecated: false, + }, + StructureNode { + parent: None, + label: "m", + navigation_range: [32; 33), + node_range: [28; 158), + kind: MODULE, + detail: None, + deprecated: false, + }, + StructureNode { + parent: Some( + 2, + ), + label: "bar1", + navigation_range: [43; 47), + node_range: [40; 52), + kind: FN_DEF, + detail: Some( + "fn()", + ), + deprecated: false, + }, + StructureNode { + parent: Some( + 2, + ), + label: "bar2", + navigation_range: [60; 64), + node_range: [57; 81), + kind: FN_DEF, + detail: Some( + "fn(t: T) -> T", + ), + deprecated: false, + }, + StructureNode { + parent: Some( + 2, + ), + label: "bar3", + navigation_range: [89; 93), + node_range: [86; 156), + kind: FN_DEF, + detail: Some( + "fn(a: A, b: B) -> Vec< u32 >", + ), + deprecated: false, + }, + StructureNode { + parent: None, + label: "E", + navigation_range: [165; 166), + node_range: [160; 180), + kind: ENUM_DEF, + detail: None, + deprecated: false, + }, + StructureNode { + parent: Some( + 6, + ), + label: "X", + navigation_range: [169; 170), + node_range: [169; 170), + kind: ENUM_VARIANT, + detail: None, + deprecated: false, + }, + StructureNode { + parent: Some( + 6, + ), + label: "Y", + navigation_range: [172; 173), + node_range: [172; 178), + kind: ENUM_VARIANT, + detail: None, + deprecated: false, + }, + StructureNode { + parent: None, + label: "T", + navigation_range: [186; 187), + node_range: [181; 193), + kind: TYPE_ALIAS_DEF, + detail: Some( + "()", + ), + deprecated: false, + }, + StructureNode { + parent: None, + label: "S", + navigation_range: [201; 202), + node_range: [194; 213), + kind: STATIC_DEF, + detail: Some( + "i32", + ), + deprecated: false, + }, + StructureNode { + parent: None, + label: "C", + navigation_range: [220; 221), + node_range: [214; 232), + kind: CONST_DEF, + detail: Some( + "i32", + ), + deprecated: false, + }, + StructureNode { + parent: None, + label: "impl E", + navigation_range: [239; 240), + node_range: [234; 243), + kind: IMPL_BLOCK, + detail: None, + deprecated: false, + }, + StructureNode { + parent: None, + label: "impl fmt::Debug for E", + navigation_range: [265; 266), + node_range: [245; 269), + kind: IMPL_BLOCK, + detail: None, + deprecated: false, + }, + StructureNode { + parent: None, + label: "mc", + navigation_range: [284; 286), + node_range: [271; 303), + kind: MACRO_CALL, + detail: None, + deprecated: false, + }, + StructureNode { + parent: None, + label: "obsolete", + navigation_range: [322; 330), + node_range: [305; 335), + kind: FN_DEF, + detail: Some( + "fn()", + ), + deprecated: true, + }, + StructureNode { + parent: None, + label: "very_obsolete", + navigation_range: [375; 388), + node_range: [337; 393), + kind: FN_DEF, + detail: Some( + "fn()", + ), + deprecated: true, + }, + ] + "### ); } } diff --git a/crates/ra_ide_api/src/inlay_hints.rs b/crates/ra_ide_api/src/inlay_hints.rs index f1c0dc1642..2ff10b89a8 100644 --- a/crates/ra_ide_api/src/inlay_hints.rs +++ b/crates/ra_ide_api/src/inlay_hints.rs @@ -214,58 +214,60 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ - InlayHint { - range: [193; 197), - kind: TypeHint, - label: "i32", - }, - InlayHint { - range: [236; 244), - kind: TypeHint, - label: "i32", - }, - InlayHint { - range: [275; 279), - kind: TypeHint, - label: "&str", - }, - InlayHint { - range: [539; 543), - kind: TypeHint, - label: "(i32, char)", - }, - InlayHint { - range: [566; 567), - kind: TypeHint, - label: "i32", - }, - InlayHint { - range: [570; 571), - kind: TypeHint, - label: "i32", - }, - InlayHint { - range: [573; 574), - kind: TypeHint, - label: "i32", - }, - InlayHint { - range: [584; 585), - kind: TypeHint, - label: "i32", - }, - InlayHint { - range: [577; 578), - kind: TypeHint, - label: "f64", - }, - InlayHint { - range: [580; 581), - kind: TypeHint, - label: "f64", - }, -]"# + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###" + [ + InlayHint { + range: [193; 197), + kind: TypeHint, + label: "i32", + }, + InlayHint { + range: [236; 244), + kind: TypeHint, + label: "i32", + }, + InlayHint { + range: [275; 279), + kind: TypeHint, + label: "&str", + }, + InlayHint { + range: [539; 543), + kind: TypeHint, + label: "(i32, char)", + }, + InlayHint { + range: [566; 567), + kind: TypeHint, + label: "i32", + }, + InlayHint { + range: [570; 571), + kind: TypeHint, + label: "i32", + }, + InlayHint { + range: [573; 574), + kind: TypeHint, + label: "i32", + }, + InlayHint { + range: [584; 585), + kind: TypeHint, + label: "i32", + }, + InlayHint { + range: [577; 578), + kind: TypeHint, + label: "f64", + }, + InlayHint { + range: [580; 581), + kind: TypeHint, + label: "f64", + }, + ] + "### ); } @@ -281,18 +283,20 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ - InlayHint { - range: [21; 30), - kind: TypeHint, - label: "i32", - }, - InlayHint { - range: [57; 66), - kind: TypeHint, - label: "i32", - }, -]"# + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###" + [ + InlayHint { + range: [21; 30), + kind: TypeHint, + label: "i32", + }, + InlayHint { + range: [57; 66), + kind: TypeHint, + label: "i32", + }, + ] + "### ); } @@ -308,18 +312,20 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ - InlayHint { - range: [21; 30), - kind: TypeHint, - label: "i32", - }, - InlayHint { - range: [44; 53), - kind: TypeHint, - label: "i32", - }, -]"# + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###" + [ + InlayHint { + range: [21; 30), + kind: TypeHint, + label: "i32", + }, + InlayHint { + range: [44; 53), + kind: TypeHint, + label: "i32", + }, + ] + "### ); } @@ -354,33 +360,35 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ - InlayHint { - range: [166; 170), - kind: TypeHint, - label: "CustomOption", - }, - InlayHint { - range: [334; 338), - kind: TypeHint, - label: "&Test", - }, - InlayHint { - range: [389; 390), - kind: TypeHint, - label: "&CustomOption", - }, - InlayHint { - range: [392; 393), - kind: TypeHint, - label: "&u8", - }, - InlayHint { - range: [531; 532), - kind: TypeHint, - label: "&u32", - }, -]"# + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###" + [ + InlayHint { + range: [166; 170), + kind: TypeHint, + label: "CustomOption", + }, + InlayHint { + range: [334; 338), + kind: TypeHint, + label: "&Test", + }, + InlayHint { + range: [389; 390), + kind: TypeHint, + label: "&CustomOption", + }, + InlayHint { + range: [392; 393), + kind: TypeHint, + label: "&u8", + }, + InlayHint { + range: [531; 532), + kind: TypeHint, + label: "&u32", + }, + ] + "### ); } @@ -416,33 +424,33 @@ fn main() { ); assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###" - ⋮[ - ⋮ InlayHint { - ⋮ range: [166; 170), - ⋮ kind: TypeHint, - ⋮ label: "CustomOption", - ⋮ }, - ⋮ InlayHint { - ⋮ range: [343; 347), - ⋮ kind: TypeHint, - ⋮ label: "&Test", - ⋮ }, - ⋮ InlayHint { - ⋮ range: [401; 402), - ⋮ kind: TypeHint, - ⋮ label: "&CustomOption", - ⋮ }, - ⋮ InlayHint { - ⋮ range: [404; 405), - ⋮ kind: TypeHint, - ⋮ label: "&u8", - ⋮ }, - ⋮ InlayHint { - ⋮ range: [549; 550), - ⋮ kind: TypeHint, - ⋮ label: "&u32", - ⋮ }, - ⋮] + [ + InlayHint { + range: [166; 170), + kind: TypeHint, + label: "CustomOption", + }, + InlayHint { + range: [343; 347), + kind: TypeHint, + label: "&Test", + }, + InlayHint { + range: [401; 402), + kind: TypeHint, + label: "&CustomOption", + }, + InlayHint { + range: [404; 405), + kind: TypeHint, + label: "&u8", + }, + InlayHint { + range: [549; 550), + kind: TypeHint, + label: "&u32", + }, + ] "### ); } @@ -478,28 +486,30 @@ fn main() { }"#, ); - assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ - InlayHint { - range: [311; 315), - kind: TypeHint, - label: "Test", - }, - InlayHint { - range: [358; 359), - kind: TypeHint, - label: "CustomOption", - }, - InlayHint { - range: [361; 362), - kind: TypeHint, - label: "u8", - }, - InlayHint { - range: [484; 485), - kind: TypeHint, - label: "u32", - }, -]"# + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###" + [ + InlayHint { + range: [311; 315), + kind: TypeHint, + label: "Test", + }, + InlayHint { + range: [358; 359), + kind: TypeHint, + label: "CustomOption", + }, + InlayHint { + range: [361; 362), + kind: TypeHint, + label: "u8", + }, + InlayHint { + range: [484; 485), + kind: TypeHint, + label: "u32", + }, + ] + "### ); } } diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs index 1b5c8deea0..366ac80486 100644 --- a/crates/ra_ide_api/src/runnables.rs +++ b/crates/ra_ide_api/src/runnables.rs @@ -97,24 +97,26 @@ mod tests { ); let runnables = analysis.runnables(pos.file_id).unwrap(); assert_debug_snapshot!(&runnables, - @r#"[ - Runnable { - range: [1; 21), - kind: Bin, - }, - Runnable { - range: [22; 46), - kind: Test { - name: "test_foo", - }, - }, - Runnable { - range: [47; 81), - kind: Test { - name: "test_foo", - }, - }, -]"# + @r###" + [ + Runnable { + range: [1; 21), + kind: Bin, + }, + Runnable { + range: [22; 46), + kind: Test { + name: "test_foo", + }, + }, + Runnable { + range: [47; 81), + kind: Test { + name: "test_foo", + }, + }, + ] + "### ); } @@ -132,20 +134,22 @@ mod tests { ); let runnables = analysis.runnables(pos.file_id).unwrap(); assert_debug_snapshot!(&runnables, - @r#"[ - Runnable { - range: [1; 59), - kind: TestMod { - path: "test_mod", - }, - }, - Runnable { - range: [28; 57), - kind: Test { - name: "test_foo1", - }, - }, -]"# + @r###" + [ + Runnable { + range: [1; 59), + kind: TestMod { + path: "test_mod", + }, + }, + Runnable { + range: [28; 57), + kind: Test { + name: "test_foo1", + }, + }, + ] + "### ); } @@ -165,20 +169,22 @@ mod tests { ); let runnables = analysis.runnables(pos.file_id).unwrap(); assert_debug_snapshot!(&runnables, - @r#"[ - Runnable { - range: [23; 85), - kind: TestMod { - path: "foo::test_mod", - }, - }, - Runnable { - range: [46; 79), - kind: Test { - name: "test_foo1", - }, - }, -]"# + @r###" + [ + Runnable { + range: [23; 85), + kind: TestMod { + path: "foo::test_mod", + }, + }, + Runnable { + range: [46; 79), + kind: Test { + name: "test_foo1", + }, + }, + ] + "### ); } @@ -200,20 +206,22 @@ mod tests { ); let runnables = analysis.runnables(pos.file_id).unwrap(); assert_debug_snapshot!(&runnables, - @r#"[ - Runnable { - range: [41; 115), - kind: TestMod { - path: "foo::bar::test_mod", - }, - }, - Runnable { - range: [68; 105), - kind: Test { - name: "test_foo1", - }, - }, -]"# + @r###" + [ + Runnable { + range: [41; 115), + kind: TestMod { + path: "foo::bar::test_mod", + }, + }, + Runnable { + range: [68; 105), + kind: Test { + name: "test_foo1", + }, + }, + ] + "### ); }