aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/completions/snippet.rs
diff options
context:
space:
mode:
authorEduardo Canellas <[email protected]>2021-05-25 15:42:16 +0100
committerEduardo Canellas <[email protected]>2021-05-25 15:53:11 +0100
commite31a762c63d0fd61e4b84b27b6ebf142c4437487 (patch)
treeb4e8848678e94405978a424014672ac36474d5a0 /crates/ide_completion/src/completions/snippet.rs
parent35db5e99f6f982f4257e88d13cbecca250b05efe (diff)
fix: don't show pd/ppd completions where it shouldn't be
Diffstat (limited to 'crates/ide_completion/src/completions/snippet.rs')
-rw-r--r--crates/ide_completion/src/completions/snippet.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ide_completion/src/completions/snippet.rs b/crates/ide_completion/src/completions/snippet.rs
index 7f7830976..14cfb61de 100644
--- a/crates/ide_completion/src/completions/snippet.rs
+++ b/crates/ide_completion/src/completions/snippet.rs
@@ -22,8 +22,10 @@ pub(crate) fn complete_expr_snippet(acc: &mut Completions, ctx: &CompletionConte
22 None => return, 22 None => return,
23 }; 23 };
24 24
25 snippet(ctx, cap, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc); 25 if ctx.can_be_stmt {
26 snippet(ctx, cap, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc); 26 snippet(ctx, cap, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc);
27 snippet(ctx, cap, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc);
28 }
27} 29}
28 30
29pub(crate) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionContext) { 31pub(crate) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionContext) {