Skip to content

Commit 013f94c

Browse files
committed
cleanup snippets
1 parent d8ad2b9 commit 013f94c

File tree

3 files changed

+140
-32
lines changed

3 files changed

+140
-32
lines changed

snippets/lua.json

+20-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"describe": {
33
"prefix": "describe",
4-
"body": ["describe('${1:Title}', function()", "\t${2}", "end)"]
4+
"body": [
5+
"describe('${1:Title}', function()",
6+
"\t${2}",
7+
"end)"
8+
]
59
},
610
"doc": {
711
"prefix": "doc",
@@ -13,23 +17,33 @@
1317
},
1418
"apifun": {
1519
"prefix": "api.",
16-
"body": ["vim.api.nvim_${1:buf}_${2:get}_${3:name}"]
20+
"body": [
21+
"vim.api.nvim_${1:buf}_${2:get}_${3:name}"
22+
]
1723
},
1824
"fn": {
1925
"prefix": "lfn",
20-
"body": ["local fn = vim.fn"]
26+
"body": [
27+
"local fn = vim.fn"
28+
]
2129
},
2230
"api": {
2331
"prefix": "lapi",
24-
"body": ["local api = vim.api"]
32+
"body": [
33+
"local api = vim.api"
34+
]
2535
},
2636
"fmt": {
2737
"prefix": "lfmt",
28-
"body": ["local fmt = string.format"]
38+
"body": [
39+
"local fmt = string.format"
40+
]
2941
},
3042
"inspect": {
3143
"prefix": "vi",
32-
"body": ["print(\"${1}: \" .. vim.inspect(${1}))"]
44+
"body": [
45+
"print(\"${1}: \" .. vim.inspect(${1}))"
46+
]
3347
},
3448
"for": {
3549
"body": "for ${1:i}=${2:1},${3:10} do\n\t${0:print(i)}\nend",

snippets/react-ts.json

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"destructuring of props": {
33
"prefix": "dp",
4-
"body": ["const { ${1:name} } = this.props"]
4+
"body": [
5+
"const { ${1:name} } = this.props"
6+
]
57
},
68
"destructuring of state": {
79
"prefix": "ds",
8-
"body": ["const { ${1:name} } = this.state"]
10+
"body": [
11+
"const { ${1:name} } = this.state"
12+
]
913
},
1014
"reactClassCompoment": {
1115
"prefix": "rcc",
@@ -289,7 +293,11 @@
289293
},
290294
"useEffect": {
291295
"prefix": "ue",
292-
"body": ["useEffect(() => {", "\t$1", "}, [${3:dependencies}])$0"],
296+
"body": [
297+
"useEffect(() => {",
298+
"\t$1",
299+
"}, [${3:dependencies}])$0"
300+
],
293301
"description": "React useEffect() hook"
294302
},
295303
"useEffect with cleanup": {
@@ -315,12 +323,16 @@
315323
},
316324
"useContext": {
317325
"prefix": "uc",
318-
"body": ["const $1 = useContext($2)$0"],
326+
"body": [
327+
"const $1 = useContext($2)$0"
328+
],
319329
"description": "React useContext() hook"
320330
},
321331
"useRef": {
322332
"prefix": "ur",
323-
"body": ["const ${1:elName}El = useRef(null)$0"],
333+
"body": [
334+
"const ${1:elName}El = useRef(null)$0"
335+
],
324336
"description": "React useContext() hook"
325337
},
326338
"useCallback": {

snippets/typescript.json

+103-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
{
22
"Constructor": {
33
"prefix": "ctor",
4-
"body": ["/**", " *", " */", "constructor() {", "\tsuper();", "\t$0", "}"],
4+
"body": [
5+
"/**",
6+
" *",
7+
" */",
8+
"constructor() {",
9+
"\tsuper();",
10+
"\t$0",
11+
"}"
12+
],
513
"description": "Constructor"
614
},
715
"Class Definition": {
@@ -17,17 +25,30 @@
1725
},
1826
"Public Method Definition": {
1927
"prefix": "public method",
20-
"body": ["/**", " * ${1:name}", " */", "public ${1:name}() {", "\t$0", "}"],
28+
"body": [
29+
"/**",
30+
" * ${1:name}",
31+
" */",
32+
"public ${1:name}() {",
33+
"\t$0",
34+
"}"
35+
],
2136
"description": "Public Method Definition"
2237
},
2338
"Private Method Definition": {
2439
"prefix": "private method",
25-
"body": ["private ${1:name}() {", "\t$0", "}"],
40+
"body": [
41+
"private ${1:name}() {",
42+
"\t$0",
43+
"}"
44+
],
2645
"description": "Private Method Definition"
2746
},
2847
"Import external module.": {
2948
"prefix": "import statement",
30-
"body": ["import { $0 } from \"${1:module}\";"],
49+
"body": [
50+
"import { $0 } from \"${1:module}\";"
51+
],
3152
"description": "Import external module."
3253
},
3354
"Property getter": {
@@ -43,17 +64,26 @@
4364
},
4465
"Log to the console": {
4566
"prefix": "log",
46-
"body": ["console.log($1);", "$0"],
67+
"body": [
68+
"console.log($1);",
69+
"$0"
70+
],
4771
"description": "Log to the console"
4872
},
4973
"Log warning to console": {
5074
"prefix": "warn",
51-
"body": ["console.warn($1);", "$0"],
75+
"body": [
76+
"console.warn($1);",
77+
"$0"
78+
],
5279
"description": "Log warning to the console"
5380
},
5481
"Log error to console": {
5582
"prefix": "error",
56-
"body": ["console.error($1);", "$0"],
83+
"body": [
84+
"console.error($1);",
85+
"$0"
86+
],
5787
"description": "Log error to the console"
5888
},
5989
"Define a full property": {
@@ -73,7 +103,10 @@
73103
},
74104
"Triple-slash reference": {
75105
"prefix": "ref",
76-
"body": ["/// <reference path=\"$1\" />", "$0"],
106+
"body": [
107+
"/// <reference path=\"$1\" />",
108+
"$0"
109+
],
77110
"description": "Triple-slash reference"
78111
},
79112
"Property setter": {
@@ -89,7 +122,10 @@
89122
},
90123
"Throw Exception": {
91124
"prefix": "throw",
92-
"body": ["throw \"$1\";", "$0"],
125+
"body": [
126+
"throw \"$1\";",
127+
"$0"
128+
],
93129
"description": "Throw Exception"
94130
},
95131
"For Loop": {
@@ -104,7 +140,11 @@
104140
},
105141
"For-Each Loop using =>": {
106142
"prefix": "foreach =>",
107-
"body": ["${1:array}.forEach(${2:element} => {", "\t$0", "});"],
143+
"body": [
144+
"${1:array}.forEach(${2:element} => {",
145+
"\t$0",
146+
"});"
147+
],
108148
"description": "For-Each Loop using =>"
109149
},
110150
"For-In Loop": {
@@ -121,27 +161,47 @@
121161
},
122162
"For-Of Loop": {
123163
"prefix": "forof",
124-
"body": ["for (const ${1:iterator} of ${2:object}) {", "\t$0", "}"],
164+
"body": [
165+
"for (const ${1:iterator} of ${2:object}) {",
166+
"\t$0",
167+
"}"
168+
],
125169
"description": "For-Of Loop"
126170
},
127171
"Function Statement": {
128172
"prefix": "function",
129-
"body": ["function ${1:name}(${2:params}:${3:type}) {", "\t$0", "}"],
173+
"body": [
174+
"function ${1:name}(${2:params}:${3:type}) {",
175+
"\t$0",
176+
"}"
177+
],
130178
"description": "Function Statement"
131179
},
132180
"If Statement": {
133181
"prefix": "if",
134-
"body": ["if (${1:condition}) {", "\t$0", "}"],
182+
"body": [
183+
"if (${1:condition}) {",
184+
"\t$0",
185+
"}"
186+
],
135187
"description": "If Statement"
136188
},
137189
"If-Else Statement": {
138190
"prefix": "ifelse",
139-
"body": ["if (${1:condition}) {", "\t$0", "} else {", "\t", "}"],
191+
"body": [
192+
"if (${1:condition}) {",
193+
"\t$0",
194+
"} else {",
195+
"\t",
196+
"}"
197+
],
140198
"description": "If-Else Statement"
141199
},
142200
"New Statement": {
143201
"prefix": "new",
144-
"body": ["const ${1:name} = new ${2:type}(${3:arguments});$0"],
202+
"body": [
203+
"const ${1:name} = new ${2:type}(${3:arguments});$0"
204+
],
145205
"description": "New Statement"
146206
},
147207
"Switch Statement": {
@@ -160,32 +220,54 @@
160220
},
161221
"While Statement": {
162222
"prefix": "while",
163-
"body": ["while (${1:condition}) {", "\t$0", "}"],
223+
"body": [
224+
"while (${1:condition}) {",
225+
"\t$0",
226+
"}"
227+
],
164228
"description": "While Statement"
165229
},
166230
"Do-While Statement": {
167231
"prefix": "dowhile",
168-
"body": ["do {", "\t$0", "} while (${1:condition});"],
232+
"body": [
233+
"do {",
234+
"\t$0",
235+
"} while (${1:condition});"
236+
],
169237
"description": "Do-While Statement"
170238
},
171239
"Try-Catch Statement": {
172240
"prefix": "trycatch",
173-
"body": ["try {", "\t$0", "} catch (${1:error}) {", "\t", "}"],
241+
"body": [
242+
"try {",
243+
"\t$0",
244+
"} catch (${1:error}) {",
245+
"\t",
246+
"}"
247+
],
174248
"description": "Try-Catch Statement"
175249
},
176250
"Set Timeout Function": {
177251
"prefix": "settimeout",
178-
"body": ["setTimeout(() => {", "\t$0", "}, ${1:timeout});"],
252+
"body": [
253+
"setTimeout(() => {",
254+
"\t$0",
255+
"}, ${1:timeout});"
256+
],
179257
"description": "Set Timeout Function"
180258
},
181259
"Region Start": {
182260
"prefix": "#region",
183-
"body": ["//#region $0"],
261+
"body": [
262+
"//#region $0"
263+
],
184264
"description": "Folding Region Start"
185265
},
186266
"Region End": {
187267
"prefix": "#endregion",
188-
"body": ["//#endregion"],
268+
"body": [
269+
"//#endregion"
270+
],
189271
"description": "Folding Region End"
190272
}
191273
}

0 commit comments

Comments
 (0)