Add completion to turn x.err into Err(x)

This commit is contained in:
Duong Do Minh Chau 2021-03-09 15:36:41 +07:00
parent 3fdf26a6fc
commit 5fc91058ff
No known key found for this signature in database
GPG key ID: 35914026E84FF202

View file

@ -180,8 +180,25 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
)
.add_to(acc);
postfix_snippet(ctx, cap, &dot_receiver, "ok", "Ok(expr)", &format!("Ok({})", receiver_text))
.add_to(acc);
postfix_snippet(
ctx,
cap,
&dot_receiver,
"ok",
"Ok(expr)",
&format!("Ok({})", receiver_text)
)
.add_to(acc);
postfix_snippet(
ctx,
cap,
&dot_receiver,
"err",
"Err(expr)",
&format!("Err({})", receiver_text)
)
.add_to(acc);
postfix_snippet(
ctx,