Skip to content

Commit 244f9a1

Browse files
bors[bot]DJMcNab
andcommitted
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]>
2 parents 0bdf8de + 224e0ce commit 244f9a1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

crates/ra_analysis/src/completion/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,15 +427,15 @@ mod tests {
427427
// check_snippet_completion(r"
428428
// <|>
429429
// ",
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}"##,
431431
// );
432432
check_snippet_completion(r"
433433
#[cfg(test)]
434434
mod tests {
435435
<|>
436436
}
437437
",
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}") },
439439
CompletionItem { label: "pub(crate)", lookup: None, snippet: Some("pub(crate) $0") }]"##,
440440
);
441441
}

crates/ra_analysis/src/completion/reference_completion.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,15 @@ fn complete_path(
177177

178178
fn complete_mod_item_snippets(acc: &mut Vec<CompletionItem>) {
179179
acc.push(CompletionItem {
180-
label: "tfn".to_string(),
181-
lookup: None,
182-
snippet: Some("#[test]\nfn $1() {\n $0\n}".to_string()),
180+
label: "Test function".to_string(),
181+
lookup: Some("tfn".to_string()),
182+
snippet: Some(
183+
"#[test]\n\
184+
fn ${1:feature}() {\n\
185+
$0\n\
186+
}"
187+
.to_string(),
188+
),
183189
});
184190
acc.push(CompletionItem {
185191
label: "pub(crate)".to_string(),

0 commit comments

Comments
 (0)