aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-02 14:58:32 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-02 14:58:32 +0000
commit244f9a142f0593ab5847163d1832e464e2524c4b (patch)
tree5c6a892a1aba4f40823b95087eff82e7754b926f /crates/ra_analysis
parent0bdf8deb77e9066baa42acb98c99e9fc54e90634 (diff)
parent224e0cee5a2bc5f3d5fe9ea2c9e11f2bfb5339fe (diff)
Merge #250
250: Improve the suggestion for test functions r=DJMcNab a=DJMcNab I haven't fully updated the previous commented out test - I don't know why it was commented out so some clarification would be welcome. Co-authored-by: Daniel McNab <[email protected]> Co-authored-by: DJMcNab <[email protected]>
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/src/completion/mod.rs4
-rw-r--r--crates/ra_analysis/src/completion/reference_completion.rs12
2 files changed, 11 insertions, 5 deletions
diff --git a/crates/ra_analysis/src/completion/mod.rs b/crates/ra_analysis/src/completion/mod.rs
index e5ba92acd..124da486a 100644
--- a/crates/ra_analysis/src/completion/mod.rs
+++ b/crates/ra_analysis/src/completion/mod.rs
@@ -427,7 +427,7 @@ mod tests {
427 // check_snippet_completion(r" 427 // check_snippet_completion(r"
428 // <|> 428 // <|>
429 // ", 429 // ",
430 // r##"[CompletionItem { label: "tfn", lookup: None, snippet: Some("#[test]\nfn $1() {\n $0\n}") }]"##, 430 // r##"[CompletionItem { label: "Test function", lookup: None, snippet: Some("#[test]\nfn test_${1:feature}() {\n$0\n}"##,
431 // ); 431 // );
432 check_snippet_completion(r" 432 check_snippet_completion(r"
433 #[cfg(test)] 433 #[cfg(test)]
@@ -435,7 +435,7 @@ mod tests {
435 <|> 435 <|>
436 } 436 }
437 ", 437 ",
438 r##"[CompletionItem { label: "tfn", lookup: None, snippet: Some("#[test]\nfn $1() {\n $0\n}") }, 438 r##"[CompletionItem { label: "Test function", lookup: Some("tfn"), snippet: Some("#[test]\nfn ${1:feature}() {\n$0\n}") },
439 CompletionItem { label: "pub(crate)", lookup: None, snippet: Some("pub(crate) $0") }]"##, 439 CompletionItem { label: "pub(crate)", lookup: None, snippet: Some("pub(crate) $0") }]"##,
440 ); 440 );
441 } 441 }
diff --git a/crates/ra_analysis/src/completion/reference_completion.rs b/crates/ra_analysis/src/completion/reference_completion.rs
index e1a2d5241..8ea7478a8 100644
--- a/crates/ra_analysis/src/completion/reference_completion.rs
+++ b/crates/ra_analysis/src/completion/reference_completion.rs
@@ -177,9 +177,15 @@ fn complete_path(
177 177
178fn complete_mod_item_snippets(acc: &mut Vec<CompletionItem>) { 178fn complete_mod_item_snippets(acc: &mut Vec<CompletionItem>) {
179 acc.push(CompletionItem { 179 acc.push(CompletionItem {
180 label: "tfn".to_string(), 180 label: "Test function".to_string(),
181 lookup: None, 181 lookup: Some("tfn".to_string()),
182 snippet: Some("#[test]\nfn $1() {\n $0\n}".to_string()), 182 snippet: Some(
183 "#[test]\n\
184 fn ${1:feature}() {\n\
185 $0\n\
186 }"
187 .to_string(),
188 ),
183 }); 189 });
184 acc.push(CompletionItem { 190 acc.push(CompletionItem {
185 label: "pub(crate)".to_string(), 191 label: "pub(crate)".to_string(),