mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
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 <36049421+djmcnab@users.noreply.github.com> Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
This commit is contained in:
commit
244f9a142f
2 changed files with 11 additions and 5 deletions
|
@ -427,7 +427,7 @@ mod tests {
|
||||||
// check_snippet_completion(r"
|
// check_snippet_completion(r"
|
||||||
// <|>
|
// <|>
|
||||||
// ",
|
// ",
|
||||||
// r##"[CompletionItem { label: "tfn", lookup: None, snippet: Some("#[test]\nfn $1() {\n $0\n}") }]"##,
|
// r##"[CompletionItem { label: "Test function", lookup: None, snippet: Some("#[test]\nfn test_${1:feature}() {\n$0\n}"##,
|
||||||
// );
|
// );
|
||||||
check_snippet_completion(r"
|
check_snippet_completion(r"
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -435,7 +435,7 @@ mod tests {
|
||||||
<|>
|
<|>
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
r##"[CompletionItem { label: "tfn", lookup: None, snippet: Some("#[test]\nfn $1() {\n $0\n}") },
|
r##"[CompletionItem { label: "Test function", lookup: Some("tfn"), snippet: Some("#[test]\nfn ${1:feature}() {\n$0\n}") },
|
||||||
CompletionItem { label: "pub(crate)", lookup: None, snippet: Some("pub(crate) $0") }]"##,
|
CompletionItem { label: "pub(crate)", lookup: None, snippet: Some("pub(crate) $0") }]"##,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,9 +177,15 @@ fn complete_path(
|
||||||
|
|
||||||
fn complete_mod_item_snippets(acc: &mut Vec<CompletionItem>) {
|
fn complete_mod_item_snippets(acc: &mut Vec<CompletionItem>) {
|
||||||
acc.push(CompletionItem {
|
acc.push(CompletionItem {
|
||||||
label: "tfn".to_string(),
|
label: "Test function".to_string(),
|
||||||
lookup: None,
|
lookup: Some("tfn".to_string()),
|
||||||
snippet: Some("#[test]\nfn $1() {\n $0\n}".to_string()),
|
snippet: Some(
|
||||||
|
"#[test]\n\
|
||||||
|
fn ${1:feature}() {\n\
|
||||||
|
$0\n\
|
||||||
|
}"
|
||||||
|
.to_string(),
|
||||||
|
),
|
||||||
});
|
});
|
||||||
acc.push(CompletionItem {
|
acc.push(CompletionItem {
|
||||||
label: "pub(crate)".to_string(),
|
label: "pub(crate)".to_string(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue