aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-08 08:00:41 +0000
committerGitHub <[email protected]>2021-02-08 08:00:41 +0000
commita996b381bc22fb726daa0126e325bd6651183ea3 (patch)
tree06a55f55e795129b9309eff614fbd058b0dbab60 /crates
parent984898329bb2e0ee8861d2363ca8622f7178b065 (diff)
parent6b947567e196fe29f4c4934295a60d791d97c069 (diff)
Merge #7593
7593: fix: add for keyword in completion #7588 r=lnicola a=gowrizrh Fixes #7588 bors r+ Co-authored-by: Gowri <[email protected]> Co-authored-by: Gowri <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/completion/src/completions/keyword.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/completion/src/completions/keyword.rs b/crates/completion/src/completions/keyword.rs
index 47e146128..eb81f9765 100644
--- a/crates/completion/src/completions/keyword.rs
+++ b/crates/completion/src/completions/keyword.rs
@@ -88,6 +88,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
88 add_keyword(ctx, acc, "loop", "loop {$0}"); 88 add_keyword(ctx, acc, "loop", "loop {$0}");
89 add_keyword(ctx, acc, "if", "if $0 {}"); 89 add_keyword(ctx, acc, "if", "if $0 {}");
90 add_keyword(ctx, acc, "if let", "if let $1 = $0 {}"); 90 add_keyword(ctx, acc, "if let", "if let $1 = $0 {}");
91 add_keyword(ctx, acc, "for", "for $1 in $0 {}");
91 } 92 }
92 93
93 if ctx.if_is_prev || ctx.block_expr_parent { 94 if ctx.if_is_prev || ctx.block_expr_parent {
@@ -258,6 +259,7 @@ mod tests {
258 kw loop 259 kw loop
259 kw if 260 kw if
260 kw if let 261 kw if let
262 kw for
261 kw let 263 kw let
262 kw mod 264 kw mod
263 kw const 265 kw const
@@ -284,6 +286,7 @@ mod tests {
284 kw loop 286 kw loop
285 kw if 287 kw if
286 kw if let 288 kw if let
289 kw for
287 kw let 290 kw let
288 kw mod 291 kw mod
289 kw const 292 kw const
@@ -310,6 +313,7 @@ mod tests {
310 kw loop 313 kw loop
311 kw if 314 kw if
312 kw if let 315 kw if let
316 kw for
313 kw let 317 kw let
314 kw else 318 kw else
315 kw else if 319 kw else if
@@ -343,6 +347,7 @@ fn quux() -> i32 {
343 kw loop 347 kw loop
344 kw if 348 kw if
345 kw if let 349 kw if let
350 kw for
346 kw unsafe 351 kw unsafe
347 kw return 352 kw return
348 "#]], 353 "#]],
@@ -391,6 +396,7 @@ fn quux() -> i32 {
391 kw loop 396 kw loop
392 kw if 397 kw if
393 kw if let 398 kw if let
399 kw for
394 kw let 400 kw let
395 kw mod 401 kw mod
396 kw const 402 kw const
@@ -549,6 +555,7 @@ pub mod future {
549 kw loop 555 kw loop
550 kw if 556 kw if
551 kw if let 557 kw if let
558 kw for
552 kw return 559 kw return
553 "#]], 560 "#]],
554 ) 561 )
@@ -607,6 +614,7 @@ fn foo() {
607 kw loop 614 kw loop
608 kw if 615 kw if
609 kw if let 616 kw if let
617 kw for
610 kw return 618 kw return
611 "#]], 619 "#]],
612 ); 620 );