Auto merge of #11993 - jonas-schievink:adt-completions-in-block, r=jonas-schievink

fix: enable ADT keyword completions in block expressions

fixes https://github.com/rust-lang/rust-analyzer/issues/11576
This commit is contained in:
bors 2022-04-14 16:40:15 +00:00
commit 7ce3ca5aab
2 changed files with 13 additions and 1 deletions

View File

@ -86,7 +86,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
add_keyword("mod", "mod $0");
}
if expects_item {
if expects_item || has_block_expr_parent {
add_keyword("enum", "enum $1 {\n $0\n}");
add_keyword("struct", "struct $0");
add_keyword("union", "union $1 {\n $0\n}");

View File

@ -137,6 +137,9 @@ impl Unit {
kw trait
kw static
kw mod
kw enum
kw struct
kw union
kw match
kw while
kw while let
@ -227,6 +230,9 @@ fn complete_in_block() {
kw trait
kw static
kw mod
kw enum
kw struct
kw union
kw match
kw while
kw while let
@ -269,6 +275,9 @@ fn complete_after_if_expr() {
kw trait
kw static
kw mod
kw enum
kw struct
kw union
kw match
kw while
kw while let
@ -339,6 +348,9 @@ fn completes_in_loop_ctx() {
kw trait
kw static
kw mod
kw enum
kw struct
kw union
kw match
kw while
kw while let