Skip to content

Commit f7b5e40

Browse files
author
Doğa Gürdal
committed
fix(snippets/json): use choices option for appropriate snippets
Also fixes some default values (mostly true / false instead of 0 / 1) and inconsistencies.
1 parent 4bc780e commit f7b5e40

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

snippets/json.json

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"\t\"label\": \"$1\",",
1818
"\t\"name\": \"$2\",",
1919
"\t\"type\": \"textarea\",",
20-
"\t\"maxlength\": ${3:0},",
21-
"\t\"rows\": ${4:0},",
22-
"\t\"new_lines\": \"${5:wpautop|br}\"",
20+
"\t\"maxlength\": $3,",
21+
"\t\"rows\": ${4:8},",
22+
"\t\"new_lines\": \"${5|wpautop,br|}\"",
2323
"}"
2424
]
2525
},
@@ -73,10 +73,10 @@
7373
"\t\"label\": \"$1\",",
7474
"\t\"name\": \"$2\",",
7575
"\t\"type\": \"wysiwyg\",",
76-
"\t\"tabs\": \"${3:visual|text}\",",
77-
"\t\"toolbar\": \"${4:full|basic}\",",
78-
"\t\"media_upload\": ${5:0},",
79-
"\t\"delay\": ${6:1}",
76+
"\t\"tabs\": \"${3|visual\\,text,visual,text|}\",",
77+
"\t\"toolbar\": \"${4|full,basic|}\",",
78+
"\t\"media_upload\": ${5|false,true|},",
79+
"\t\"delay\": ${6|true,false|}",
8080
"}"
8181
]
8282
},
@@ -97,9 +97,9 @@
9797
"\t\"label\": \"$1\",",
9898
"\t\"name\": \"$2\",",
9999
"\t\"type\": \"image\",",
100-
"\t\"return_format\": \"${3:array|url|id}\",",
101-
"\t\"preview_size\": \"${4:thumbnail}\",",
102-
"\t\"library\": \"${5:all|uploadedTo}\",",
100+
"\t\"return_format\": \"${3|array,url,id|}\",",
101+
"\t\"preview_size\": \"${4|thumbnail,medium,large,full|}\",",
102+
"\t\"library\": \"${5|all,uploadedTo|}\",",
103103
"\t\"min_width\": ${6:0},",
104104
"\t\"max_width\": ${7:0},",
105105
"\t\"min_height\": ${8:0},",
@@ -117,8 +117,8 @@
117117
"\t\"label\": \"$1\",",
118118
"\t\"name\": \"$2\",",
119119
"\t\"type\": \"file\",",
120-
"\t\"return_format\": \"${3:array|url|id}\",",
121-
"\t\"library\": \"${4:all|uploadedTo}\",",
120+
"\t\"return_format\": \"${3|array,url,id|}\",",
121+
"\t\"library\": \"${4|all,uploadedTo|}\",",
122122
"\t\"min_size\": ${5:0},",
123123
"\t\"max_size\": ${6:0},",
124124
"\t\"mime_types\": \"${7:zip,pdf}\"",
@@ -134,8 +134,8 @@
134134
"\t\"type\": \"gallery\",",
135135
"\t\"min\": ${3:0},",
136136
"\t\"max\": ${4:0},",
137-
"\t\"preview_size\": \"${5:thumbnail}\",",
138-
"\t\"library\": \"${6:all|uploadedTo}\",",
137+
"\t\"preview_size\": \"${5|thumbnail,medium,large,full|}\",",
138+
"\t\"library\": \"${6|all,uploadedTo|}\",",
139139
"\t\"min_width\": ${7:0},",
140140
"\t\"max_width\": ${8:0},",
141141
"\t\"min_height\": ${9:0},",
@@ -157,10 +157,10 @@
157157
"\t\t\"$3\": $4",
158158
"\t},",
159159
"\t\"default_value\": \"$5\",",
160-
"\t\"allow_null\": ${6:0},",
161-
"\t\"multiple\": ${7:0},",
162-
"\t\"ui\": ${8:1},",
163-
"\t\"ajax\": ${9:0}",
160+
"\t\"allow_null\": ${6|false,true|},",
161+
"\t\"multiple\": ${7|false,true|},",
162+
"\t\"ui\": ${8|true,false},",
163+
"\t\"ajax\": ${9|false,true|}",
164164
"}"
165165
]
166166
},
@@ -175,8 +175,8 @@
175175
"\t\t\"$3\": \"$4\"",
176176
"\t},",
177177
"\t\"default_value\": \"$5\",",
178-
"\t\"layout\": \"${6:horizontal|vertical}\",",
179-
"\t\"toggle\": ${7:1}",
178+
"\t\"layout\": \"${6|horizontal,vertical|}\",",
179+
"\t\"toggle\": ${7|true,false|}",
180180
"}"
181181
]
182182
},
@@ -187,8 +187,8 @@
187187
"\t\"label\": \"$1\",",
188188
"\t\"name\": \"$2\",",
189189
"\t\"type\": \"true_false\",",
190-
"\t\"default_value\": ${3:0},",
191-
"\t\"ui\": ${4:1}",
190+
"\t\"default_value\": ${3|0,1|},",
191+
"\t\"ui\": ${4|true,false|}",
192192
"}"
193193
]
194194
},
@@ -203,9 +203,9 @@
203203
"\t\t\"$3\": \"$4\"",
204204
"\t},",
205205
"\t\"default_value\": \"$5\",",
206-
"\t\"other_choice\": ${6:0},",
207-
"\t\"save_other_choice\": ${7:0},",
208-
"\t\"layout\": \"${8:horizontal|vertical}\"",
206+
"\t\"other_choice\": ${6|false,true|},",
207+
"\t\"save_other_choice\": ${7|false,true|},",
208+
"\t\"layout\": \"${8|horizontal,vertical|}\"",
209209
"}"
210210
]
211211
},
@@ -216,11 +216,11 @@
216216
"\t\"label\": \"$1\",",
217217
"\t\"name\": \"$2\",",
218218
"\t\"type\": \"user_role_selector\",",
219-
"\t\"return_value\": \"${3:object|name}\",",
219+
"\t\"return_value\": \"${3|object,name|}\",",
220220
"\t\"allowed_roles\": [",
221221
"\t\t\"$4\"",
222222
"\t],",
223-
"\t\"field_type\": \"${5:checkbox|multi_select|radio_buttons|select}\"",
223+
"\t\"field_type\": \"${5|checkbox,multi_select,radio_buttons,select|}\"",
224224
"}"
225225
]
226226
},
@@ -237,10 +237,10 @@
237237
"\t\"taxonomy\": [",
238238
"\t\t\"$4\"",
239239
"\t],",
240-
"\t\"allow_null\": ${5:0},",
241-
"\t\"multiple\": ${6:0},",
242-
"\t\"return_format\": \"${7:object|id}\",",
243-
"\t\"ui\": ${8:1}",
240+
"\t\"allow_null\": ${5|false,true},",
241+
"\t\"multiple\": ${6|false,true},",
242+
"\t\"return_format\": \"${7|object,id|}\",",
243+
"\t\"ui\": ${8|true,false|}",
244244
"}"
245245
]
246246
},
@@ -257,8 +257,8 @@
257257
"\t\"taxonomy\": [",
258258
"\t\t\"$4\"",
259259
"\t],",
260-
"\t\"allow_null\": ${5:0},",
261-
"\t\"multiple\": ${6:0}",
260+
"\t\"allow_null\": ${5|false,true|},",
261+
"\t\"multiple\": ${6|false,true|}",
262262
"}"
263263
]
264264
},
@@ -283,7 +283,7 @@
283283
"\t],",
284284
"\t\"min\": ${7:0},",
285285
"\t\"max\": ${8:0},",
286-
"\t\"return_format\": \"${9:object|id}\"",
286+
"\t\"return_format\": \"${9|object,id|}\"",
287287
"}"
288288
]
289289
},
@@ -295,13 +295,13 @@
295295
"\t\"name\": \"$2\",",
296296
"\t\"type\": \"taxonomy\",",
297297
"\t\"taxonomy\": \"$3\",",
298-
"\t\"field_type\": \"${4:checkbox|multi_select|radio_buttons|select}\",",
299-
"\t\"allow_null\": ${5:0},",
300-
"\t\"multiple\": ${6:0},",
301-
"\t\"add_term\": ${7:0},",
302-
"\t\"save_terms\": ${8:0},",
303-
"\t\"load_terms\": ${9:0},",
304-
"\t\"return_format\": \"${10:object|id}\"",
298+
"\t\"field_type\": \"${4|checkbox,multi_select,radio_buttons,select|}\",",
299+
"\t\"allow_null\": ${5|false,true|},",
300+
"\t\"multiple\": ${6|false,true|},",
301+
"\t\"add_term\": ${7|false,true|},",
302+
"\t\"save_terms\": ${8|false,true|},",
303+
"\t\"load_terms\": ${9|false,true|},",
304+
"\t\"return_format\": \"${10|object,id|}\"",
305305
"}"
306306
]
307307
},
@@ -315,8 +315,8 @@
315315
"\t\"role\": [",
316316
"\t\t\"$3\"",
317317
"\t],",
318-
"\t\"allow_null\": ${3:0},",
319-
"\t\"multiple\": ${4:0}",
318+
"\t\"allow_null\": ${3|false,true|},",
319+
"\t\"multiple\": ${4|false,true|}",
320320
"}"
321321
]
322322
},
@@ -329,8 +329,8 @@
329329
"\t\"type\": \"google_map\",",
330330
"\t\"center_lat\": ${3:0},",
331331
"\t\"center_lng\": ${4:0},",
332-
"\t\"zoom\": ${5:0},",
333-
"\t\"height\": ${6:100}",
332+
"\t\"zoom\": ${5:14},",
333+
"\t\"height\": ${6:400}",
334334
"}"
335335
]
336336
},
@@ -342,8 +342,8 @@
342342
"\t\"name\": \"$2\",",
343343
"\t\"type\": \"date_picker\",",
344344
"\t\"display_format\": \"${3:d.m.Y}\",",
345-
"\t\"return_format\": \"${4:d.m.Y}\",",
346-
"\t\"first_day\": ${5:1}",
345+
"\t\"return_format\": \"${4:Y-m-d}\",",
346+
"\t\"first_day\": ${5|1,0,2,3,4,5,6|}",
347347
"}"
348348
]
349349
},
@@ -354,8 +354,8 @@
354354
"\t\"label\": \"$1\",",
355355
"\t\"type\": \"message\",",
356356
"\t\"message\": \"$2\",",
357-
"\t\"new_lines\": \"${3:wpautop|br}\",",
358-
"\t\"esc_html\": ${4:1}",
357+
"\t\"new_lines\": \"${3|wpautop,br|}\",",
358+
"\t\"esc_html\": ${4|true,false|}",
359359
"}"
360360
]
361361
},
@@ -366,8 +366,8 @@
366366
"\t\"label\": \"$1\",",
367367
"\t\"name\": \"$2\",",
368368
"\t\"type\": \"tab\",",
369-
"\t\"placement\": \"${3:top|bottom}\",",
370-
"\t\"endpoint\": ${4:0}",
369+
"\t\"placement\": \"${3|top,bottom,left,right|}\",",
370+
"\t\"endpoint\": ${4|false,true|}",
371371
"}"
372372
]
373373
},
@@ -381,7 +381,7 @@
381381
"\t\"collapsed\": \"$3\",",
382382
"\t\"min\": ${4:0},",
383383
"\t\"max\": ${5:0},",
384-
"\t\"layout\": \"${6:table|block|row}\",",
384+
"\t\"layout\": \"${6|table,block,row|}\",",
385385
"\t\"button_label\": \"Add ${7:Item}\",",
386386
"\t\"sub_fields\": [",
387387
"\t\t$8",
@@ -412,7 +412,7 @@
412412
"\t\"label\": \"$1\",",
413413
"\t\"type\": \"link\",",
414414
"\t\"name\": \"$2\",",
415-
"\t\"return_format\": \"${3:array|url}\"",
415+
"\t\"return_format\": \"${3|array,url|}\"",
416416
"}"
417417
]
418418
},
@@ -423,9 +423,9 @@
423423
"\t\"label\": \"$1\",",
424424
"\t\"name\": \"$2\",",
425425
"\t\"type\": \"accordion\",",
426-
"\t\"open\": ${3:false},",
427-
"\t\"multi_expand\": ${4:true},",
428-
"\t\"endpoint\": ${5:false}",
426+
"\t\"open\": ${3|false,true|},",
427+
"\t\"multi_expand\": ${4|true,false|},",
428+
"\t\"endpoint\": ${5|false,true|}",
429429
"}"
430430
]
431431
},

0 commit comments

Comments
 (0)