diff options
author | Eduardo Canellas <[email protected]> | 2021-05-25 15:42:16 +0100 |
---|---|---|
committer | Eduardo Canellas <[email protected]> | 2021-05-25 15:53:11 +0100 |
commit | e31a762c63d0fd61e4b84b27b6ebf142c4437487 (patch) | |
tree | b4e8848678e94405978a424014672ac36474d5a0 /crates/ide_completion | |
parent | 35db5e99f6f982f4257e88d13cbecca250b05efe (diff) |
fix: don't show pd/ppd completions where it shouldn't be
Diffstat (limited to 'crates/ide_completion')
-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 2f95b8687..40006fb74 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) { | |||
108 | check_snippet( | 108 | check_snippet( |
109 | test_code, | 109 | test_code, |
110 | expect![[r#" | 110 | expect![[r#" |
111 | sn pd | ||
112 | sn ppd | ||
113 | fd ..Default::default() | 111 | fd ..Default::default() |
114 | "#]], | 112 | "#]], |
115 | ); | 113 | ); |
@@ -179,13 +177,7 @@ fn process(f: S) { | |||
179 | "#]], | 177 | "#]], |
180 | ); | 178 | ); |
181 | 179 | ||
182 | check_snippet( | 180 | check_snippet(test_code, expect![[r#""#]]); |
183 | test_code, | ||
184 | expect![[r#" | ||
185 | sn pd | ||
186 | sn ppd | ||
187 | "#]], | ||
188 | ); | ||
189 | } | 181 | } |
190 | 182 | ||
191 | #[test] | 183 | #[test] |
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 | ||
29 | pub(crate) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionContext) { | 31 | pub(crate) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionContext) { |