From 5fc91058ff7a94ed90be1125c16670de5a6b268c Mon Sep 17 00:00:00 2001 From: Duong Do Minh Chau Date: Tue, 9 Mar 2021 15:36:41 +0700 Subject: Add completion to turn x.err into Err(x) --- crates/ide_completion/src/completions/postfix.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'crates/ide_completion/src') diff --git a/crates/ide_completion/src/completions/postfix.rs b/crates/ide_completion/src/completions/postfix.rs index 9c34ed0b6..4884a42e2 100644 --- a/crates/ide_completion/src/completions/postfix.rs +++ b/crates/ide_completion/src/completions/postfix.rs @@ -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, -- cgit v1.2.3