forked from Shopify/vscode-ruby-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snippets.json
190 lines (190 loc) · 4.82 KB
/
snippets.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
{
"New Minitest spec": {
"prefix": ["Minitest"],
"body": [
"# frozen_string_literal: true",
"",
"require \"spec_helper\"",
"",
"class $1 < Minitest::Spec",
" describe \"$2\" do",
" it \"$3\" do",
" $0",
" assert(true)",
" end",
" end",
"end",
""
],
"description": "New Minitest class using the spec syntax."
},
"New Minitest test": {
"prefix": ["Minitest"],
"body": [
"# frozen_string_literal: true",
"",
"require \"test_helper\"",
"",
"class $1 < Minitest::Test",
" def test_$2",
" $0",
" assert(true)",
" end",
"end",
""
],
"description": "New Minitest class using the test syntax."
},
"New Rspec test": {
"prefix": ["Rspec"],
"body": [
"# frozen_string_literal: true",
"",
"describe $1 do",
" describe \"$2\" do",
" it \"$3\" do",
" $0",
" expect(true).to eq(true)",
" end",
" end",
"end",
""
],
"description": "New Minitest class using the spec syntax."
},
"New class": {
"prefix": ["class"],
"body": ["class $1", " def initialize", " $0", " end", "end", ""],
"description": "New Ruby class."
},
"New module": {
"prefix": ["module"],
"body": ["module $1", " def $2", " $0", " end", "end", ""],
"description": "New Ruby module."
},
"Begin block": {
"prefix": ["begin"],
"body": ["begin", " $0", "end", ""],
"description": "New Ruby begin block."
},
"Begin rescue block": {
"prefix": ["begin"],
"body": ["begin", " $0", "rescue $1", "end", ""],
"description": "New Ruby begin block with rescue."
},
"Begin rescue ensure": {
"prefix": ["begin"],
"body": ["begin", " $0", "rescue $1", "ensure", "end", ""],
"description": "New Ruby begin block with rescue and ensure."
},
"While": {
"prefix": ["while"],
"body": ["while $1", " $0", "end", ""],
"description": "New Ruby while loop."
},
"Until": {
"prefix": ["until"],
"body": ["until $1", " $0", "end", ""],
"description": "New Ruby until loop."
},
"For": {
"prefix": ["for"],
"body": ["for $1 in $2", " $0", "end", ""],
"description": "New Ruby for loop."
},
"Each inline": {
"prefix": ["each"],
"body": ["each { |$1| $0 }"],
"description": "New Ruby inline each loop."
},
"Each block": {
"prefix": ["each"],
"body": ["each do |$1|", " $0", "end"],
"description": "New Ruby each loop."
},
"Map inline": {
"prefix": ["map"],
"body": ["map { |$1| $0 }"],
"description": "New Ruby inline map loop."
},
"Map block": {
"prefix": ["map"],
"body": ["map do |$1|", " $0", "end"],
"description": "New Ruby map loop."
},
"Flat map inline": {
"prefix": ["flat_map"],
"body": ["flat_map { |$1| $0 }"],
"description": "New Ruby inline flat_map loop."
},
"Flat Map block": {
"prefix": ["flat_map"],
"body": ["flat_map do |$1|", " $0", "end"],
"description": "New Ruby flat_map loop."
},
"Select inline": {
"prefix": ["select"],
"body": ["select { |$1| $0 }"],
"description": "New Ruby inline select loop."
},
"Select block": {
"prefix": ["select"],
"body": ["select do |$1|", " $0", "end"],
"description": "New Ruby select loop."
},
"Find inline": {
"prefix": ["find"],
"body": ["find { |$1| $0 }"],
"description": "New Ruby inline find loop."
},
"Find block": {
"prefix": ["find"],
"body": ["find do |$1|", " $0", "end"],
"description": "New Ruby find loop."
},
"Define method": {
"prefix": ["def"],
"body": ["def $1", " $0", "end"],
"description": "New method."
},
"Define singleton method": {
"prefix": ["def"],
"body": ["def self.$1", " $0", "end"],
"description": "New singleton method."
},
"Define attribute accessor": {
"prefix": ["attr"],
"body": ["attr_accessor :$1"],
"description": "New attribute accessor."
},
"Define attribute reader": {
"prefix": ["attr"],
"body": ["attr_reader :$1"],
"description": "New attribute reader."
},
"Define attribute writer": {
"prefix": ["attr"],
"body": ["attr_writer :$1"],
"description": "New attribute writer."
},
"If": {
"prefix": ["if"],
"body": ["if $1", " $0", "end"],
"description": "New if statement."
},
"If else": {
"prefix": ["if"],
"body": ["if $1", " $0", "else", "end"],
"description": "New if statement with else."
},
"If elsif": {
"prefix": ["if"],
"body": ["if $1", " $0", "elsif $2", " $0", "end"],
"description": "New if statement with elsif."
},
"Unless": {
"prefix": ["unless"],
"body": ["unless $1", " $0", "end"],
"description": "New unless statement."
}
}