diff options
| author | Eduardo Canellas <eduardocanellas98@gmail.com> | 2021-05-25 11:42:16 -0300 |
|---|---|---|
| committer | Eduardo Canellas <eduardocanellas98@gmail.com> | 2021-05-25 11:53:11 -0300 |
| commit | e31a762c63d0fd61e4b84b27b6ebf142c4437487 (patch) | |
| tree | b4e8848678e94405978a424014672ac36474d5a0 | |
| parent | 35db5e99f6f982f4257e88d13cbecca250b05efe (diff) | |
fix: don't show pd/ppd completions where it shouldn't be
| -rw-r--r-- | crates/ide_completion/src/completions/record.rs | 10 | ||||
| -rw-r--r-- | crates/ide_completion/src/completions/snippet.rs | 6 |
2 files changed, 5 insertions, 11 deletions
diff --git a/crates/ide_completion/src/completions/record.rs b/crates/ide_completion/src/completions/record.rs index 2f95b868743..40006fb74f6 100644 --- a/crates/ide_completion/src/completions/record.rs +++ b/crates/ide_completion/src/completions/record.rs @@ -108,8 +108,6 @@ fn process(f: S) { check_snippet( test_code, expect![[r#" - sn pd - sn ppd fd ..Default::default() "#]], ); @@ -179,13 +177,7 @@ fn process(f: S) { "#]], ); - check_snippet( - test_code, - expect![[r#" - sn pd - sn ppd - "#]], - ); + check_snippet(test_code, expect![[r#""#]]); } #[test] diff --git a/crates/ide_completion/src/completions/snippet.rs b/crates/ide_completion/src/completions/snippet.rs index 7f7830976b5..14cfb61deef 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 None => return, }; - snippet(ctx, cap, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc); - snippet(ctx, cap, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc); + if ctx.can_be_stmt { + snippet(ctx, cap, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc); + snippet(ctx, cap, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc); + } } pub(crate) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionContext) { |
