4868: Fix if and while postfix completions r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-06-13 12:12:08 +00:00 committed by GitHub
commit d00ca86da4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,7 +91,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
&dot_receiver, &dot_receiver,
"if", "if",
"if expr {}", "if expr {}",
&format!("if {} {{$0}}", receiver_text), &format!("if {} {{\n $0\n}}", receiver_text),
) )
.add_to(acc); .add_to(acc);
postfix_snippet( postfix_snippet(
@ -100,7 +100,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
&dot_receiver, &dot_receiver,
"while", "while",
"while expr {}", "while expr {}",
&format!("while {} {{\n$0\n}}", receiver_text), &format!("while {} {{\n $0\n}}", receiver_text),
) )
.add_to(acc); .add_to(acc);
} }
@ -283,7 +283,7 @@ mod tests {
label: "if", label: "if",
source_range: 89..89, source_range: 89..89,
delete: 85..89, delete: 85..89,
insert: "if bar {$0}", insert: "if bar {\n $0\n}",
detail: "if expr {}", detail: "if expr {}",
}, },
CompletionItem { CompletionItem {
@ -318,7 +318,7 @@ mod tests {
label: "while", label: "while",
source_range: 89..89, source_range: 89..89,
delete: 85..89, delete: 85..89,
insert: "while bar {\n$0\n}", insert: "while bar {\n $0\n}",
detail: "while expr {}", detail: "while expr {}",
}, },
] ]