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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -443,16 +443,16 @@ mod tests {
#[test] #[test]
fn hover_shows_type_of_an_expression() { fn hover_shows_type_of_an_expression() {
let (analysis, position) = single_file_with_position( let (analysis, position) = single_file_with_position(
" r#"
pub fn foo() -> u32 { 1 } pub fn foo() -> u32 { 1 }
fn main() { fn main() {
let foo_test = foo()<|>; let foo_test = foo()<|>;
} }
", "#,
); );
let hover = analysis.hover(position).unwrap().unwrap(); 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")); 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())); self.files.push(MockFileData::new(path.to_string(), text.to_string()));
file_id 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 { fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange {
let (range, text) = extract_range(text); let (range, text) = extract_range(text);
let file_id = self.next_id(); 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 <|>. /// Creates analysis for a single file, returns position marked with <|>.
pub fn single_file_with_position(ra_fixture: &str) -> (Analysis, FilePosition) { pub fn single_file_with_position(ra_fixture: &str) -> (Analysis, FilePosition) {
let mut mock = MockAnalysis::new(); analysis_and_position(ra_fixture)
let pos = mock.add_file_with_position("/main.rs", ra_fixture);
(mock.analysis(), pos)
} }
/// Creates analysis for a single file, returns range marked with a pair of <|>. /// Creates analysis for a single file, returns range marked with a pair of <|>.

View file

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

View file

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