mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Merge #4423
4423: add tests module snippet r=bnjjj a=bnjjj Request from a friend coming from intellij Rust Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
commit
2c9878a2fc
1 changed files with 26 additions and 0 deletions
|
@ -33,6 +33,24 @@ pub(super) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionConte
|
|||
None => return,
|
||||
};
|
||||
|
||||
snippet(
|
||||
ctx,
|
||||
cap,
|
||||
"Test module",
|
||||
"\
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn ${1:test_name}() {
|
||||
$0
|
||||
}
|
||||
}",
|
||||
)
|
||||
.lookup_by("tmod")
|
||||
.add_to(acc);
|
||||
|
||||
snippet(
|
||||
ctx,
|
||||
cap,
|
||||
|
@ -117,6 +135,14 @@ mod tests {
|
|||
kind: Snippet,
|
||||
lookup: "tfn",
|
||||
},
|
||||
CompletionItem {
|
||||
label: "Test module",
|
||||
source_range: 78..78,
|
||||
delete: 78..78,
|
||||
insert: "#[cfg(test)]\nmod tests {\n use super::*;\n\n #[test]\n fn ${1:test_name}() {\n $0\n }\n}",
|
||||
kind: Snippet,
|
||||
lookup: "tmod",
|
||||
},
|
||||
CompletionItem {
|
||||
label: "macro_rules",
|
||||
source_range: 78..78,
|
||||
|
|
Loading…
Reference in a new issue