Skip to content

Commit de717a8

Browse files
Merge #2816
2816: Add macro_rules item snippet r=matklad a=memoryruins An user trying out rust-analyzer mentioned to me that they missed `rls-vscode`'s [macro_rules snippet](https://github.com/rust-lang/rls-vscode/blob/c2293a63d4adc76ab714a5c6d0a2e9c7b7be77ed/snippets/rust.json#L60) ![2020-01-12_17-47-34](https://user-images.githubusercontent.com/6868531/72227227-fcf46480-3567-11ea-9e3b-2f7319d127f7.gif) Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>
2 parents 5fd1b04 + 5575588 commit de717a8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/ra_ide/src/completion/complete_snippet.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ fn ${1:feature}() {
3636
.lookup_by("tfn")
3737
.add_to(acc);
3838

39+
snippet(ctx, "macro_rules", "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}").add_to(acc);
3940
snippet(ctx, "pub(crate)", "pub(crate) $0").add_to(acc);
4041
}
4142

@@ -106,6 +107,13 @@ mod tests {
106107
kind: Snippet,
107108
lookup: "tfn",
108109
},
110+
CompletionItem {
111+
label: "macro_rules",
112+
source_range: [78; 78),
113+
delete: [78; 78),
114+
insert: "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}",
115+
kind: Snippet,
116+
},
109117
CompletionItem {
110118
label: "pub(crate)",
111119
source_range: [78; 78),

0 commit comments

Comments
 (0)