mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 07:03:45 +00:00
add tests for the completion of the callable field
This commit is contained in:
parent
7cf3ab4bd2
commit
5bcafd7dc0
@ -1206,4 +1206,17 @@ impl<B: Bar, F: core::ops::Deref<Target = B>> Foo<F> {
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_struct_function_field_completion() {
|
||||
check(
|
||||
r#"
|
||||
struct S { field: fn() }
|
||||
fn foo() { S { field: || {} }.fi$0() }
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd field fn()
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1634,7 +1634,7 @@ fn main() {
|
||||
fn struct_field_method_ref() {
|
||||
check_kinds(
|
||||
r#"
|
||||
struct Foo { bar: u32 }
|
||||
struct Foo { bar: u32, qux: fn() }
|
||||
impl Foo { fn baz(&self) -> u32 { 0 } }
|
||||
|
||||
fn foo(f: Foo) { let _: &u32 = f.b$0 }
|
||||
@ -1644,24 +1644,48 @@ fn foo(f: Foo) { let _: &u32 = f.b$0 }
|
||||
[
|
||||
CompletionItem {
|
||||
label: "baz()",
|
||||
source_range: 98..99,
|
||||
delete: 98..99,
|
||||
source_range: 109..110,
|
||||
delete: 109..110,
|
||||
insert: "baz()$0",
|
||||
kind: Method,
|
||||
lookup: "baz",
|
||||
detail: "fn(&self) -> u32",
|
||||
ref_match: "&@96",
|
||||
ref_match: "&@107",
|
||||
},
|
||||
CompletionItem {
|
||||
label: "bar",
|
||||
source_range: 98..99,
|
||||
delete: 98..99,
|
||||
source_range: 109..110,
|
||||
delete: 109..110,
|
||||
insert: "bar",
|
||||
kind: SymbolKind(
|
||||
Field,
|
||||
),
|
||||
detail: "u32",
|
||||
ref_match: "&@96",
|
||||
ref_match: "&@107",
|
||||
},
|
||||
CompletionItem {
|
||||
label: "qux",
|
||||
source_range: 109..110,
|
||||
text_edit: TextEdit {
|
||||
indels: [
|
||||
Indel {
|
||||
insert: "(",
|
||||
delete: 107..107,
|
||||
},
|
||||
Indel {
|
||||
insert: ")",
|
||||
delete: 108..108,
|
||||
},
|
||||
Indel {
|
||||
insert: "qux()",
|
||||
delete: 109..110,
|
||||
},
|
||||
],
|
||||
},
|
||||
kind: SymbolKind(
|
||||
Field,
|
||||
),
|
||||
detail: "fn()",
|
||||
},
|
||||
]
|
||||
"#]],
|
||||
|
Loading…
Reference in New Issue
Block a user