diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-01-13 10:24:17 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-01-13 10:24:17 +0000 |
commit | de717a863560772740732b5e2abc832c32af957b (patch) | |
tree | 056792f853ab099736fba5770608b7ed8fa83830 /crates/ra_ide/src | |
parent | 5fd1b044b6eddc05d51a74a681f8f7af3fcdca55 (diff) | |
parent | 5575588387bcd2e36b8b757e9caa144fc2935f15 (diff) |
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 <[email protected]>
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/completion/complete_snippet.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/complete_snippet.rs b/crates/ra_ide/src/completion/complete_snippet.rs index 1f2988b36..731b4fd82 100644 --- a/crates/ra_ide/src/completion/complete_snippet.rs +++ b/crates/ra_ide/src/completion/complete_snippet.rs | |||
@@ -36,6 +36,7 @@ fn ${1:feature}() { | |||
36 | .lookup_by("tfn") | 36 | .lookup_by("tfn") |
37 | .add_to(acc); | 37 | .add_to(acc); |
38 | 38 | ||
39 | snippet(ctx, "macro_rules", "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}").add_to(acc); | ||
39 | snippet(ctx, "pub(crate)", "pub(crate) $0").add_to(acc); | 40 | snippet(ctx, "pub(crate)", "pub(crate) $0").add_to(acc); |
40 | } | 41 | } |
41 | 42 | ||
@@ -107,6 +108,13 @@ mod tests { | |||
107 | lookup: "tfn", | 108 | lookup: "tfn", |
108 | }, | 109 | }, |
109 | CompletionItem { | 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 | }, | ||
117 | CompletionItem { | ||
110 | label: "pub(crate)", | 118 | label: "pub(crate)", |
111 | source_range: [78; 78), | 119 | source_range: [78; 78), |
112 | delete: [78; 78), | 120 | delete: [78; 78), |