Skip to content

Commit 2c9878a

Browse files
bors[bot]bnjjj
andauthored
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>
2 parents 0063ad9 + 72e3d22 commit 2c9878a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

crates/ra_ide/src/completion/complete_snippet.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ pub(super) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionConte
3333
None => return,
3434
};
3535

36+
snippet(
37+
ctx,
38+
cap,
39+
"Test module",
40+
"\
41+
#[cfg(test)]
42+
mod tests {
43+
use super::*;
44+
45+
#[test]
46+
fn ${1:test_name}() {
47+
$0
48+
}
49+
}",
50+
)
51+
.lookup_by("tmod")
52+
.add_to(acc);
53+
3654
snippet(
3755
ctx,
3856
cap,
@@ -117,6 +135,14 @@ mod tests {
117135
kind: Snippet,
118136
lookup: "tfn",
119137
},
138+
CompletionItem {
139+
label: "Test module",
140+
source_range: 78..78,
141+
delete: 78..78,
142+
insert: "#[cfg(test)]\nmod tests {\n use super::*;\n\n #[test]\n fn ${1:test_name}() {\n $0\n }\n}",
143+
kind: Snippet,
144+
lookup: "tmod",
145+
},
120146
CompletionItem {
121147
label: "macro_rules",
122148
source_range: 78..78,

0 commit comments

Comments
 (0)