diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-25 20:58:49 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-25 20:58:49 +0100 |
commit | e23083f39813f9559c041b295d23534cd2125913 (patch) | |
tree | 59ef54fa3109c0d710e0d6a0f5d1e9af69cd9d41 /crates | |
parent | 3b10f9e714925640f96478f3c033614e2ccdfd45 (diff) | |
parent | e31a762c63d0fd61e4b84b27b6ebf142c4437487 (diff) |
Merge #8993
8993: fix: don't show pd/ppd completions where it shouldn't be r=flodiebold a=eduardocanellas
Closes #8992
Co-authored-by: Eduardo Canellas <[email protected]>
Diffstat (limited to 'crates')
-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) { |