-
Notifications
You must be signed in to change notification settings - Fork 2
/
typescript.json
240 lines (240 loc) · 5.11 KB
/
typescript.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
{
/*
// Place your snippets for TypeScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"New default class": {
"prefix": "edc",
"body": [
"export default class ${1:ClassName} {",
"\t$2",
"}"
]
},
"New class": {
"prefix": "ec",
"body": [
"export class ${1:ClassName} {",
"\t$2",
"}"
]
},
"New default interface": {
"prefix": "edi",
"body": [
"export default interface ${1:InterfaceName} {",
"\t$2",
"}"
]
},
"New interface": {
"prefix": "ei",
"body": [
"export interface ${1:InterfaceName} {",
"\t$2",
"}"
]
},
"TSRPC Protocol": {
"prefix": "tptl",
"body": [
"import { BaseRequest, BaseResponse, BaseConf } from '../base'",
"",
"export interface Req${1:PtlName} extends BaseRequest {",
"\t$2",
"}",
"",
"export interface Res${1:PtlName} extends BaseResponse {",
"\t$3",
"}",
"",
"export const conf: BaseConf = {\n\t$4\n};"
]
},
"TSRPC API": {
"prefix": "tapi",
"body": [
"import { ApiCall } from \"tsrpc\";\n",
"export async function Api${1:PtlName}(call: ApiCall<Req${1:PtlName}$2, Res${1:PtlName}$3>) {",
"\t$4",
"}"
]
},
"New Test Case": {
"prefix": "testCase",
"body": [
"import * as assert from 'assert';",
"",
"describe('${1:ClassName}', function () {",
"\tit('${2:FunctionName}', function () {",
"\t\t$3",
"\t})",
"})"
]
},
"Import as": {
"prefix": "ias",
"body": "import * as $1 from \"$1\";"
},
"for 0->length": {
"prefix": "f0",
"body": [
"for (let i = 0; i < ${1:arr.length}; ++i){",
"\t$2",
"}"
]
},
"for length->0": {
"prefix": "f-1",
"body": [
"for (let i = ${1:arr.length}; i > -1; --i){",
"\t$2",
"}"
]
},
"Create Array Quickly": {
"prefix": "af",
"body": "Array.from({ length: ${1:100} }, (v, i) => ${2:i})"
},
"Async function": {
"prefix": "asf",
"body": "async function () {\n\t$1\n}$2"
},
"Cocos Property": {
"prefix": "ccp",
"body": [
"@property(${2:cc.Node})",
"${1:VarName}: ${2:cc.Node} = ${3:null as any};"
]
},
"Cocos 3D Property": {
"prefix": "c3p",
"body": [
"@property(${2:Node})",
"${1:VarName}: ${2:Node} = ${3:null as any};"
]
},
"Region": {
"prefix": "#reg",
"body": [
"// #region ${1:RegionName}",
"$2",
"// #endregion"
]
},
"Cocos Component": {
"prefix": "ccc",
"body": [
"const {ccclass, property} = cc._decorator;",
"\n@ccclass",
"export default class ${1:CompName} extends cc.Component {",
"\t$2",
"}"
]
},
"Cocos Option Component": {
"prefix": "coc",
"body": [
"const { ccclass, property } = cc._decorator;",
"",
"export interface $1Options {",
" $2",
"}",
"",
"@ccclass",
"export default class $1 extends cc.Component {",
"",
" private _options!: $1Options;",
" public get options(): $1Options {",
" return this._options;",
" }",
" public set options(v: $1Options) {",
" this._options = v;",
" $3",
" }",
"",
"}"
]
},
"Cocos 3D Component": {
"prefix": "c3c",
"body": [
"import { _decorator, Component, Node } from \"cc\";",
"const {ccclass, property} = _decorator;",
"\n@ccclass",
"export default class ${1:CompName} extends Component {",
"\t$2",
"}"
]
},
"Cocos 3D Option Component": {
"prefix": "c3oc",
"body": [
"import { _decorator, Component, Node } from \"cc\";",
"const { ccclass, property } = _decorator;",
"",
"export interface $1Options {",
" $2",
"}",
"",
"@ccclass",
"export default class $1 extends Component {",
"",
" private _options!: $1Options;",
" public get options(): $1Options {",
" return this._options;",
" }",
" public set options(v: $1Options) {",
" this._options = v;",
" $3",
" }",
"",
"}"
]
},
"Cocos getChildByName": {
"prefix": "gc",
"body": "getChildByName('$1')$2"
},
"Cocos getComponent": {
"prefix": "gp",
"body": "getComponent($1)$2"
},
"Function && Function()": {
"prefix": "faf",
"body": "$1 && $1($2);"
},
"ShowDialog": {
"prefix": "showDialog",
"body": [
"// #region 显示弹框 ${2:XXX}Dialog",
"@property(cc.Prefab)",
"prefab${2:XXX}Dialog: cc.Prefab = null as any;",
"private _cache${2:XXX}Dialog: ${2:XXX}Dialog;",
"private _show${2:XXX}Dialog(options: ${2:XXX}DialogOptions) {",
"\tif (!this._cache${2:XXX}Dialog) {",
"\t\tthis._cache${2:XXX}Dialog = cc.instantiate(this.prefab${2:XXX}Dialog).getComponent(${2:XXX}Dialog);",
"\t}",
"\tthis._cache${2:XXX}Dialog.show(options);",
"}",
"// #endregion"
]
},
"Single line JSDoc comment": {
"prefix": "jd",
"body": [
"/** ${1} */",
]
}
}