mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
Auto-upgrade some insta snapshots
This commit is contained in:
parent
e05fc9455d
commit
3564fbb7f5
17 changed files with 1643 additions and 1596 deletions
|
@ -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) '<S>::foo': fn foo() -> i32
|
||||
[80; 90) '<S>::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<i32>) {
|
|||
[374; 375) 'B': B<A<i32>>(T) -> B<T>
|
||||
[374; 378) 'B(a)': B<A<i32>>
|
||||
[376; 377) 'a': A<i32>
|
||||
"###
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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<i32>
|
||||
[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<u32>, i: i32) {
|
|||
}
|
||||
"#),
|
||||
@r###"
|
||||
|
||||
[36; 38) 'a1': A<u32>
|
||||
[48; 49) 'i': i32
|
||||
[56; 147) '{ ...3.x; }': ()
|
||||
|
@ -1569,7 +1550,6 @@ fn test(a1: A<u32>, o: Option<u64>) {
|
|||
}
|
||||
"#),
|
||||
@r###"
|
||||
|
||||
[79; 81) 'a1': A<u32>
|
||||
[91; 92) 'o': Option<u64>
|
||||
[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<X, Y>
|
||||
[85; 107) '{ ... }': X
|
||||
[95; 99) 'self': A<X, Y>
|
||||
|
@ -1706,7 +1684,6 @@ fn test(o: Option<u32>) {
|
|||
}
|
||||
"#),
|
||||
@r###"
|
||||
|
||||
[78; 82) 'self': &Option<T>
|
||||
[98; 100) '{}': ()
|
||||
[111; 112) 'o': Option<u32>
|
||||
|
@ -1744,7 +1721,6 @@ fn test() -> i128 {
|
|||
}
|
||||
"#),
|
||||
@r###"
|
||||
|
||||
[53; 57) 'self': A<T2>
|
||||
[65; 87) '{ ... }': T2
|
||||
[75; 79) 'self': A<T2>
|
||||
|
@ -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<T>
|
||||
[92; 103) 'Gen { val }': Gen<T>
|
||||
|
@ -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<R>(query_response: Canonical<QueryResponse<R>>) {
|
|||
}
|
||||
"#),
|
||||
@r###"
|
||||
|
||||
[92; 106) 'query_response': Canonical<QueryResponse<R>>
|
||||
[137; 167) '{ ...lue; }': ()
|
||||
[143; 164) '&query....value': &QueryResponse<R>
|
||||
|
@ -2472,7 +2440,6 @@ pub fn main_loop() {
|
|||
}
|
||||
"#),
|
||||
@r###"
|
||||
|
||||
[144; 146) '{}': ()
|
||||
[169; 198) '{ ...t(); }': ()
|
||||
[175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet<T, H>
|
||||
|
@ -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<u32>(T) -> S<T>
|
||||
|
@ -3130,7 +3090,6 @@ fn test<T: Iterable<Item=u32>>() {
|
|||
}
|
||||
"#),
|
||||
@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
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
]
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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()",
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
]
|
||||
"###);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
]
|
||||
"###);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
]
|
||||
"###);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}",
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
]
|
||||
"###);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) -> T",
|
||||
),
|
||||
deprecated: false,
|
||||
},
|
||||
StructureNode {
|
||||
parent: Some(
|
||||
2,
|
||||
),
|
||||
label: "bar3",
|
||||
navigation_range: [89; 93),
|
||||
node_range: [86; 156),
|
||||
kind: FN_DEF,
|
||||
detail: Some(
|
||||
"fn<A, B>(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) -> T",
|
||||
),
|
||||
deprecated: false,
|
||||
},
|
||||
StructureNode {
|
||||
parent: Some(
|
||||
2,
|
||||
),
|
||||
label: "bar3",
|
||||
navigation_range: [89; 93),
|
||||
node_range: [86; 156),
|
||||
kind: FN_DEF,
|
||||
detail: Some(
|
||||
"fn<A, B>(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,
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Test>",
|
||||
},
|
||||
InlayHint {
|
||||
range: [334; 338),
|
||||
kind: TypeHint,
|
||||
label: "&Test",
|
||||
},
|
||||
InlayHint {
|
||||
range: [389; 390),
|
||||
kind: TypeHint,
|
||||
label: "&CustomOption<u32>",
|
||||
},
|
||||
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<Test>",
|
||||
},
|
||||
InlayHint {
|
||||
range: [334; 338),
|
||||
kind: TypeHint,
|
||||
label: "&Test",
|
||||
},
|
||||
InlayHint {
|
||||
range: [389; 390),
|
||||
kind: TypeHint,
|
||||
label: "&CustomOption<u32>",
|
||||
},
|
||||
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<Test>",
|
||||
⋮ },
|
||||
⋮ InlayHint {
|
||||
⋮ range: [343; 347),
|
||||
⋮ kind: TypeHint,
|
||||
⋮ label: "&Test",
|
||||
⋮ },
|
||||
⋮ InlayHint {
|
||||
⋮ range: [401; 402),
|
||||
⋮ kind: TypeHint,
|
||||
⋮ label: "&CustomOption<u32>",
|
||||
⋮ },
|
||||
⋮ InlayHint {
|
||||
⋮ range: [404; 405),
|
||||
⋮ kind: TypeHint,
|
||||
⋮ label: "&u8",
|
||||
⋮ },
|
||||
⋮ InlayHint {
|
||||
⋮ range: [549; 550),
|
||||
⋮ kind: TypeHint,
|
||||
⋮ label: "&u32",
|
||||
⋮ },
|
||||
⋮]
|
||||
[
|
||||
InlayHint {
|
||||
range: [166; 170),
|
||||
kind: TypeHint,
|
||||
label: "CustomOption<Test>",
|
||||
},
|
||||
InlayHint {
|
||||
range: [343; 347),
|
||||
kind: TypeHint,
|
||||
label: "&Test",
|
||||
},
|
||||
InlayHint {
|
||||
range: [401; 402),
|
||||
kind: TypeHint,
|
||||
label: "&CustomOption<u32>",
|
||||
},
|
||||
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<u32>",
|
||||
},
|
||||
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<u32>",
|
||||
},
|
||||
InlayHint {
|
||||
range: [361; 362),
|
||||
kind: TypeHint,
|
||||
label: "u8",
|
||||
},
|
||||
InlayHint {
|
||||
range: [484; 485),
|
||||
kind: TypeHint,
|
||||
label: "u32",
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue