From e3b19da8c1e5ba10dffd7a5c381f101c815d46f8 Mon Sep 17 00:00:00 2001 From: Russell Mull Date: Mon, 21 Sep 2020 17:15:20 -0700 Subject: Add ok postfix completion --- crates/ide/src/completion/complete_postfix.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ide/src') diff --git a/crates/ide/src/completion/complete_postfix.rs b/crates/ide/src/completion/complete_postfix.rs index 84c4e129d..c7c3f51a8 100644 --- a/crates/ide/src/completion/complete_postfix.rs +++ b/crates/ide/src/completion/complete_postfix.rs @@ -175,6 +175,16 @@ pub(super) 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, @@ -266,6 +276,7 @@ fn main() { sn if if expr {} sn match match expr {} sn not !expr + sn ok Ok(expr) sn ref &expr sn refm &mut expr sn while while expr {} @@ -287,6 +298,7 @@ fn main() { sn call function(expr) sn dbg dbg!(expr) sn match match expr {} + sn ok Ok(expr) sn ref &expr sn refm &mut expr "#]], -- cgit v1.2.3 From 197d1e1b053b484749ac668c7219a89b1046cacd Mon Sep 17 00:00:00 2001 From: Russell Mull Date: Mon, 21 Sep 2020 17:47:20 -0700 Subject: Cargo fmt --- crates/ide/src/completion/complete_postfix.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'crates/ide/src') diff --git a/crates/ide/src/completion/complete_postfix.rs b/crates/ide/src/completion/complete_postfix.rs index c7c3f51a8..00f546563 100644 --- a/crates/ide/src/completion/complete_postfix.rs +++ b/crates/ide/src/completion/complete_postfix.rs @@ -175,15 +175,8 @@ pub(super) 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, -- cgit v1.2.3