add postfix completion for dbg!() with .dbg

This commit is contained in:
Hoàng Đức Hiếu 2019-02-02 22:10:18 +07:00
parent da3802b2ce
commit 1c5a63e3db
5 changed files with 212 additions and 6 deletions

View file

@ -42,6 +42,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
)
.add_to(acc);
postfix_snippet(ctx, "while", &format!("while {} {{\n$0\n}}", receiver_text)).add_to(acc);
postfix_snippet(ctx, "dbg", &format!("dbg!({})", receiver_text)).add_to(acc);
}
}
@ -92,4 +93,17 @@ mod tests {
"#,
);
}
#[test]
fn test_filter_postfix_completion4() {
check_snippet_completion(
"filter_postfix_completion4",
r#"
fn main() {
let bar = "a";
bar.dbg<|>
}
"#,
);
}
}