790d5636426a372e2aa936b6523ac42d847aca25
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-tsserver / snippets / typescript.json
1 {
2         "Constructor": {
3                 "prefix": "ctor",
4                 "body": [
5                         "constructor() {",
6                         "\tsuper();",
7                         "\t$0",
8                         "}"
9                 ],
10                 "description": "Constructor"
11         },
12         "Class Definition": {
13                 "prefix": "class",
14                 "body": [
15                         "class ${1:name} {",
16                         "\tconstructor(${2:parameters}) {",
17                         "\t\t$0",
18                         "\t}",
19                         "}"
20                 ],
21                 "description": "Class Definition"
22         },
23         "Public Method Definition": {
24                 "prefix": "public method",
25                 "body": [
26                         "public ${1:name}() {",
27                         "\t$0",
28                         "}"
29                 ],
30                 "description": "Public Method Definition"
31         },
32         "Private Method Definition": {
33                 "prefix": "private method",
34                 "body": [
35                         "private ${1:name}() {",
36                         "\t$0",
37                         "}"
38                 ],
39                 "description": "Private Method Definition"
40         },
41         "Import external module.": {
42                 "prefix": "import statement",
43                 "body": [
44                         "import {$0} from '${1:module}'"
45                 ],
46                 "description": "Import external module."
47         },
48         "Property getter": {
49                 "prefix": "get",
50                 "body": [
51                         "public get ${1:value}() : ${2:string} {",
52                         "\t${3:return $0}",
53                         "}"
54                 ],
55                 "description": "Property getter"
56         },
57         "Log to the console": {
58                 "prefix": "log",
59                 "body": [
60                         "console.log($1);",
61                         "$0"
62                 ],
63                 "description": "Log to the console"
64         },
65         "Log warning to console": {
66                 "prefix": "warn",
67                 "body": [
68                         "console.warn($1);",
69                         "$0"
70                 ],
71                 "description": "Log warning to the console"
72         },
73         "Log error to console": {
74                 "prefix": "error",
75                 "body": [
76                         "console.error($1);",
77                         "$0"
78                 ],
79                 "description": "Log error to the console"
80         },
81         "Define a full property": {
82                 "prefix": "prop",
83                 "body": [
84                         "",
85                         "private _${1:value} : ${2:string};",
86                         "public get ${1:value}() : ${2:string} {",
87                         "\treturn this._${1:value};",
88                         "}",
89                         "public set ${1:value}(v : ${2:string}) {",
90                         "\tthis._${1:value} = v;",
91                         "}",
92                         ""
93                 ],
94                 "description": "Define a full property"
95         },
96         "Triple-slash reference": {
97                 "prefix": "ref",
98                 "body": [
99                         "/// <reference path=\"$1\" />",
100                         "$0"
101                 ],
102                 "description": "Triple-slash reference"
103         },
104         "Property setter": {
105                 "prefix": "set",
106                 "body": [
107                         "",
108                         "public set ${1:value}(v : ${2:string}) {",
109                         "\tthis.$3 = v;",
110                         "}",
111                         ""
112                 ],
113                 "description": "Property setter"
114         },
115         "Throw Exception": {
116                 "prefix": "throw",
117                 "body": [
118                         "throw \"$1\";",
119                         "$0"
120                 ],
121                 "description": "Throw Exception"
122         },
123         "For Loop": {
124                 "prefix": "for",
125                 "body": [
126                         "for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
127                         "\tconst ${3:element} = ${2:array}[${1:index}];",
128                         "\t$0",
129                         "}"
130                 ],
131                 "description": "For Loop"
132         },
133         "For-Each Loop using =>": {
134                 "prefix": "foreach =>",
135                 "body": [
136                         "${1:array}.forEach(${2:element} => {",
137                         "\t$0",
138                         "});"
139                 ],
140                 "description": "For-Each Loop using =>"
141         },
142         "For-In Loop": {
143                 "prefix": "forin",
144                 "body": [
145                         "for (const ${1:key} in ${2:object}) {",
146                         "\tif (${2:object}.hasOwnProperty(${1:key})) {",
147                         "\t\tconst ${3:element} = ${2:object}[${1:key}];",
148                         "\t\t$0",
149                         "\t}",
150                         "}"
151                 ],
152                 "description": "For-In Loop"
153         },
154         "For-Of Loop": {
155                 "prefix": "forof",
156                 "body": [
157                         "for (const ${1:iterator} of ${2:object}) {",
158                         "\t$0",
159                         "}"
160                 ],
161                 "description": "For-Of Loop"
162         },
163         "Function Statement": {
164                 "prefix": "function",
165                 "body": [
166                         "function ${1:name}(${2:params}:${3:type}) {",
167                         "\t$0",
168                         "}"
169                 ],
170                 "description": "Function Statement"
171         },
172         "If Statement": {
173                 "prefix": "if",
174                 "body": [
175                         "if (${1:condition}) {",
176                         "\t$0",
177                         "}"
178                 ],
179                 "description": "If Statement"
180         },
181         "If-Else Statement": {
182                 "prefix": "ifelse",
183                 "body": [
184                         "if (${1:condition}) {",
185                         "\t$0",
186                         "} else {",
187                         "\t",
188                         "}"
189                 ],
190                 "description": "If-Else Statement"
191         },
192         "New Statement": {
193                 "prefix": "new",
194                 "body": [
195                         "const ${1:name} = new ${2:type}(${3:arguments});$0"
196                 ],
197                 "description": "New Statement"
198         },
199         "Switch Statement": {
200                 "prefix": "switch",
201                 "body": [
202                         "switch (${1:key}) {",
203                         "\tcase ${2:value}:",
204                         "\t\t$0",
205                         "\t\tbreak;",
206                         "",
207                         "\tdefault:",
208                         "\t\tbreak;",
209                         "}"
210                 ],
211                 "description": "Switch Statement"
212         },
213         "While Statement": {
214                 "prefix": "while",
215                 "body": [
216                         "while (${1:condition}) {",
217                         "\t$0",
218                         "}"
219                 ],
220                 "description": "While Statement"
221         },
222         "Do-While Statement": {
223                 "prefix": "dowhile",
224                 "body": [
225                         "do {",
226                         "\t$0",
227                         "} while (${1:condition});"
228                 ],
229                 "description": "Do-While Statement"
230         },
231         "Try-Catch Statement": {
232                 "prefix": "trycatch",
233                 "body": [
234                         "try {",
235                         "\t$0",
236                         "} catch (${1:error}) {",
237                         "\t",
238                         "}"
239                 ],
240                 "description": "Try-Catch Statement"
241         },
242         "Set Timeout Function": {
243                 "prefix": "settimeout",
244                 "body": [
245                         "setTimeout(() => {",
246                         "\t$0",
247                         "}, ${1:timeout});"
248                 ],
249                 "description": "Set Timeout Function"
250         },
251         "Region Start": {
252                 "prefix": "#region",
253                 "body": [
254                         "//#region $0"
255                 ],
256                 "description": "Folding Region Start"
257         },
258         "Region End": {
259                 "prefix": "#endregion",
260                 "body": [
261                         "//#endregion"
262                 ],
263                 "description": "Folding Region End"
264         }
265 }