More consistent usage of fixtures

This commit is contained in:
Aleksey Kladov 2020-06-24 11:29:43 +02:00
parent e9cb818c26
commit c6795fb83a
16 changed files with 1068 additions and 1059 deletions

View file

@ -333,69 +333,69 @@ mod tests {
[
CompletionItem {
label: "Clone",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "Clone",
kind: Attribute,
},
CompletionItem {
label: "Copy, Clone",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "Copy, Clone",
kind: Attribute,
},
CompletionItem {
label: "Debug",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "Debug",
kind: Attribute,
},
CompletionItem {
label: "Default",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "Default",
kind: Attribute,
},
CompletionItem {
label: "Eq, PartialEq",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "Eq, PartialEq",
kind: Attribute,
},
CompletionItem {
label: "Hash",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "Hash",
kind: Attribute,
},
CompletionItem {
label: "Ord, PartialOrd, Eq, PartialEq",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "Ord, PartialOrd, Eq, PartialEq",
kind: Attribute,
},
CompletionItem {
label: "PartialEq",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "PartialEq",
kind: Attribute,
},
CompletionItem {
label: "PartialOrd, PartialEq",
source_range: 30..30,
delete: 30..30,
source_range: 9..9,
delete: 9..9,
insert: "PartialOrd, PartialEq",
kind: Attribute,
},
]
"###
"###
);
}
@ -425,62 +425,62 @@ mod tests {
[
CompletionItem {
label: "Clone",
source_range: 59..59,
delete: 59..59,
source_range: 38..38,
delete: 38..38,
insert: "Clone",
kind: Attribute,
},
CompletionItem {
label: "Copy, Clone",
source_range: 59..59,
delete: 59..59,
source_range: 38..38,
delete: 38..38,
insert: "Copy, Clone",
kind: Attribute,
},
CompletionItem {
label: "Debug",
source_range: 59..59,
delete: 59..59,
source_range: 38..38,
delete: 38..38,
insert: "Debug",
kind: Attribute,
},
CompletionItem {
label: "Default",
source_range: 59..59,
delete: 59..59,
source_range: 38..38,
delete: 38..38,
insert: "Default",
kind: Attribute,
},
CompletionItem {
label: "Eq",
source_range: 59..59,
delete: 59..59,
source_range: 38..38,
delete: 38..38,
insert: "Eq",
kind: Attribute,
},
CompletionItem {
label: "Hash",
source_range: 59..59,
delete: 59..59,
source_range: 38..38,
delete: 38..38,
insert: "Hash",
kind: Attribute,
},
CompletionItem {
label: "Ord, PartialOrd, Eq",
source_range: 59..59,
delete: 59..59,
source_range: 38..38,
delete: 38..38,
insert: "Ord, PartialOrd, Eq",
kind: Attribute,
},
CompletionItem {
label: "PartialOrd",
source_range: 59..59,
delete: 59..59,
source_range: 38..38,
delete: 38..38,
insert: "PartialOrd",
kind: Attribute,
},
]
"###
"###
);
}
@ -496,207 +496,207 @@ mod tests {
[
CompletionItem {
label: "allow(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "allow(${0:lint})",
kind: Attribute,
lookup: "allow",
},
CompletionItem {
label: "cfg(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "cfg(${0:predicate})",
kind: Attribute,
lookup: "cfg",
},
CompletionItem {
label: "cfg_attr(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "cfg_attr(${1:predicate}, ${0:attr})",
kind: Attribute,
lookup: "cfg_attr",
},
CompletionItem {
label: "deny(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "deny(${0:lint})",
kind: Attribute,
lookup: "deny",
},
CompletionItem {
label: "deprecated = \"\"",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "deprecated = \"${0:reason}\"",
kind: Attribute,
lookup: "deprecated",
},
CompletionItem {
label: "derive(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "derive(${0:Debug})",
kind: Attribute,
lookup: "derive",
},
CompletionItem {
label: "doc = \"\"",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "doc = \"${0:docs}\"",
kind: Attribute,
lookup: "doc",
},
CompletionItem {
label: "forbid(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "forbid(${0:lint})",
kind: Attribute,
lookup: "forbid",
},
CompletionItem {
label: "ignore(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "ignore(${0:lint})",
kind: Attribute,
lookup: "ignore",
},
CompletionItem {
label: "inline(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "inline(${0:lint})",
kind: Attribute,
lookup: "inline",
},
CompletionItem {
label: "link",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "link",
kind: Attribute,
},
CompletionItem {
label: "link_name = \"\"",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "link_name = \"${0:symbol_name}\"",
kind: Attribute,
lookup: "link_name",
},
CompletionItem {
label: "macro_export",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "macro_export",
kind: Attribute,
},
CompletionItem {
label: "macro_use",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "macro_use",
kind: Attribute,
},
CompletionItem {
label: "must_use = \"\"",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "must_use = \"${0:reason}\"",
kind: Attribute,
lookup: "must_use",
},
CompletionItem {
label: "no_mangle",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "no_mangle",
kind: Attribute,
},
CompletionItem {
label: "non_exhaustive",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "non_exhaustive",
kind: Attribute,
},
CompletionItem {
label: "path = \"\"",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "path =\"${0:path}\"",
kind: Attribute,
lookup: "path",
},
CompletionItem {
label: "proc_macro",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "proc_macro",
kind: Attribute,
},
CompletionItem {
label: "proc_macro_attribute",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "proc_macro_attribute",
kind: Attribute,
},
CompletionItem {
label: "proc_macro_derive(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "proc_macro_derive(${0:Trait})",
kind: Attribute,
lookup: "proc_macro_derive",
},
CompletionItem {
label: "repr(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "repr(${0:C})",
kind: Attribute,
lookup: "repr",
},
CompletionItem {
label: "should_panic(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "should_panic(expected = \"${0:reason}\")",
kind: Attribute,
lookup: "should_panic",
},
CompletionItem {
label: "target_feature = \"\"",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "target_feature = \"${0:feature}\"",
kind: Attribute,
lookup: "target_feature",
},
CompletionItem {
label: "test",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "test",
kind: Attribute,
},
CompletionItem {
label: "used",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "used",
kind: Attribute,
},
CompletionItem {
label: "warn(…)",
source_range: 19..19,
delete: 19..19,
source_range: 2..2,
delete: 2..2,
insert: "warn(${0:lint})",
kind: Attribute,
lookup: "warn",
@ -732,252 +732,252 @@ mod tests {
[
CompletionItem {
label: "allow(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "allow(${0:lint})",
kind: Attribute,
lookup: "allow",
},
CompletionItem {
label: "cfg(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "cfg(${0:predicate})",
kind: Attribute,
lookup: "cfg",
},
CompletionItem {
label: "cfg_attr(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "cfg_attr(${1:predicate}, ${0:attr})",
kind: Attribute,
lookup: "cfg_attr",
},
CompletionItem {
label: "deny(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "deny(${0:lint})",
kind: Attribute,
lookup: "deny",
},
CompletionItem {
label: "deprecated = \"\"",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "deprecated = \"${0:reason}\"",
kind: Attribute,
lookup: "deprecated",
},
CompletionItem {
label: "derive(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "derive(${0:Debug})",
kind: Attribute,
lookup: "derive",
},
CompletionItem {
label: "doc = \"\"",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "doc = \"${0:docs}\"",
kind: Attribute,
lookup: "doc",
},
CompletionItem {
label: "feature(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "feature(${0:flag})",
kind: Attribute,
lookup: "feature",
},
CompletionItem {
label: "forbid(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "forbid(${0:lint})",
kind: Attribute,
lookup: "forbid",
},
CompletionItem {
label: "global_allocator",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "global_allocator",
kind: Attribute,
},
CompletionItem {
label: "ignore(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "ignore(${0:lint})",
kind: Attribute,
lookup: "ignore",
},
CompletionItem {
label: "inline(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "inline(${0:lint})",
kind: Attribute,
lookup: "inline",
},
CompletionItem {
label: "link",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "link",
kind: Attribute,
},
CompletionItem {
label: "link_name = \"\"",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "link_name = \"${0:symbol_name}\"",
kind: Attribute,
lookup: "link_name",
},
CompletionItem {
label: "macro_export",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "macro_export",
kind: Attribute,
},
CompletionItem {
label: "macro_use",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "macro_use",
kind: Attribute,
},
CompletionItem {
label: "must_use = \"\"",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "must_use = \"${0:reason}\"",
kind: Attribute,
lookup: "must_use",
},
CompletionItem {
label: "no_mangle",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "no_mangle",
kind: Attribute,
},
CompletionItem {
label: "no_std",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "no_std",
kind: Attribute,
},
CompletionItem {
label: "non_exhaustive",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "non_exhaustive",
kind: Attribute,
},
CompletionItem {
label: "panic_handler",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "panic_handler",
kind: Attribute,
},
CompletionItem {
label: "path = \"\"",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "path =\"${0:path}\"",
kind: Attribute,
lookup: "path",
},
CompletionItem {
label: "proc_macro",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "proc_macro",
kind: Attribute,
},
CompletionItem {
label: "proc_macro_attribute",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "proc_macro_attribute",
kind: Attribute,
},
CompletionItem {
label: "proc_macro_derive(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "proc_macro_derive(${0:Trait})",
kind: Attribute,
lookup: "proc_macro_derive",
},
CompletionItem {
label: "recursion_limit = …",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "recursion_limit = ${0:128}",
kind: Attribute,
lookup: "recursion_limit",
},
CompletionItem {
label: "repr(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "repr(${0:C})",
kind: Attribute,
lookup: "repr",
},
CompletionItem {
label: "should_panic(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "should_panic(expected = \"${0:reason}\")",
kind: Attribute,
lookup: "should_panic",
},
CompletionItem {
label: "target_feature = \"\"",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "target_feature = \"${0:feature}\"",
kind: Attribute,
lookup: "target_feature",
},
CompletionItem {
label: "test",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "test",
kind: Attribute,
},
CompletionItem {
label: "used",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "used",
kind: Attribute,
},
CompletionItem {
label: "warn(…)",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "warn(${0:lint})",
kind: Attribute,
lookup: "warn",
},
CompletionItem {
label: "windows_subsystem = \"\"",
source_range: 20..20,
delete: 20..20,
source_range: 3..3,
delete: 3..3,
insert: "windows_subsystem = \"${0:subsystem}\"",
kind: Attribute,
lookup: "windows_subsystem",

View file

@ -94,8 +94,8 @@ mod tests {
[
CompletionItem {
label: "the_field",
source_range: 94..94,
delete: 94..94,
source_range: 45..45,
delete: 45..45,
insert: "the_field",
kind: Field,
detail: "u32",
@ -125,8 +125,8 @@ mod tests {
[
CompletionItem {
label: "foo()",
source_range: 187..187,
delete: 187..187,
source_range: 102..102,
delete: 102..102,
insert: "foo()$0",
kind: Method,
lookup: "foo",
@ -134,8 +134,8 @@ mod tests {
},
CompletionItem {
label: "the_field",
source_range: 187..187,
delete: 187..187,
source_range: 102..102,
delete: 102..102,
insert: "the_field",
kind: Field,
detail: "(u32,)",
@ -165,8 +165,8 @@ mod tests {
[
CompletionItem {
label: "foo()",
source_range: 126..126,
delete: 126..126,
source_range: 77..77,
delete: 77..77,
insert: "foo()$0",
kind: Method,
lookup: "foo",
@ -174,8 +174,8 @@ mod tests {
},
CompletionItem {
label: "the_field",
source_range: 126..126,
delete: 126..126,
source_range: 77..77,
delete: 77..77,
insert: "the_field",
kind: Field,
detail: "(u32, i32)",
@ -222,24 +222,24 @@ mod tests {
[
CompletionItem {
label: "crate_field",
source_range: 313..313,
delete: 313..313,
source_range: 192..192,
delete: 192..192,
insert: "crate_field",
kind: Field,
detail: "u32",
},
CompletionItem {
label: "pub_field",
source_range: 313..313,
delete: 313..313,
source_range: 192..192,
delete: 192..192,
insert: "pub_field",
kind: Field,
detail: "u32",
},
CompletionItem {
label: "super_field",
source_range: 313..313,
delete: 313..313,
source_range: 192..192,
delete: 192..192,
insert: "super_field",
kind: Field,
detail: "u32",
@ -268,16 +268,16 @@ mod tests {
[
CompletionItem {
label: "field",
source_range: 140..140,
delete: 140..140,
source_range: 67..67,
delete: 67..67,
insert: "field",
kind: Field,
detail: "u8",
},
CompletionItem {
label: "other",
source_range: 140..140,
delete: 140..140,
source_range: 67..67,
delete: 67..67,
insert: "other",
kind: Field,
detail: "u16",
@ -305,8 +305,8 @@ mod tests {
[
CompletionItem {
label: "the_method()",
source_range: 144..144,
delete: 144..144,
source_range: 71..71,
delete: 71..71,
insert: "the_method()$0",
kind: Method,
lookup: "the_method",
@ -338,8 +338,8 @@ mod tests {
[
CompletionItem {
label: "the_method()",
source_range: 243..243,
delete: 243..243,
source_range: 134..134,
delete: 134..134,
insert: "the_method()$0",
kind: Method,
lookup: "the_method",
@ -371,8 +371,8 @@ mod tests {
[
CompletionItem {
label: "the_method()",
source_range: 256..256,
delete: 256..256,
source_range: 147..147,
delete: 147..147,
insert: "the_method()$0",
kind: Method,
lookup: "the_method",
@ -400,8 +400,8 @@ mod tests {
[
CompletionItem {
label: "the_method()",
source_range: 151..151,
delete: 151..151,
source_range: 90..90,
delete: 90..90,
insert: "the_method()$0",
kind: Method,
lookup: "the_method",
@ -429,8 +429,8 @@ mod tests {
[
CompletionItem {
label: "the_method()",
source_range: 155..155,
delete: 155..155,
source_range: 94..94,
delete: 94..94,
insert: "the_method()$0",
kind: Method,
lookup: "the_method",
@ -461,8 +461,8 @@ mod tests {
[
CompletionItem {
label: "the_method()",
source_range: 219..219,
delete: 219..219,
source_range: 122..122,
delete: 122..122,
insert: "the_method()$0",
kind: Method,
lookup: "the_method",
@ -513,8 +513,8 @@ mod tests {
[
CompletionItem {
label: "the_method()",
source_range: 249..249,
delete: 249..249,
source_range: 128..128,
delete: 128..128,
insert: "the_method()$0",
kind: Method,
lookup: "the_method",
@ -540,16 +540,16 @@ mod tests {
[
CompletionItem {
label: "0",
source_range: 75..75,
delete: 75..75,
source_range: 38..38,
delete: 38..38,
insert: "0",
kind: Field,
detail: "i32",
},
CompletionItem {
label: "1",
source_range: 75..75,
delete: 75..75,
source_range: 38..38,
delete: 38..38,
insert: "1",
kind: Field,
detail: "f64",
@ -583,8 +583,8 @@ mod tests {
[
CompletionItem {
label: "blah()",
source_range: 299..300,
delete: 299..300,
source_range: 190..191,
delete: 190..191,
insert: "blah()$0",
kind: Method,
lookup: "blah",
@ -610,8 +610,8 @@ mod tests {
[
CompletionItem {
label: "the_field",
source_range: 106..106,
delete: 106..106,
source_range: 69..69,
delete: 69..69,
insert: "the_field",
kind: Field,
detail: "u32",
@ -676,15 +676,15 @@ mod tests {
[
CompletionItem {
label: "A",
source_range: 217..217,
delete: 217..217,
source_range: 120..120,
delete: 120..120,
insert: "A",
kind: Const,
},
CompletionItem {
label: "b",
source_range: 217..217,
delete: 217..217,
source_range: 120..120,
delete: 120..120,
insert: "b",
kind: Module,
},
@ -709,8 +709,8 @@ mod tests {
[
CompletionItem {
label: "the_field",
source_range: 156..157,
delete: 156..157,
source_range: 91..92,
delete: 91..92,
insert: "the_field",
kind: Field,
detail: "u32",
@ -736,8 +736,8 @@ mod tests {
[
CompletionItem {
label: "the_field",
source_range: 156..157,
delete: 156..157,
source_range: 91..92,
delete: 91..92,
insert: "the_field",
kind: Field,
detail: "u32",
@ -764,8 +764,8 @@ mod tests {
[
CompletionItem {
label: "the_field",
source_range: 156..156,
delete: 156..156,
source_range: 91..91,
delete: 91..91,
insert: "the_field",
kind: Field,
detail: "u32",
@ -791,8 +791,8 @@ mod tests {
[
CompletionItem {
label: "the_field",
source_range: 162..163,
delete: 162..163,
source_range: 97..98,
delete: 97..98,
insert: "the_field",
kind: Field,
detail: "u32",
@ -828,8 +828,8 @@ mod tests {
[
CompletionItem {
label: "the_field",
source_range: 552..552,
delete: 552..552,
source_range: 327..327,
delete: 327..327,
insert: "the_field",
kind: Field,
detail: "u32",
@ -858,8 +858,8 @@ mod tests {
[
CompletionItem {
label: "the_method()",
source_range: 201..201,
delete: 201..201,
source_range: 116..116,
delete: 116..116,
insert: "the_method()$0",
kind: Method,
lookup: "the_method",

View file

@ -75,8 +75,8 @@ mod tests {
[
CompletionItem {
label: "file_id: FileId",
source_range: 110..114,
delete: 110..114,
source_range: 61..65,
delete: 61..65,
insert: "file_id: FileId",
lookup: "file_id",
},
@ -99,8 +99,8 @@ mod tests {
[
CompletionItem {
label: "file_id: FileId",
source_range: 110..114,
delete: 110..114,
source_range: 61..65,
delete: 61..65,
insert: "file_id: FileId",
lookup: "file_id",
},
@ -126,8 +126,8 @@ mod tests {
[
CompletionItem {
label: "file_id: FileId",
source_range: 289..293,
delete: 289..293,
source_range: 208..212,
delete: 208..212,
insert: "file_id: FileId",
lookup: "file_id",
},

View file

@ -63,37 +63,37 @@ mod tests {
[
CompletionItem {
label: "Bar",
source_range: 246..246,
delete: 246..246,
source_range: 137..137,
delete: 137..137,
insert: "Bar",
kind: Struct,
},
CompletionItem {
label: "E",
source_range: 246..246,
delete: 246..246,
source_range: 137..137,
delete: 137..137,
insert: "E",
kind: Enum,
},
CompletionItem {
label: "X",
source_range: 246..246,
delete: 246..246,
source_range: 137..137,
delete: 137..137,
insert: "X",
kind: EnumVariant,
detail: "()",
},
CompletionItem {
label: "Z",
source_range: 246..246,
delete: 246..246,
source_range: 137..137,
delete: 137..137,
insert: "Z",
kind: Const,
},
CompletionItem {
label: "m",
source_range: 246..246,
delete: 246..246,
source_range: 137..137,
delete: 137..137,
insert: "m",
kind: Module,
},
@ -119,15 +119,15 @@ mod tests {
[
CompletionItem {
label: "E",
source_range: 151..151,
delete: 151..151,
source_range: 90..90,
delete: 90..90,
insert: "E",
kind: Enum,
},
CompletionItem {
label: "m!(…)",
source_range: 151..151,
delete: 151..151,
source_range: 90..90,
delete: 90..90,
insert: "m!($0)",
kind: Macro,
detail: "macro_rules! m",

View file

@ -260,64 +260,64 @@ mod tests {
[
CompletionItem {
label: "box",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "Box::new(bar)",
detail: "Box::new(expr)",
},
CompletionItem {
label: "call",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "${1}(bar)",
detail: "function(expr)",
},
CompletionItem {
label: "dbg",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "dbg!(bar)",
detail: "dbg!(expr)",
},
CompletionItem {
label: "if",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "if bar {\n $0\n}",
detail: "if expr {}",
},
CompletionItem {
label: "match",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "match bar {\n ${1:_} => {$0\\},\n}",
detail: "match expr {}",
},
CompletionItem {
label: "not",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "!bar",
detail: "!expr",
},
CompletionItem {
label: "ref",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "&bar",
detail: "&expr",
},
CompletionItem {
label: "refm",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "&mut bar",
detail: "&mut expr",
},
CompletionItem {
label: "while",
source_range: 89..89,
delete: 85..89,
source_range: 40..40,
delete: 36..40,
insert: "while bar {\n $0\n}",
detail: "while expr {}",
},
@ -346,64 +346,64 @@ mod tests {
[
CompletionItem {
label: "box",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "Box::new(bar)",
detail: "Box::new(expr)",
},
CompletionItem {
label: "call",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "${1}(bar)",
detail: "function(expr)",
},
CompletionItem {
label: "dbg",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "dbg!(bar)",
detail: "dbg!(expr)",
},
CompletionItem {
label: "ifl",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "if let Some($1) = bar {\n $0\n}",
detail: "if let Some {}",
},
CompletionItem {
label: "match",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "match bar {\n Some(${1:_}) => {$2\\},\n None => {$0\\},\n}",
detail: "match expr {}",
},
CompletionItem {
label: "not",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "!bar",
detail: "!expr",
},
CompletionItem {
label: "ref",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "&bar",
detail: "&expr",
},
CompletionItem {
label: "refm",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "&mut bar",
detail: "&mut expr",
},
CompletionItem {
label: "while",
source_range: 210..210,
delete: 206..210,
source_range: 97..97,
delete: 93..97,
insert: "while let Some($1) = bar {\n $0\n}",
detail: "while let Some {}",
},
@ -432,64 +432,64 @@ mod tests {
[
CompletionItem {
label: "box",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "Box::new(bar)",
detail: "Box::new(expr)",
},
CompletionItem {
label: "call",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "${1}(bar)",
detail: "function(expr)",
},
CompletionItem {
label: "dbg",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "dbg!(bar)",
detail: "dbg!(expr)",
},
CompletionItem {
label: "ifl",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "if let Ok($1) = bar {\n $0\n}",
detail: "if let Ok {}",
},
CompletionItem {
label: "match",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "match bar {\n Ok(${1:_}) => {$2\\},\n Err(${3:_}) => {$0\\},\n}",
detail: "match expr {}",
},
CompletionItem {
label: "not",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "!bar",
detail: "!expr",
},
CompletionItem {
label: "ref",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "&bar",
detail: "&expr",
},
CompletionItem {
label: "refm",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "&mut bar",
detail: "&mut expr",
},
CompletionItem {
label: "while",
source_range: 211..211,
delete: 207..211,
source_range: 98..98,
delete: 94..98,
insert: "while let Ok($1) = bar {\n $0\n}",
detail: "while let Ok {}",
},
@ -513,50 +513,50 @@ mod tests {
[
CompletionItem {
label: "box",
source_range: 91..91,
delete: 87..91,
source_range: 42..42,
delete: 38..42,
insert: "Box::new(bar)",
detail: "Box::new(expr)",
},
CompletionItem {
label: "call",
source_range: 91..91,
delete: 87..91,
source_range: 42..42,
delete: 38..42,
insert: "${1}(bar)",
detail: "function(expr)",
},
CompletionItem {
label: "dbg",
source_range: 91..91,
delete: 87..91,
source_range: 42..42,
delete: 38..42,
insert: "dbg!(bar)",
detail: "dbg!(expr)",
},
CompletionItem {
label: "match",
source_range: 91..91,
delete: 87..91,
source_range: 42..42,
delete: 38..42,
insert: "match bar {\n ${1:_} => {$0\\},\n}",
detail: "match expr {}",
},
CompletionItem {
label: "not",
source_range: 91..91,
delete: 87..91,
source_range: 42..42,
delete: 38..42,
insert: "!bar",
detail: "!expr",
},
CompletionItem {
label: "ref",
source_range: 91..91,
delete: 87..91,
source_range: 42..42,
delete: 38..42,
insert: "&bar",
detail: "&expr",
},
CompletionItem {
label: "refm",
source_range: 91..91,
delete: 87..91,
source_range: 42..42,
delete: 38..42,
insert: "&mut bar",
detail: "&mut expr",
},
@ -579,50 +579,50 @@ mod tests {
[
CompletionItem {
label: "box",
source_range: 52..52,
delete: 49..52,
source_range: 19..19,
delete: 16..19,
insert: "Box::new(42)",
detail: "Box::new(expr)",
},
CompletionItem {
label: "call",
source_range: 52..52,
delete: 49..52,
source_range: 19..19,
delete: 16..19,
insert: "${1}(42)",
detail: "function(expr)",
},
CompletionItem {
label: "dbg",
source_range: 52..52,
delete: 49..52,
source_range: 19..19,
delete: 16..19,
insert: "dbg!(42)",
detail: "dbg!(expr)",
},
CompletionItem {
label: "match",
source_range: 52..52,
delete: 49..52,
source_range: 19..19,
delete: 16..19,
insert: "match 42 {\n ${1:_} => {$0\\},\n}",
detail: "match expr {}",
},
CompletionItem {
label: "not",
source_range: 52..52,
delete: 49..52,
source_range: 19..19,
delete: 16..19,
insert: "!42",
detail: "!expr",
},
CompletionItem {
label: "ref",
source_range: 52..52,
delete: 49..52,
source_range: 19..19,
delete: 16..19,
insert: "&42",
detail: "&expr",
},
CompletionItem {
label: "refm",
source_range: 52..52,
delete: 49..52,
source_range: 19..19,
delete: 16..19,
insert: "&mut 42",
detail: "&mut expr",
},
@ -647,50 +647,50 @@ mod tests {
[
CompletionItem {
label: "box",
source_range: 149..150,
delete: 145..150,
source_range: 84..85,
delete: 80..85,
insert: "Box::new(bar)",
detail: "Box::new(expr)",
},
CompletionItem {
label: "call",
source_range: 149..150,
delete: 145..150,
source_range: 84..85,
delete: 80..85,
insert: "${1}(bar)",
detail: "function(expr)",
},
CompletionItem {
label: "dbg",
source_range: 149..150,
delete: 145..150,
source_range: 84..85,
delete: 80..85,
insert: "dbg!(bar)",
detail: "dbg!(expr)",
},
CompletionItem {
label: "match",
source_range: 149..150,
delete: 145..150,
source_range: 84..85,
delete: 80..85,
insert: "match bar {\n ${1:_} => {$0\\},\n}",
detail: "match expr {}",
},
CompletionItem {
label: "not",
source_range: 149..150,
delete: 145..150,
source_range: 84..85,
delete: 80..85,
insert: "!bar",
detail: "!expr",
},
CompletionItem {
label: "ref",
source_range: 149..150,
delete: 145..150,
source_range: 84..85,
delete: 80..85,
insert: "&bar",
detail: "&expr",
},
CompletionItem {
label: "refm",
source_range: 149..150,
delete: 145..150,
source_range: 84..85,
delete: 80..85,
insert: "&mut bar",
detail: "&mut expr",
},
@ -713,50 +713,50 @@ mod tests {
[
CompletionItem {
label: "box",
source_range: 56..56,
delete: 49..56,
source_range: 23..23,
delete: 16..23,
insert: "Box::new(&&&&42)",
detail: "Box::new(expr)",
},
CompletionItem {
label: "call",
source_range: 56..56,
delete: 49..56,
source_range: 23..23,
delete: 16..23,
insert: "${1}(&&&&42)",
detail: "function(expr)",
},
CompletionItem {
label: "dbg",
source_range: 56..56,
delete: 49..56,
source_range: 23..23,
delete: 16..23,
insert: "dbg!(&&&&42)",
detail: "dbg!(expr)",
},
CompletionItem {
label: "match",
source_range: 56..56,
delete: 49..56,
source_range: 23..23,
delete: 16..23,
insert: "match &&&&42 {\n ${1:_} => {$0\\},\n}",
detail: "match expr {}",
},
CompletionItem {
label: "not",
source_range: 56..56,
delete: 53..56,
source_range: 23..23,
delete: 20..23,
insert: "!42",
detail: "!expr",
},
CompletionItem {
label: "ref",
source_range: 56..56,
delete: 53..56,
source_range: 23..23,
delete: 20..23,
insert: "&42",
detail: "&expr",
},
CompletionItem {
label: "refm",
source_range: 56..56,
delete: 53..56,
source_range: 23..23,
delete: 20..23,
insert: "&mut 42",
detail: "&mut expr",
},

View file

@ -212,8 +212,8 @@ mod tests {
[
CompletionItem {
label: "my",
source_range: 27..29,
delete: 27..29,
source_range: 10..12,
delete: 10..12,
insert: "my",
kind: Module,
documentation: Documentation(
@ -243,8 +243,8 @@ mod tests {
[
CompletionItem {
label: "Bar",
source_range: 31..31,
delete: 31..31,
source_range: 14..14,
delete: 14..14,
insert: "Bar",
kind: Struct,
},
@ -271,15 +271,15 @@ mod tests {
[
CompletionItem {
label: "Foo",
source_range: 31..31,
delete: 31..31,
source_range: 14..14,
delete: 14..14,
insert: "Foo",
kind: Struct,
},
CompletionItem {
label: "PublicBar",
source_range: 31..31,
delete: 31..31,
source_range: 14..14,
delete: 14..14,
insert: "PublicBar",
kind: Struct,
},
@ -304,8 +304,8 @@ mod tests {
[
CompletionItem {
label: "Bar",
source_range: 30..30,
delete: 30..30,
source_range: 13..13,
delete: 13..13,
insert: "Bar",
kind: Struct,
},
@ -1145,8 +1145,8 @@ mod tests {
[
CompletionItem {
label: "bar()",
source_range: 185..185,
delete: 185..185,
source_range: 88..88,
delete: 88..88,
insert: "bar()$0",
kind: Function,
lookup: "bar",
@ -1154,8 +1154,8 @@ mod tests {
},
CompletionItem {
label: "foo()",
source_range: 185..185,
delete: 185..185,
source_range: 88..88,
delete: 88..88,
insert: "foo()$0",
kind: Function,
lookup: "foo",
@ -1185,16 +1185,16 @@ mod tests {
[
CompletionItem {
label: "foo!(…)",
source_range: 179..179,
delete: 179..179,
source_range: 82..82,
delete: 82..82,
insert: "foo!($0)",
kind: Macro,
detail: "#[macro_export]\nmacro_rules! foo",
},
CompletionItem {
label: "main()",
source_range: 179..179,
delete: 179..179,
source_range: 82..82,
delete: 82..82,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -1230,22 +1230,22 @@ mod tests {
[
CompletionItem {
label: "RIGHT_CONST",
source_range: 57..57,
delete: 57..57,
source_range: 24..24,
delete: 24..24,
insert: "RIGHT_CONST",
kind: Const,
},
CompletionItem {
label: "RightType",
source_range: 57..57,
delete: 57..57,
source_range: 24..24,
delete: 24..24,
insert: "RightType",
kind: Struct,
},
CompletionItem {
label: "right_fn()",
source_range: 57..57,
delete: 57..57,
source_range: 24..24,
delete: 24..24,
insert: "right_fn()$0",
kind: Function,
lookup: "right_fn",
@ -1269,8 +1269,8 @@ mod tests {
[
CompletionItem {
label: "foo()",
source_range: 93..94,
delete: 93..94,
source_range: 60..61,
delete: 60..61,
insert: "foo()$0",
kind: Function,
lookup: "foo",
@ -1278,8 +1278,8 @@ mod tests {
},
CompletionItem {
label: "main()",
source_range: 93..94,
delete: 93..94,
source_range: 60..61,
delete: 60..61,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -1308,15 +1308,15 @@ mod tests {
[
CompletionItem {
label: "z",
source_range: 57..57,
delete: 57..57,
source_range: 24..24,
delete: 24..24,
insert: "z",
kind: Module,
},
CompletionItem {
label: "z()",
source_range: 57..57,
delete: 57..57,
source_range: 24..24,
delete: 24..24,
insert: "z()$0",
kind: Function,
lookup: "z",
@ -1347,8 +1347,8 @@ mod tests {
[
CompletionItem {
label: "new()",
source_range: 292..292,
delete: 292..292,
source_range: 179..179,
delete: 179..179,
insert: "new()$0",
kind: Function,
lookup: "new",

View file

@ -41,17 +41,17 @@ 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: 68..69,
delete: 68..69,
insert: "foo",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -70,25 +70,25 @@ 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: 88..88,
delete: 88..88,
insert: "bar",
kind: Field,
detail: "()",
},
CompletionItem {
label: "foo",
source_range: 88..88,
delete: 88..88,
insert: "foo",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -106,17 +106,17 @@ mod tests {
",
);
assert_debug_snapshot!(completions, @r###"
[
CompletionItem {
label: "foo",
source_range: 171..172,
delete: 171..172,
insert: "foo",
kind: Field,
detail: "u32",
},
]
"###);
[
CompletionItem {
label: "foo",
source_range: 110..111,
delete: 110..111,
insert: "foo",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -142,25 +142,25 @@ mod tests {
",
);
assert_debug_snapshot!(completions, @r###"
[
CompletionItem {
label: "bar",
source_range: 372..372,
delete: 372..372,
insert: "bar",
kind: Field,
detail: "u32",
},
CompletionItem {
label: "baz",
source_range: 372..372,
delete: 372..372,
insert: "baz",
kind: Field,
detail: "u32",
},
]
"###);
[
CompletionItem {
label: "bar",
source_range: 203..203,
delete: 203..203,
insert: "bar",
kind: Field,
detail: "u32",
},
CompletionItem {
label: "baz",
source_range: 203..203,
delete: 203..203,
insert: "baz",
kind: Field,
detail: "u32",
},
]
"###);
}
}
@ -187,18 +187,18 @@ 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: 69..72,
delete: 69..72,
insert: "the_field",
kind: Field,
detail: "u32",
deprecated: true,
},
]
"###);
}
#[test]
@ -212,17 +212,17 @@ 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: 46..49,
delete: 46..49,
insert: "the_field",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -238,17 +238,17 @@ 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: 58..58,
delete: 58..58,
insert: "a",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -264,17 +264,17 @@ 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: 70..70,
delete: 70..70,
insert: "b",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -289,17 +289,17 @@ 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: 56..56,
delete: 56..56,
insert: "a",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -314,17 +314,17 @@ mod tests {
",
);
assert_debug_snapshot!(completions, @r###"
[
CompletionItem {
label: "the_field",
source_range: 137..140,
delete: 137..140,
insert: "the_field",
kind: Field,
detail: "u32",
},
]
"###);
[
CompletionItem {
label: "the_field",
source_range: 88..91,
delete: 88..91,
insert: "the_field",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -349,25 +349,25 @@ mod tests {
",
);
assert_debug_snapshot!(completions, @r###"
[
CompletionItem {
label: "bar",
source_range: 302..302,
delete: 302..302,
insert: "bar",
kind: Field,
detail: "u32",
},
CompletionItem {
label: "baz",
source_range: 302..302,
delete: 302..302,
insert: "baz",
kind: Field,
detail: "u32",
},
]
"###);
[
CompletionItem {
label: "bar",
source_range: 157..157,
delete: 157..157,
insert: "bar",
kind: Field,
detail: "u32",
},
CompletionItem {
label: "baz",
source_range: 157..157,
delete: 157..157,
insert: "baz",
kind: Field,
detail: "u32",
},
]
"###);
}
#[test]
@ -390,17 +390,17 @@ mod tests {
",
);
assert_debug_snapshot!(completions, @r###"
[
CompletionItem {
label: "foo2",
source_range: 221..221,
delete: 221..221,
insert: "foo2",
kind: Field,
detail: "u32",
},
]
"###);
[
CompletionItem {
label: "foo2",
source_range: 112..112,
delete: 112..112,
insert: "foo2",
kind: Field,
detail: "u32",
},
]
"###);
}
}
}

View file

@ -129,31 +129,31 @@ mod tests {
[
CompletionItem {
label: "Test function",
source_range: 78..78,
delete: 78..78,
source_range: 29..29,
delete: 29..29,
insert: "#[test]\nfn ${1:feature}() {\n $0\n}",
kind: Snippet,
lookup: "tfn",
},
CompletionItem {
label: "Test module",
source_range: 78..78,
delete: 78..78,
source_range: 29..29,
delete: 29..29,
insert: "#[cfg(test)]\nmod tests {\n use super::*;\n\n #[test]\n fn ${1:test_name}() {\n $0\n }\n}",
kind: Snippet,
lookup: "tmod",
},
CompletionItem {
label: "macro_rules",
source_range: 78..78,
delete: 78..78,
source_range: 29..29,
delete: 29..29,
insert: "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}",
kind: Snippet,
},
CompletionItem {
label: "pub(crate)",
source_range: 78..78,
delete: 78..78,
source_range: 29..29,
delete: 29..29,
insert: "pub(crate) $0",
kind: Snippet,
},

View file

@ -256,24 +256,24 @@ mod tests {
[
CompletionItem {
label: "const TEST_CONST: u16 = ",
source_range: 209..210,
delete: 209..210,
source_range: 112..113,
delete: 112..113,
insert: "const TEST_CONST: u16 = ",
kind: Const,
lookup: "TEST_CONST",
},
CompletionItem {
label: "fn test()",
source_range: 209..210,
delete: 209..210,
source_range: 112..113,
delete: 112..113,
insert: "fn test() {\n $0\n}",
kind: Function,
lookup: "test",
},
CompletionItem {
label: "type TestType = ",
source_range: 209..210,
delete: 209..210,
source_range: 112..113,
delete: 112..113,
insert: "type TestType = ",
kind: TypeAlias,
lookup: "TestType",
@ -322,8 +322,8 @@ mod tests {
[
CompletionItem {
label: "fn test()",
source_range: 139..140,
delete: 139..140,
source_range: 66..67,
delete: 66..67,
insert: "fn test() {\n $0\n}",
kind: Function,
lookup: "test",
@ -351,8 +351,8 @@ mod tests {
[
CompletionItem {
label: "fn foo()",
source_range: 141..142,
delete: 138..142,
source_range: 68..69,
delete: 65..69,
insert: "fn foo() {\n $0\n}",
kind: Function,
lookup: "foo",
@ -383,8 +383,8 @@ mod tests {
[
CompletionItem {
label: "fn foo_bar()",
source_range: 200..201,
delete: 197..201,
source_range: 103..104,
delete: 100..104,
insert: "fn foo_bar() {\n $0\n}",
kind: Function,
lookup: "foo_bar",
@ -434,8 +434,8 @@ mod tests {
[
CompletionItem {
label: "fn foo()",
source_range: 144..145,
delete: 141..145,
source_range: 71..72,
delete: 68..72,
insert: "fn foo<T>() {\n $0\n}",
kind: Function,
lookup: "foo",
@ -463,8 +463,8 @@ mod tests {
[
CompletionItem {
label: "fn foo()",
source_range: 166..167,
delete: 163..167,
source_range: 93..94,
delete: 90..94,
insert: "fn foo<T>()\nwhere T: Into<String> {\n $0\n}",
kind: Function,
lookup: "foo",
@ -490,8 +490,8 @@ mod tests {
[
CompletionItem {
label: "type SomeType = ",
source_range: 124..125,
delete: 119..125,
source_range: 63..64,
delete: 58..64,
insert: "type SomeType = ",
kind: TypeAlias,
lookup: "SomeType",
@ -517,8 +517,8 @@ mod tests {
[
CompletionItem {
label: "const SOME_CONST: u16 = ",
source_range: 133..134,
delete: 127..134,
source_range: 72..73,
delete: 66..73,
insert: "const SOME_CONST: u16 = ",
kind: Const,
lookup: "SOME_CONST",
@ -544,8 +544,8 @@ mod tests {
[
CompletionItem {
label: "const SOME_CONST: u16 = ",
source_range: 138..139,
delete: 132..139,
source_range: 77..78,
delete: 71..78,
insert: "const SOME_CONST: u16 = ",
kind: Const,
lookup: "SOME_CONST",

View file

@ -85,15 +85,15 @@ mod tests {
"#,
),
@r###"
[
CompletionItem {
label: "collections",
source_range: 21..24,
delete: 21..24,
insert: "collections",
},
]
"###
[
CompletionItem {
label: "collections",
source_range: 4..7,
delete: 4..7,
insert: "collections",
},
]
"###
);
}
@ -157,16 +157,16 @@ mod tests {
"
),
@r###"
[
CompletionItem {
label: "Enum",
source_range: 231..233,
delete: 231..233,
insert: "Enum",
kind: Enum,
},
]
"###
[
CompletionItem {
label: "Enum",
source_range: 102..104,
delete: 102..104,
insert: "Enum",
kind: Enum,
},
]
"###
);
}
@ -186,8 +186,8 @@ mod tests {
[
CompletionItem {
label: "quux(…)",
source_range: 91..91,
delete: 91..91,
source_range: 42..42,
delete: 42..42,
insert: "quux(${1:x})$0",
kind: Function,
lookup: "quux",
@ -196,16 +196,16 @@ mod tests {
},
CompletionItem {
label: "x",
source_range: 91..91,
delete: 91..91,
source_range: 42..42,
delete: 42..42,
insert: "x",
kind: Binding,
detail: "i32",
},
CompletionItem {
label: "y",
source_range: 91..91,
delete: 91..91,
source_range: 42..42,
delete: 42..42,
insert: "y",
kind: Binding,
detail: "i32",
@ -235,23 +235,23 @@ mod tests {
[
CompletionItem {
label: "a",
source_range: 242..242,
delete: 242..242,
source_range: 129..129,
delete: 129..129,
insert: "a",
kind: Binding,
},
CompletionItem {
label: "b",
source_range: 242..242,
delete: 242..242,
source_range: 129..129,
delete: 129..129,
insert: "b",
kind: Binding,
detail: "i32",
},
CompletionItem {
label: "quux()",
source_range: 242..242,
delete: 242..242,
source_range: 129..129,
delete: 129..129,
insert: "quux()$0",
kind: Function,
lookup: "quux",
@ -278,8 +278,8 @@ mod tests {
[
CompletionItem {
label: "quux()",
source_range: 95..95,
delete: 95..95,
source_range: 46..46,
delete: 46..46,
insert: "quux()$0",
kind: Function,
lookup: "quux",
@ -287,8 +287,8 @@ mod tests {
},
CompletionItem {
label: "x",
source_range: 95..95,
delete: 95..95,
source_range: 46..46,
delete: 46..46,
insert: "x",
kind: Binding,
},
@ -314,15 +314,15 @@ mod tests {
[
CompletionItem {
label: "index",
source_range: 107..107,
delete: 107..107,
source_range: 58..58,
delete: 58..58,
insert: "index",
kind: Binding,
},
CompletionItem {
label: "test()",
source_range: 107..107,
delete: 107..107,
source_range: 58..58,
delete: 58..58,
insert: "test()$0",
kind: Function,
lookup: "test",
@ -347,15 +347,15 @@ mod tests {
[
CompletionItem {
label: "T",
source_range: 52..52,
delete: 52..52,
source_range: 19..19,
delete: 19..19,
insert: "T",
kind: TypeParam,
},
CompletionItem {
label: "quux()",
source_range: 52..52,
delete: 52..52,
source_range: 19..19,
delete: 19..19,
insert: "quux()$0",
kind: Function,
lookup: "quux",
@ -380,22 +380,22 @@ mod tests {
[
CompletionItem {
label: "Self",
source_range: 54..54,
delete: 54..54,
source_range: 21..21,
delete: 21..21,
insert: "Self",
kind: TypeParam,
},
CompletionItem {
label: "T",
source_range: 54..54,
delete: 54..54,
source_range: 21..21,
delete: 21..21,
insert: "T",
kind: TypeParam,
},
CompletionItem {
label: "X<…>",
source_range: 54..54,
delete: 54..54,
source_range: 21..21,
delete: 21..21,
insert: "X<$0>",
kind: Struct,
lookup: "X",
@ -419,15 +419,15 @@ mod tests {
[
CompletionItem {
label: "Self",
source_range: 48..48,
delete: 48..48,
source_range: 15..15,
delete: 15..15,
insert: "Self",
kind: TypeParam,
},
CompletionItem {
label: "X",
source_range: 48..48,
delete: 48..48,
source_range: 15..15,
delete: 15..15,
insert: "X",
kind: Enum,
},
@ -452,22 +452,22 @@ mod tests {
[
CompletionItem {
label: "Baz",
source_range: 105..105,
delete: 105..105,
source_range: 40..40,
delete: 40..40,
insert: "Baz",
kind: Enum,
},
CompletionItem {
label: "Foo",
source_range: 105..105,
delete: 105..105,
source_range: 40..40,
delete: 40..40,
insert: "Foo",
kind: Struct,
},
CompletionItem {
label: "quux()",
source_range: 105..105,
delete: 105..105,
source_range: 40..40,
delete: 40..40,
insert: "quux()$0",
kind: Function,
lookup: "quux",
@ -520,15 +520,15 @@ mod tests {
[
CompletionItem {
label: "Bar",
source_range: 117..117,
delete: 117..117,
source_range: 52..52,
delete: 52..52,
insert: "Bar",
kind: Struct,
},
CompletionItem {
label: "quux()",
source_range: 117..117,
delete: 117..117,
source_range: 52..52,
delete: 52..52,
insert: "quux()$0",
kind: Function,
lookup: "quux",
@ -552,15 +552,15 @@ mod tests {
[
CompletionItem {
label: "Foo",
source_range: 55..55,
delete: 55..55,
source_range: 22..22,
delete: 22..22,
insert: "Foo",
kind: Struct,
},
CompletionItem {
label: "x()",
source_range: 55..55,
delete: 55..55,
source_range: 22..22,
delete: 22..22,
insert: "x()$0",
kind: Function,
lookup: "x",
@ -589,16 +589,16 @@ mod tests {
[
CompletionItem {
label: "bar",
source_range: 146..146,
delete: 146..146,
source_range: 65..65,
delete: 65..65,
insert: "bar",
kind: Binding,
detail: "i32",
},
CompletionItem {
label: "foo()",
source_range: 146..146,
delete: 146..146,
source_range: 65..65,
delete: 65..65,
insert: "foo()$0",
kind: Function,
lookup: "foo",
@ -1001,16 +1001,16 @@ mod tests {
[
CompletionItem {
label: "m!(…)",
source_range: 145..145,
delete: 145..145,
source_range: 80..80,
delete: 80..80,
insert: "m!($0)",
kind: Macro,
detail: "macro_rules! m",
},
CompletionItem {
label: "quux(…)",
source_range: 145..145,
delete: 145..145,
source_range: 80..80,
delete: 80..80,
insert: "quux(${1:x})$0",
kind: Function,
lookup: "quux",
@ -1019,16 +1019,16 @@ mod tests {
},
CompletionItem {
label: "x",
source_range: 145..145,
delete: 145..145,
source_range: 80..80,
delete: 80..80,
insert: "x",
kind: Binding,
detail: "i32",
},
CompletionItem {
label: "y",
source_range: 145..145,
delete: 145..145,
source_range: 80..80,
delete: 80..80,
insert: "y",
kind: Binding,
detail: "i32",
@ -1054,16 +1054,16 @@ mod tests {
[
CompletionItem {
label: "m!(…)",
source_range: 145..146,
delete: 145..146,
source_range: 80..81,
delete: 80..81,
insert: "m!($0)",
kind: Macro,
detail: "macro_rules! m",
},
CompletionItem {
label: "quux(…)",
source_range: 145..146,
delete: 145..146,
source_range: 80..81,
delete: 80..81,
insert: "quux(${1:x})$0",
kind: Function,
lookup: "quux",
@ -1072,16 +1072,16 @@ mod tests {
},
CompletionItem {
label: "x",
source_range: 145..146,
delete: 145..146,
source_range: 80..81,
delete: 80..81,
insert: "x",
kind: Binding,
detail: "i32",
},
CompletionItem {
label: "y",
source_range: 145..146,
delete: 145..146,
source_range: 80..81,
delete: 80..81,
insert: "y",
kind: Binding,
detail: "i32",
@ -1107,16 +1107,16 @@ mod tests {
[
CompletionItem {
label: "m!(…)",
source_range: 145..146,
delete: 145..146,
source_range: 80..81,
delete: 80..81,
insert: "m!($0)",
kind: Macro,
detail: "macro_rules! m",
},
CompletionItem {
label: "quux(…)",
source_range: 145..146,
delete: 145..146,
source_range: 80..81,
delete: 80..81,
insert: "quux(${1:x})$0",
kind: Function,
lookup: "quux",
@ -1125,16 +1125,16 @@ mod tests {
},
CompletionItem {
label: "x",
source_range: 145..146,
delete: 145..146,
source_range: 80..81,
delete: 80..81,
insert: "x",
kind: Binding,
detail: "i32",
},
CompletionItem {
label: "y",
source_range: 145..146,
delete: 145..146,
source_range: 80..81,
delete: 80..81,
insert: "y",
kind: Binding,
detail: "i32",
@ -1160,14 +1160,14 @@ mod tests {
[
CompletionItem {
label: "Quux",
source_range: 82..82,
delete: 82..82,
source_range: 33..33,
delete: 33..33,
insert: "Quux",
},
CompletionItem {
label: "main()",
source_range: 82..82,
delete: 82..82,
source_range: 33..33,
delete: 33..33,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -1201,15 +1201,15 @@ mod tests {
[
CompletionItem {
label: "Foo",
source_range: 248..250,
delete: 248..250,
source_range: 103..105,
delete: 103..105,
insert: "Foo",
kind: Enum,
},
CompletionItem {
label: "Foo::Bar",
source_range: 248..250,
delete: 248..250,
source_range: 103..105,
delete: 103..105,
insert: "Foo::Bar",
kind: EnumVariant,
lookup: "Bar",
@ -1217,8 +1217,8 @@ mod tests {
},
CompletionItem {
label: "Foo::Baz",
source_range: 248..250,
delete: 248..250,
source_range: 103..105,
delete: 103..105,
insert: "Foo::Baz",
kind: EnumVariant,
lookup: "Baz",
@ -1226,8 +1226,8 @@ mod tests {
},
CompletionItem {
label: "Foo::Quux",
source_range: 248..250,
delete: 248..250,
source_range: 103..105,
delete: 103..105,
insert: "Foo::Quux",
kind: EnumVariant,
lookup: "Quux",
@ -1262,15 +1262,15 @@ mod tests {
[
CompletionItem {
label: "Foo",
source_range: 219..221,
delete: 219..221,
source_range: 90..92,
delete: 90..92,
insert: "Foo",
kind: Enum,
},
CompletionItem {
label: "Foo::Bar",
source_range: 219..221,
delete: 219..221,
source_range: 90..92,
delete: 90..92,
insert: "Foo::Bar",
kind: EnumVariant,
lookup: "Bar",
@ -1278,8 +1278,8 @@ mod tests {
},
CompletionItem {
label: "Foo::Baz",
source_range: 219..221,
delete: 219..221,
source_range: 90..92,
delete: 90..92,
insert: "Foo::Baz",
kind: EnumVariant,
lookup: "Baz",
@ -1287,8 +1287,8 @@ mod tests {
},
CompletionItem {
label: "Foo::Quux",
source_range: 219..221,
delete: 219..221,
source_range: 90..92,
delete: 90..92,
insert: "Foo::Quux",
kind: EnumVariant,
lookup: "Quux",
@ -1319,15 +1319,15 @@ mod tests {
[
CompletionItem {
label: "Foo",
source_range: 185..186,
delete: 185..186,
source_range: 72..73,
delete: 72..73,
insert: "Foo",
kind: Enum,
},
CompletionItem {
label: "Foo::Bar",
source_range: 185..186,
delete: 185..186,
source_range: 72..73,
delete: 72..73,
insert: "Foo::Bar",
kind: EnumVariant,
lookup: "Bar",
@ -1335,8 +1335,8 @@ mod tests {
},
CompletionItem {
label: "Foo::Baz",
source_range: 185..186,
delete: 185..186,
source_range: 72..73,
delete: 72..73,
insert: "Foo::Baz",
kind: EnumVariant,
lookup: "Baz",
@ -1344,8 +1344,8 @@ mod tests {
},
CompletionItem {
label: "Foo::Quux",
source_range: 185..186,
delete: 185..186,
source_range: 72..73,
delete: 72..73,
insert: "Foo::Quux",
kind: EnumVariant,
lookup: "Quux",
@ -1353,8 +1353,8 @@ mod tests {
},
CompletionItem {
label: "main()",
source_range: 185..186,
delete: 185..186,
source_range: 72..73,
delete: 72..73,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -1381,8 +1381,8 @@ mod tests {
[
CompletionItem {
label: "f()",
source_range: 98..99,
delete: 98..99,
source_range: 49..50,
delete: 49..50,
insert: "f()$0",
kind: Function,
lookup: "f",
@ -1390,15 +1390,15 @@ mod tests {
},
CompletionItem {
label: "m",
source_range: 98..99,
delete: 98..99,
source_range: 49..50,
delete: 49..50,
insert: "m",
kind: Module,
},
CompletionItem {
label: "m::E::V",
source_range: 98..99,
delete: 98..99,
source_range: 49..50,
delete: 49..50,
insert: "m::E::V",
kind: EnumVariant,
lookup: "V",

View file

@ -491,13 +491,14 @@ mod tests {
[
CompletionItem {
label: "Foo",
source_range: 121..123,
delete: 121..123,
source_range: 56..58,
delete: 56..58,
insert: "Foo",
kind: EnumVariant,
detail: "{ x: i32, y: i32 }",
},
]"###
]
"###
);
}
@ -517,15 +518,16 @@ mod tests {
[
CompletionItem {
label: "Foo(…)",
source_range: 115..117,
delete: 115..117,
source_range: 50..52,
delete: 50..52,
insert: "Foo($0)",
kind: EnumVariant,
lookup: "Foo",
detail: "(i32, i32)",
trigger_call_info: true,
},
]"###
]
"###
);
}
@ -545,13 +547,14 @@ mod tests {
[
CompletionItem {
label: "Foo",
source_range: 104..106,
delete: 104..106,
source_range: 39..41,
delete: 39..41,
insert: "Foo",
kind: EnumVariant,
detail: "()",
},
]"###
]
"###
);
}
@ -573,8 +576,8 @@ mod tests {
[
CompletionItem {
label: "main()",
source_range: 203..206,
delete: 203..206,
source_range: 122..125,
delete: 122..125,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -582,8 +585,8 @@ mod tests {
},
CompletionItem {
label: "something_deprecated()",
source_range: 203..206,
delete: 203..206,
source_range: 122..125,
delete: 122..125,
insert: "something_deprecated()$0",
kind: Function,
lookup: "something_deprecated",
@ -592,8 +595,8 @@ mod tests {
},
CompletionItem {
label: "something_else_deprecated()",
source_range: 203..206,
delete: 203..206,
source_range: 122..125,
delete: 122..125,
insert: "something_else_deprecated()$0",
kind: Function,
lookup: "something_else_deprecated",
@ -619,8 +622,8 @@ mod tests {
[
CompletionItem {
label: "main()",
source_range: 61..64,
delete: 61..64,
source_range: 28..31,
delete: 28..31,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -628,8 +631,8 @@ mod tests {
},
CompletionItem {
label: "no_args()",
source_range: 61..64,
delete: 61..64,
source_range: 28..31,
delete: 28..31,
insert: "no_args()$0",
kind: Function,
lookup: "no_args",
@ -649,8 +652,8 @@ mod tests {
[
CompletionItem {
label: "main()",
source_range: 80..85,
delete: 80..85,
source_range: 47..52,
delete: 47..52,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -658,8 +661,8 @@ mod tests {
},
CompletionItem {
label: "with_args(…)",
source_range: 80..85,
delete: 80..85,
source_range: 47..52,
delete: 47..52,
insert: "with_args(${1:x}, ${2:y})$0",
kind: Function,
lookup: "with_args",
@ -680,8 +683,8 @@ mod tests {
[
CompletionItem {
label: "main()",
source_range: 110..115,
delete: 110..115,
source_range: 77..82,
delete: 77..82,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -689,8 +692,8 @@ mod tests {
},
CompletionItem {
label: "with_ignored_args(…)",
source_range: 110..115,
delete: 110..115,
source_range: 77..82,
delete: 77..82,
insert: "with_ignored_args(${1:foo}, ${2:bar}, ${3:ho_ge_})$0",
kind: Function,
lookup: "with_ignored_args",
@ -716,8 +719,8 @@ mod tests {
[
CompletionItem {
label: "foo()",
source_range: 163..164,
delete: 163..164,
source_range: 66..67,
delete: 66..67,
insert: "foo()$0",
kind: Method,
lookup: "foo",
@ -742,8 +745,8 @@ mod tests {
[
CompletionItem {
label: "foo_ignored_args(…)",
source_range: 194..195,
delete: 194..195,
source_range: 97..98,
delete: 97..98,
insert: "foo_ignored_args(${1:a}, ${2:b})$0",
kind: Method,
lookup: "foo_ignored_args",
@ -771,23 +774,23 @@ mod tests {
[
CompletionItem {
label: "None",
source_range: 144..147,
delete: 144..147,
source_range: 79..82,
delete: 79..82,
insert: "None",
kind: EnumVariant,
detail: "()",
},
CompletionItem {
label: "Option",
source_range: 144..147,
delete: 144..147,
source_range: 79..82,
delete: 79..82,
insert: "Option",
kind: Enum,
},
CompletionItem {
label: "Some(…)",
source_range: 144..147,
delete: 144..147,
source_range: 79..82,
delete: 79..82,
insert: "Some($0)",
kind: EnumVariant,
lookup: "Some",
@ -796,8 +799,8 @@ mod tests {
},
CompletionItem {
label: "main()",
source_range: 144..147,
delete: 144..147,
source_range: 79..82,
delete: 79..82,
insert: "main()$0",
kind: Function,
lookup: "main",
@ -822,23 +825,23 @@ mod tests {
[
CompletionItem {
label: "None",
source_range: 185..188,
delete: 185..188,
source_range: 104..107,
delete: 104..107,
insert: "None",
kind: EnumVariant,
detail: "()",
},
CompletionItem {
label: "Option",
source_range: 185..188,
delete: 185..188,
source_range: 104..107,
delete: 104..107,
insert: "Option",
kind: Enum,
},
CompletionItem {
label: "Some(…)",
source_range: 185..188,
delete: 185..188,
source_range: 104..107,
delete: 104..107,
insert: "Some($0)",
kind: EnumVariant,
lookup: "Some",
@ -872,23 +875,23 @@ mod tests {
[
CompletionItem {
label: "ManualVtable",
source_range: 295..299,
delete: 295..299,
source_range: 182..186,
delete: 182..186,
insert: "ManualVtable",
kind: Struct,
},
CompletionItem {
label: "main",
source_range: 295..299,
delete: 295..299,
source_range: 182..186,
delete: 182..186,
insert: "main",
kind: Function,
detail: "fn main() -> ManualVtable",
},
CompletionItem {
label: "somefn",
source_range: 295..299,
delete: 295..299,
source_range: 182..186,
delete: 182..186,
insert: "somefn",
kind: Function,
detail: "fn somefn(with: u8, a: u8, lot: u8, of: u8, args: u8)",
@ -916,8 +919,8 @@ mod tests {
[
CompletionItem {
label: "foo(…)",
source_range: 171..172,
delete: 171..172,
source_range: 74..75,
delete: 74..75,
insert: "foo(${1:x})$0",
kind: Method,
lookup: "foo",
@ -951,8 +954,8 @@ mod tests {
[
CompletionItem {
label: "foo(…)",
source_range: 171..172,
delete: 171..172,
source_range: 74..75,
delete: 74..75,
insert: "foo($0)",
kind: Method,
lookup: "foo",
@ -1062,16 +1065,16 @@ mod tests {
[
CompletionItem {
label: "Vec<…>",
source_range: 61..63,
delete: 61..63,
source_range: 28..30,
delete: 28..30,
insert: "Vec<$0>",
kind: Struct,
lookup: "Vec",
},
CompletionItem {
label: "foo(…)",
source_range: 61..63,
delete: 61..63,
source_range: 28..30,
delete: 28..30,
insert: "foo(${1:xs})$0",
kind: Function,
lookup: "foo",
@ -1092,16 +1095,16 @@ mod tests {
[
CompletionItem {
label: "Vec<…>",
source_range: 64..66,
delete: 64..66,
source_range: 31..33,
delete: 31..33,
insert: "Vec<$0>",
kind: TypeAlias,
lookup: "Vec",
},
CompletionItem {
label: "foo(…)",
source_range: 64..66,
delete: 64..66,
source_range: 31..33,
delete: 31..33,
insert: "foo(${1:xs})$0",
kind: Function,
lookup: "foo",
@ -1122,15 +1125,15 @@ mod tests {
[
CompletionItem {
label: "Vec",
source_range: 68..70,
delete: 68..70,
source_range: 35..37,
delete: 35..37,
insert: "Vec",
kind: Struct,
},
CompletionItem {
label: "foo(…)",
source_range: 68..70,
delete: 68..70,
source_range: 35..37,
delete: 35..37,
insert: "foo(${1:xs})$0",
kind: Function,
lookup: "foo",
@ -1151,15 +1154,15 @@ mod tests {
[
CompletionItem {
label: "Vec",
source_range: 61..63,
delete: 61..63,
source_range: 28..30,
delete: 28..30,
insert: "Vec",
kind: Struct,
},
CompletionItem {
label: "foo(…)",
source_range: 61..63,
delete: 61..63,
source_range: 28..30,
delete: 28..30,
insert: "foo(${1:xs})$0",
kind: Function,
lookup: "foo",
@ -1254,24 +1257,24 @@ mod tests {
[
CompletionItem {
label: "another_field",
source_range: 201..201,
delete: 201..201,
source_range: 136..136,
delete: 136..136,
insert: "another_field",
kind: Field,
detail: "i64",
},
CompletionItem {
label: "my_string",
source_range: 201..201,
delete: 201..201,
source_range: 136..136,
delete: 136..136,
insert: "my_string",
kind: Field,
detail: "{unknown}",
},
CompletionItem {
label: "the_field",
source_range: 201..201,
delete: 201..201,
source_range: 136..136,
delete: 136..136,
insert: "the_field",
kind: Field,
detail: "u32",
@ -1298,16 +1301,16 @@ mod tests {
[
CompletionItem {
label: "another_field",
source_range: 208..208,
delete: 208..208,
source_range: 143..143,
delete: 143..143,
insert: "another_field",
kind: Field,
detail: "i64",
},
CompletionItem {
label: "another_good_type",
source_range: 208..208,
delete: 208..208,
source_range: 143..143,
delete: 143..143,
insert: "another_good_type",
kind: Field,
detail: "u32",
@ -1315,8 +1318,8 @@ mod tests {
},
CompletionItem {
label: "the_field",
source_range: 208..208,
delete: 208..208,
source_range: 143..143,
delete: 143..143,
insert: "the_field",
kind: Field,
detail: "u32",
@ -1346,16 +1349,16 @@ mod tests {
[
CompletionItem {
label: "another_field",
source_range: 270..270,
delete: 270..270,
source_range: 189..189,
delete: 189..189,
insert: "another_field",
kind: Field,
detail: "i64",
},
CompletionItem {
label: "another_good_type",
source_range: 270..270,
delete: 270..270,
source_range: 189..189,
delete: 189..189,
insert: "another_good_type",
kind: Field,
detail: "u32",
@ -1363,8 +1366,8 @@ mod tests {
},
CompletionItem {
label: "the_field",
source_range: 270..270,
delete: 270..270,
source_range: 189..189,
delete: 189..189,
insert: "the_field",
kind: Field,
detail: "u32",
@ -1394,8 +1397,8 @@ mod tests {
[
CompletionItem {
label: "another_field",
source_range: 336..336,
delete: 336..336,
source_range: 239..239,
delete: 239..239,
insert: "another_field",
kind: Field,
detail: "i64",
@ -1403,16 +1406,16 @@ mod tests {
},
CompletionItem {
label: "another_good_type",
source_range: 336..336,
delete: 336..336,
source_range: 239..239,
delete: 239..239,
insert: "another_good_type",
kind: Field,
detail: "u32",
},
CompletionItem {
label: "the_field",
source_range: 336..336,
delete: 336..336,
source_range: 239..239,
delete: 239..239,
insert: "the_field",
kind: Field,
detail: "u32",
@ -1441,16 +1444,16 @@ mod tests {
[
CompletionItem {
label: "another_field",
source_range: 328..328,
delete: 328..328,
source_range: 231..231,
delete: 231..231,
insert: "another_field",
kind: Field,
detail: "i64",
},
CompletionItem {
label: "another_good_type",
source_range: 328..328,
delete: 328..328,
source_range: 231..231,
delete: 231..231,
insert: "another_good_type",
kind: Field,
detail: "u32",
@ -1458,8 +1461,8 @@ mod tests {
},
CompletionItem {
label: "the_field",
source_range: 328..328,
delete: 328..328,
source_range: 231..231,
delete: 231..231,
insert: "the_field",
kind: Field,
detail: "u32",
@ -1485,15 +1488,15 @@ mod tests {
[
CompletionItem {
label: "WorldSnapshot",
source_range: 132..133,
delete: 132..133,
source_range: 71..72,
delete: 71..72,
insert: "WorldSnapshot",
kind: Struct,
},
CompletionItem {
label: "go(…)",
source_range: 132..133,
delete: 132..133,
source_range: 71..72,
delete: 71..72,
insert: "go(${1:world})$0",
kind: Function,
lookup: "go",
@ -1502,8 +1505,8 @@ mod tests {
},
CompletionItem {
label: "world",
source_range: 132..133,
delete: 132..133,
source_range: 71..72,
delete: 71..72,
insert: "world",
kind: Binding,
detail: "&WorldSnapshot",

View file

@ -443,16 +443,16 @@ mod tests {
#[test]
fn hover_shows_type_of_an_expression() {
let (analysis, position) = single_file_with_position(
"
pub fn foo() -> u32 { 1 }
r#"
pub fn foo() -> u32 { 1 }
fn main() {
let foo_test = foo()<|>;
}
",
fn main() {
let foo_test = foo()<|>;
}
"#,
);
let hover = analysis.hover(position).unwrap().unwrap();
assert_eq!(hover.range, TextRange::new(95.into(), 100.into()));
assert_eq!(hover.range, TextRange::new(58.into(), 63.into()));
assert_eq!(trim_markup_opt(hover.info.first()), Some("u32"));
}

View file

@ -136,12 +136,6 @@ impl MockAnalysis {
self.files.push(MockFileData::new(path.to_string(), text.to_string()));
file_id
}
fn add_file_with_position(&mut self, path: &str, text: &str) -> FilePosition {
let (offset, text) = extract_offset(text);
let file_id = self.next_id();
self.files.push(MockFileData::new(path.to_string(), text));
FilePosition { file_id, offset }
}
fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange {
let (range, text) = extract_range(text);
let file_id = self.next_id();
@ -229,9 +223,7 @@ pub fn single_file(ra_fixture: &str) -> (Analysis, FileId) {
/// Creates analysis for a single file, returns position marked with <|>.
pub fn single_file_with_position(ra_fixture: &str) -> (Analysis, FilePosition) {
let mut mock = MockAnalysis::new();
let pos = mock.add_file_with_position("/main.rs", ra_fixture);
(mock.analysis(), pos)
analysis_and_position(ra_fixture)
}
/// Creates analysis for a single file, returns range marked with a pair of <|>.

View file

@ -197,233 +197,238 @@ mod tests {
#[test]
fn test_struct_literal_after_space() {
let code = r#"
struct Foo <|>{
a: i32,
}
impl Foo {
fn f() -> i32 { 42 }
}
fn main() {
let f: Foo;
f = Foo {a: Foo::f()};
}"#;
let refs = get_all_refs(code);
let refs = get_all_refs(
r#"
struct Foo <|>{
a: i32,
}
impl Foo {
fn f() -> i32 { 42 }
}
fn main() {
let f: Foo;
f = Foo {a: Foo::f()};
}
"#,
);
check_result(
refs,
"Foo STRUCT_DEF FileId(1) 5..39 12..15 Other",
&["FileId(1) 138..141 StructLiteral"],
"Foo STRUCT_DEF FileId(1) 0..26 7..10 Other",
&["FileId(1) 101..104 StructLiteral"],
);
}
#[test]
fn test_struct_literal_befor_space() {
let code = r#"
struct Foo<|> {}
fn main() {
let f: Foo;
f = Foo {};
}"#;
let refs = get_all_refs(code);
fn test_struct_literal_before_space() {
let refs = get_all_refs(
r#"
struct Foo<|> {}
fn main() {
let f: Foo;
f = Foo {};
}
"#,
);
check_result(
refs,
"Foo STRUCT_DEF FileId(1) 5..18 12..15 Other",
&["FileId(1) 54..57 Other", "FileId(1) 71..74 StructLiteral"],
"Foo STRUCT_DEF FileId(1) 0..13 7..10 Other",
&["FileId(1) 41..44 Other", "FileId(1) 54..57 StructLiteral"],
);
}
#[test]
fn test_struct_literal_with_generic_type() {
let code = r#"
struct Foo<T> <|>{}
fn main() {
let f: Foo::<i32>;
f = Foo {};
}"#;
let refs = get_all_refs(code);
let refs = get_all_refs(
r#"
struct Foo<T> <|>{}
fn main() {
let f: Foo::<i32>;
f = Foo {};
}
"#,
);
check_result(
refs,
"Foo STRUCT_DEF FileId(1) 5..21 12..15 Other",
&["FileId(1) 81..84 StructLiteral"],
"Foo STRUCT_DEF FileId(1) 0..16 7..10 Other",
&["FileId(1) 64..67 StructLiteral"],
);
}
#[test]
fn test_struct_literal_for_tuple() {
let code = r#"
struct Foo<|>(i32);
let refs = get_all_refs(
r#"
struct Foo<|>(i32);
fn main() {
let f: Foo;
f = Foo(1);
}"#;
let refs = get_all_refs(code);
fn main() {
let f: Foo;
f = Foo(1);
}
"#,
);
check_result(
refs,
"Foo STRUCT_DEF FileId(1) 5..21 12..15 Other",
&["FileId(1) 71..74 StructLiteral"],
"Foo STRUCT_DEF FileId(1) 0..16 7..10 Other",
&["FileId(1) 54..57 StructLiteral"],
);
}
#[test]
fn test_find_all_refs_for_local() {
let code = r#"
fn main() {
let mut i = 1;
let j = 1;
i = i<|> + j;
let refs = get_all_refs(
r#"
fn main() {
let mut i = 1;
let j = 1;
i = i<|> + j;
{
i = 0;
}
{
i = 0;
}
i = 5;
}"#;
let refs = get_all_refs(code);
i = 5;
}"#,
);
check_result(
refs,
"i BIND_PAT FileId(1) 33..34 Other Write",
"i BIND_PAT FileId(1) 24..25 Other Write",
&[
"FileId(1) 67..68 Other Write",
"FileId(1) 71..72 Other Read",
"FileId(1) 101..102 Other Write",
"FileId(1) 127..128 Other Write",
"FileId(1) 50..51 Other Write",
"FileId(1) 54..55 Other Read",
"FileId(1) 76..77 Other Write",
"FileId(1) 94..95 Other Write",
],
);
}
#[test]
fn search_filters_by_range() {
let code = r#"
fn foo() {
let spam<|> = 92;
spam + spam
}
fn bar() {
let spam = 92;
spam + spam
}
"#;
let refs = get_all_refs(code);
let refs = get_all_refs(
r#"
fn foo() {
let spam<|> = 92;
spam + spam
}
fn bar() {
let spam = 92;
spam + spam
}
"#,
);
check_result(
refs,
"spam BIND_PAT FileId(1) 44..48 Other",
&["FileId(1) 71..75 Other Read", "FileId(1) 78..82 Other Read"],
"spam BIND_PAT FileId(1) 19..23 Other",
&["FileId(1) 34..38 Other Read", "FileId(1) 41..45 Other Read"],
);
}
#[test]
fn test_find_all_refs_for_param_inside() {
let code = r#"
fn foo(i : u32) -> u32 {
i<|>
}"#;
let refs = get_all_refs(code);
check_result(refs, "i BIND_PAT FileId(1) 12..13 Other", &["FileId(1) 38..39 Other Read"]);
let refs = get_all_refs(
r#"
fn foo(i : u32) -> u32 {
i<|>
}
"#,
);
check_result(refs, "i BIND_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]);
}
#[test]
fn test_find_all_refs_for_fn_param() {
let code = r#"
fn foo(i<|> : u32) -> u32 {
i
}"#;
let refs = get_all_refs(code);
check_result(refs, "i BIND_PAT FileId(1) 12..13 Other", &["FileId(1) 38..39 Other Read"]);
let refs = get_all_refs(
r#"
fn foo(i<|> : u32) -> u32 {
i
}
"#,
);
check_result(refs, "i BIND_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]);
}
#[test]
fn test_find_all_refs_field_name() {
let code = r#"
//- /lib.rs
struct Foo {
pub spam<|>: u32,
}
let refs = get_all_refs(
r#"
//- /lib.rs
struct Foo {
pub spam<|>: u32,
}
fn main(s: Foo) {
let f = s.spam;
}
"#;
let refs = get_all_refs(code);
fn main(s: Foo) {
let f = s.spam;
}
"#,
);
check_result(
refs,
"spam RECORD_FIELD_DEF FileId(1) 66..79 70..74 Other",
&["FileId(1) 152..156 Other Read"],
"spam RECORD_FIELD_DEF FileId(1) 17..30 21..25 Other",
&["FileId(1) 67..71 Other Read"],
);
}
#[test]
fn test_find_all_refs_impl_item_name() {
let code = r#"
//- /lib.rs
struct Foo;
impl Foo {
fn f<|>(&self) { }
}
"#;
let refs = get_all_refs(code);
check_result(refs, "f FN_DEF FileId(1) 88..104 91..92 Other", &[]);
let refs = get_all_refs(
r#"
struct Foo;
impl Foo {
fn f<|>(&self) { }
}
"#,
);
check_result(refs, "f FN_DEF FileId(1) 27..43 30..31 Other", &[]);
}
#[test]
fn test_find_all_refs_enum_var_name() {
let code = r#"
//- /lib.rs
enum Foo {
A,
B<|>,
C,
}
"#;
let refs = get_all_refs(code);
check_result(refs, "B ENUM_VARIANT FileId(1) 83..84 83..84 Other", &[]);
let refs = get_all_refs(
r#"
enum Foo {
A,
B<|>,
C,
}
"#,
);
check_result(refs, "B ENUM_VARIANT FileId(1) 22..23 22..23 Other", &[]);
}
#[test]
fn test_find_all_refs_two_modules() {
let code = r#"
//- /lib.rs
pub mod foo;
pub mod bar;
let (analysis, pos) = analysis_and_position(
r#"
//- /lib.rs
pub mod foo;
pub mod bar;
fn f() {
let i = foo::Foo { n: 5 };
}
fn f() {
let i = foo::Foo { n: 5 };
}
//- /foo.rs
use crate::bar;
//- /foo.rs
use crate::bar;
pub struct Foo {
pub n: u32,
}
pub struct Foo {
pub n: u32,
}
fn f() {
let i = bar::Bar { n: 5 };
}
fn f() {
let i = bar::Bar { n: 5 };
}
//- /bar.rs
use crate::foo;
//- /bar.rs
use crate::foo;
pub struct Bar {
pub n: u32,
}
pub struct Bar {
pub n: u32,
}
fn f() {
let i = foo::Foo<|> { n: 5 };
}
"#;
let (analysis, pos) = analysis_and_position(code);
fn f() {
let i = foo::Foo<|> { n: 5 };
}
"#,
);
let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
check_result(
refs,
@ -437,48 +442,48 @@ mod tests {
// which is the whole `foo.rs`, and the second one is in `use foo::Foo`.
#[test]
fn test_find_all_refs_decl_module() {
let code = r#"
//- /lib.rs
mod foo<|>;
let (analysis, pos) = analysis_and_position(
r#"
//- /lib.rs
mod foo<|>;
use foo::Foo;
use foo::Foo;
fn f() {
let i = Foo { n: 5 };
}
fn f() {
let i = Foo { n: 5 };
}
//- /foo.rs
pub struct Foo {
pub n: u32,
}
"#;
let (analysis, pos) = analysis_and_position(code);
//- /foo.rs
pub struct Foo {
pub n: u32,
}
"#,
);
let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
check_result(refs, "foo SOURCE_FILE FileId(2) 0..35 Other", &["FileId(1) 14..17 Other"]);
}
#[test]
fn test_find_all_refs_super_mod_vis() {
let code = r#"
//- /lib.rs
mod foo;
let (analysis, pos) = analysis_and_position(
r#"
//- /lib.rs
mod foo;
//- /foo.rs
mod some;
use some::Foo;
//- /foo.rs
mod some;
use some::Foo;
fn f() {
let i = Foo { n: 5 };
}
fn f() {
let i = Foo { n: 5 };
}
//- /foo/some.rs
pub(super) struct Foo<|> {
pub n: u32,
}
"#;
let (analysis, pos) = analysis_and_position(code);
//- /foo/some.rs
pub(super) struct Foo<|> {
pub n: u32,
}
"#,
);
let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
check_result(
refs,
@ -525,93 +530,98 @@ mod tests {
#[test]
fn test_find_all_refs_macro_def() {
let code = r#"
#[macro_export]
macro_rules! m1<|> { () => (()) }
let refs = get_all_refs(
r#"
#[macro_export]
macro_rules! m1<|> { () => (()) }
fn foo() {
m1();
m1();
}"#;
let refs = get_all_refs(code);
fn foo() {
m1();
m1();
}
"#,
);
check_result(
refs,
"m1 MACRO_CALL FileId(1) 9..63 46..48 Other",
&["FileId(1) 96..98 StructLiteral", "FileId(1) 114..116 StructLiteral"],
"m1 MACRO_CALL FileId(1) 0..46 29..31 Other",
&["FileId(1) 63..65 StructLiteral", "FileId(1) 73..75 StructLiteral"],
);
}
#[test]
fn test_basic_highlight_read_write() {
let code = r#"
fn foo() {
let mut i<|> = 0;
i = i + 1;
}"#;
let refs = get_all_refs(code);
let refs = get_all_refs(
r#"
fn foo() {
let mut i<|> = 0;
i = i + 1;
}
"#,
);
check_result(
refs,
"i BIND_PAT FileId(1) 40..41 Other Write",
&["FileId(1) 59..60 Other Write", "FileId(1) 63..64 Other Read"],
"i BIND_PAT FileId(1) 23..24 Other Write",
&["FileId(1) 34..35 Other Write", "FileId(1) 38..39 Other Read"],
);
}
#[test]
fn test_basic_highlight_field_read_write() {
let code = r#"
struct S {
f: u32,
}
let refs = get_all_refs(
r#"
struct S {
f: u32,
}
fn foo() {
let mut s = S{f: 0};
s.f<|> = 0;
}"#;
let refs = get_all_refs(code);
fn foo() {
let mut s = S{f: 0};
s.f<|> = 0;
}
"#,
);
check_result(
refs,
"f RECORD_FIELD_DEF FileId(1) 32..38 32..33 Other",
&["FileId(1) 96..97 Other Read", "FileId(1) 117..118 Other Write"],
"f RECORD_FIELD_DEF FileId(1) 15..21 15..16 Other",
&["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"],
);
}
#[test]
fn test_basic_highlight_decl_no_write() {
let code = r#"
fn foo() {
let i<|>;
i = 1;
}"#;
let refs = get_all_refs(code);
check_result(refs, "i BIND_PAT FileId(1) 36..37 Other", &["FileId(1) 51..52 Other Write"]);
let refs = get_all_refs(
r#"
fn foo() {
let i<|>;
i = 1;
}
"#,
);
check_result(refs, "i BIND_PAT FileId(1) 19..20 Other", &["FileId(1) 26..27 Other Write"]);
}
#[test]
fn test_find_struct_function_refs_outside_module() {
let code = r#"
mod foo {
pub struct Foo;
let refs = get_all_refs(
r#"
mod foo {
pub struct Foo;
impl Foo {
pub fn new<|>() -> Foo {
Foo
}
}
impl Foo {
pub fn new<|>() -> Foo {
Foo
}
}
}
fn main() {
let _f = foo::Foo::new();
}"#;
let refs = get_all_refs(code);
fn main() {
let _f = foo::Foo::new();
}
"#,
);
check_result(
refs,
"new FN_DEF FileId(1) 87..150 94..97 Other",
&["FileId(1) 227..230 StructLiteral"],
"new FN_DEF FileId(1) 54..101 61..64 Other",
&["FileId(1) 146..149 StructLiteral"],
);
}
@ -642,8 +652,8 @@ mod tests {
);
}
fn get_all_refs(text: &str) -> ReferenceSearchResult {
let (analysis, position) = single_file_with_position(text);
fn get_all_refs(ra_fixture: &str) -> ReferenceSearchResult {
let (analysis, position) = single_file_with_position(ra_fixture);
analysis.find_all_refs(position, None).unwrap().unwrap()
}

View file

@ -276,6 +276,7 @@ mod tests {
use crate::{
mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId,
};
use stdx::trim_indent;
#[test]
fn test_rename_to_underscore() {
@ -1053,8 +1054,9 @@ pub mod foo<|>;
);
}
fn test_rename(text: &str, new_name: &str, expected: &str) {
let (analysis, position) = single_file_with_position(text);
fn test_rename(ra_fixture_before: &str, new_name: &str, ra_fixture_after: &str) {
let ra_fixture_after = &trim_indent(ra_fixture_after);
let (analysis, position) = single_file_with_position(ra_fixture_before);
let source_change = analysis.rename(position, new_name).unwrap();
let mut text_edit_builder = TextEditBuilder::default();
let mut file_id: Option<FileId> = None;
@ -1068,6 +1070,6 @@ pub mod foo<|>;
}
let mut result = analysis.file_text(file_id.unwrap()).unwrap().to_string();
text_edit_builder.finish().apply(&mut result);
assert_eq_text!(expected, &*result);
assert_eq_text!(ra_fixture_after, &*result);
}
}

View file

@ -78,6 +78,7 @@ mod tests {
use test_utils::assert_eq_text;
use crate::mock_analysis::single_file_with_position;
use stdx::trim_indent;
fn apply_on_enter(before: &str) -> Option<String> {
let (analysis, position) = single_file_with_position(&before);
@ -89,6 +90,7 @@ mod tests {
}
fn do_check(ra_fixture_before: &str, ra_fixture_after: &str) {
let ra_fixture_after = &trim_indent(ra_fixture_after);
let actual = apply_on_enter(ra_fixture_before).unwrap();
assert_eq_text!(ra_fixture_after, &actual);
}