aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/complete_snippet.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_snippet.rs')
-rw-r--r--crates/ra_ide_api/src/completion/complete_snippet.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs
index d3344b865..d1cea7375 100644
--- a/crates/ra_ide_api/src/completion/complete_snippet.rs
+++ b/crates/ra_ide_api/src/completion/complete_snippet.rs
@@ -10,6 +10,7 @@ pub(super) fn complete_expr_snippet(acc: &mut Completions, ctx: &CompletionConte
10 if !(ctx.is_trivial_path && ctx.function_syntax.is_some()) { 10 if !(ctx.is_trivial_path && ctx.function_syntax.is_some()) {
11 return; 11 return;
12 } 12 }
13
13 snippet(ctx, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc); 14 snippet(ctx, "pd", "eprintln!(\"$0 = {:?}\", $0);").add_to(acc);
14 snippet(ctx, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc); 15 snippet(ctx, "ppd", "eprintln!(\"$0 = {:#?}\", $0);").add_to(acc);
15} 16}
@@ -48,6 +49,18 @@ mod tests {
48 } 49 }
49 50
50 #[test] 51 #[test]
52 fn should_not_complete_snippets_in_path() {
53 check_snippet_completion(
54 "should_not_complete_snippets_in_path",
55 r"fn foo(x: i32) { ::foo<|> }",
56 );
57 check_snippet_completion(
58 "should_not_complete_snippets_in_path2",
59 r"fn foo(x: i32) { ::<|> }",
60 );
61 }
62
63 #[test]
51 fn completes_snippets_in_items() { 64 fn completes_snippets_in_items() {
52 check_snippet_completion( 65 check_snippet_completion(
53 "snippets_in_items", 66 "snippets_in_items",