mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 06:03:58 +00:00
Merge #7593
7593: fix: add for keyword in completion #7588 r=lnicola a=gowrizrh Fixes #7588 bors r+ Co-authored-by: Gowri <gowri.sankar@aligent.com.au> Co-authored-by: Gowri <gowrizrh@gmail.com>
This commit is contained in:
commit
a996b381bc
1 changed files with 8 additions and 0 deletions
|
@ -88,6 +88,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
|
||||||
add_keyword(ctx, acc, "loop", "loop {$0}");
|
add_keyword(ctx, acc, "loop", "loop {$0}");
|
||||||
add_keyword(ctx, acc, "if", "if $0 {}");
|
add_keyword(ctx, acc, "if", "if $0 {}");
|
||||||
add_keyword(ctx, acc, "if let", "if let $1 = $0 {}");
|
add_keyword(ctx, acc, "if let", "if let $1 = $0 {}");
|
||||||
|
add_keyword(ctx, acc, "for", "for $1 in $0 {}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.if_is_prev || ctx.block_expr_parent {
|
if ctx.if_is_prev || ctx.block_expr_parent {
|
||||||
|
@ -258,6 +259,7 @@ mod tests {
|
||||||
kw loop
|
kw loop
|
||||||
kw if
|
kw if
|
||||||
kw if let
|
kw if let
|
||||||
|
kw for
|
||||||
kw let
|
kw let
|
||||||
kw mod
|
kw mod
|
||||||
kw const
|
kw const
|
||||||
|
@ -284,6 +286,7 @@ mod tests {
|
||||||
kw loop
|
kw loop
|
||||||
kw if
|
kw if
|
||||||
kw if let
|
kw if let
|
||||||
|
kw for
|
||||||
kw let
|
kw let
|
||||||
kw mod
|
kw mod
|
||||||
kw const
|
kw const
|
||||||
|
@ -310,6 +313,7 @@ mod tests {
|
||||||
kw loop
|
kw loop
|
||||||
kw if
|
kw if
|
||||||
kw if let
|
kw if let
|
||||||
|
kw for
|
||||||
kw let
|
kw let
|
||||||
kw else
|
kw else
|
||||||
kw else if
|
kw else if
|
||||||
|
@ -343,6 +347,7 @@ fn quux() -> i32 {
|
||||||
kw loop
|
kw loop
|
||||||
kw if
|
kw if
|
||||||
kw if let
|
kw if let
|
||||||
|
kw for
|
||||||
kw unsafe
|
kw unsafe
|
||||||
kw return
|
kw return
|
||||||
"#]],
|
"#]],
|
||||||
|
@ -391,6 +396,7 @@ fn quux() -> i32 {
|
||||||
kw loop
|
kw loop
|
||||||
kw if
|
kw if
|
||||||
kw if let
|
kw if let
|
||||||
|
kw for
|
||||||
kw let
|
kw let
|
||||||
kw mod
|
kw mod
|
||||||
kw const
|
kw const
|
||||||
|
@ -549,6 +555,7 @@ pub mod future {
|
||||||
kw loop
|
kw loop
|
||||||
kw if
|
kw if
|
||||||
kw if let
|
kw if let
|
||||||
|
kw for
|
||||||
kw return
|
kw return
|
||||||
"#]],
|
"#]],
|
||||||
)
|
)
|
||||||
|
@ -607,6 +614,7 @@ fn foo() {
|
||||||
kw loop
|
kw loop
|
||||||
kw if
|
kw if
|
||||||
kw if let
|
kw if let
|
||||||
|
kw for
|
||||||
kw return
|
kw return
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue