fix close parens position to move after field access
This commit is contained in:
parent
21c09eb544
commit
b7effe54ee
@ -37,9 +37,6 @@ pub(crate) fn complete_dot(
|
|||||||
is_field_access,
|
is_field_access,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let DotAccessKind::Method { .. } = dot_access.kind {
|
|
||||||
cov_mark::hit!(test_no_struct_field_completion_for_method_call);
|
|
||||||
}
|
|
||||||
complete_methods(ctx, receiver_ty, |func| acc.add_method(ctx, dot_access, func, None, None));
|
complete_methods(ctx, receiver_ty, |func| acc.add_method(ctx, dot_access, func, None, None));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +256,6 @@ fn foo(&self) { self.$0 }
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_no_struct_field_completion_for_method_call() {
|
fn test_no_struct_field_completion_for_method_call() {
|
||||||
cov_mark::check!(test_no_struct_field_completion_for_method_call);
|
|
||||||
check(
|
check(
|
||||||
r#"
|
r#"
|
||||||
struct A { the_field: u32 }
|
struct A { the_field: u32 }
|
||||||
@ -1202,7 +1198,7 @@ fn foo() { S { va_field: 0, fn_field: || {} }.fi$0() }
|
|||||||
"#,
|
"#,
|
||||||
r#"
|
r#"
|
||||||
struct S { va_field: u32, fn_field: fn() }
|
struct S { va_field: u32, fn_field: fn() }
|
||||||
fn foo() { (S { va_field: 0, fn_field: || {} }).fn_field() }
|
fn foo() { (S { va_field: 0, fn_field: || {} }.fn_field)() }
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1235,7 +1231,7 @@ fn foo() {
|
|||||||
struct B(u32, fn())
|
struct B(u32, fn())
|
||||||
fn foo() {
|
fn foo() {
|
||||||
let b = B(0, || {});
|
let b = B(0, || {});
|
||||||
(b).1()
|
(b.1)()
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
@ -167,9 +167,8 @@ pub(crate) fn render_field(
|
|||||||
if !expected_fn_type {
|
if !expected_fn_type {
|
||||||
if let Some(receiver) = &dot_access.receiver {
|
if let Some(receiver) = &dot_access.receiver {
|
||||||
if let Some(receiver) = ctx.completion.sema.original_ast_node(receiver.clone()) {
|
if let Some(receiver) = ctx.completion.sema.original_ast_node(receiver.clone()) {
|
||||||
let range = receiver.syntax().text_range();
|
builder.insert(receiver.syntax().text_range().start(), "(".to_string());
|
||||||
builder.insert(range.start(), "(".to_string());
|
builder.insert(ctx.source_range().end(), ")".to_string());
|
||||||
builder.insert(range.end(), ")".to_string());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1676,11 +1675,7 @@ fn foo(f: Foo) { let _: &u32 = f.b$0 }
|
|||||||
delete: 107..107,
|
delete: 107..107,
|
||||||
},
|
},
|
||||||
Indel {
|
Indel {
|
||||||
insert: ")",
|
insert: "qux)()",
|
||||||
delete: 108..108,
|
|
||||||
},
|
|
||||||
Indel {
|
|
||||||
insert: "qux()",
|
|
||||||
delete: 109..110,
|
delete: 109..110,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user