@codingame/monaco-vscode-typescript-basics-default-extension 1.81.8-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TypeScript.tmLanguage.json +5740 -0
- package/TypeScriptReact.tmLanguage.json +5989 -0
- package/index.js +11 -0
- package/jsdoc.js.injection.tmLanguage.json +21 -0
- package/jsdoc.ts.injection.tmLanguage.json +21 -0
- package/language-configuration.json +220 -0
- package/package.json +22 -0
- package/typescript.code-snippets +310 -0
package/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { registerExtension } from 'vscode/extensions';
|
|
2
|
+
|
|
3
|
+
var manifest = {name:"typescript",description:"Provides snippets, syntax highlighting, bracket matching and folding in TypeScript files.",displayName:"TypeScript Language Basics",version:"1.0.0",author:"vscode",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.mjs"},contributes:{languages:[{id:"typescript",aliases:["TypeScript","ts","typescript"],extensions:[".ts",".cts",".mts"],configuration:"./language-configuration.json"},{id:"typescriptreact",aliases:["TypeScript JSX","TypeScript React","tsx"],extensions:[".tsx"],configuration:"./language-configuration.json"},{id:"jsonc",filenames:["tsconfig.json","jsconfig.json"],filenamePatterns:["tsconfig.*.json","jsconfig.*.json","tsconfig-*.json","jsconfig-*.json"]},{id:"json",filenames:["tsconfig.tsbuildinfo"]}],grammars:[{language:"typescript",scopeName:"source.ts",path:"./syntaxes/TypeScript.tmLanguage.json",unbalancedBracketScopes:["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","meta.brace.angle","punctuation.definition.tag","keyword.operator.assignment.compound.bitwise.ts"],tokenTypes:{"meta.template.expression":"other","meta.template.expression string":"string","meta.template.expression comment":"comment","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{language:"typescriptreact",scopeName:"source.tsx",path:"./syntaxes/TypeScriptReact.tmLanguage.json",unbalancedBracketScopes:["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","punctuation.definition.tag","keyword.operator.assignment.compound.bitwise.ts"],embeddedLanguages:{"meta.tag.tsx":"jsx-tags","meta.tag.without-attributes.tsx":"jsx-tags","meta.tag.attributes.tsx":"typescriptreact","meta.embedded.expression.tsx":"typescriptreact"},tokenTypes:{"meta.template.expression":"other","meta.template.expression string":"string","meta.template.expression comment":"comment","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{scopeName:"documentation.injection.ts",path:"./syntaxes/jsdoc.ts.injection.tmLanguage.json",injectTo:["source.ts","source.tsx"]},{scopeName:"documentation.injection.js.jsx",path:"./syntaxes/jsdoc.js.injection.tmLanguage.json",injectTo:["source.js","source.js.jsx"]}],semanticTokenScopes:[{language:"typescript",scopes:{property:["variable.other.property.ts"],"property.readonly":["variable.other.constant.property.ts"],variable:["variable.other.readwrite.ts"],"variable.readonly":["variable.other.constant.object.ts"],"function":["entity.name.function.ts"],namespace:["entity.name.type.module.ts"],"variable.defaultLibrary":["support.variable.ts"],"function.defaultLibrary":["support.function.ts"]}},{language:"typescriptreact",scopes:{property:["variable.other.property.tsx"],"property.readonly":["variable.other.constant.property.tsx"],variable:["variable.other.readwrite.tsx"],"variable.readonly":["variable.other.constant.object.tsx"],"function":["entity.name.function.tsx"],namespace:["entity.name.type.module.tsx"],"variable.defaultLibrary":["support.variable.tsx"],"function.defaultLibrary":["support.function.tsx"]}}],snippets:[{language:"typescript",path:"./snippets/typescript.code-snippets"},{language:"typescriptreact",path:"./snippets/typescript.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"},main:undefined};
|
|
4
|
+
|
|
5
|
+
const { registerFileUrl } = registerExtension(manifest);
|
|
6
|
+
registerFileUrl('./syntaxes/TypeScript.tmLanguage.json', new URL('./TypeScript.tmLanguage.json', import.meta.url).toString(), 'application/json');
|
|
7
|
+
registerFileUrl('./syntaxes/TypeScriptReact.tmLanguage.json', new URL('./TypeScriptReact.tmLanguage.json', import.meta.url).toString(), 'application/json');
|
|
8
|
+
registerFileUrl('./syntaxes/jsdoc.ts.injection.tmLanguage.json', new URL('./jsdoc.ts.injection.tmLanguage.json', import.meta.url).toString(), 'application/json');
|
|
9
|
+
registerFileUrl('./syntaxes/jsdoc.js.injection.tmLanguage.json', new URL('./jsdoc.js.injection.tmLanguage.json', import.meta.url).toString(), 'application/json');
|
|
10
|
+
registerFileUrl('./language-configuration.json', new URL('./language-configuration.json', import.meta.url).toString(), 'application/json');
|
|
11
|
+
registerFileUrl('./snippets/typescript.code-snippets', new URL('./typescript.code-snippets', import.meta.url).toString(), 'application/json');
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
{
|
|
3
|
+
"injectionSelector": "L:comment.block.documentation",
|
|
4
|
+
"patterns": [
|
|
5
|
+
{
|
|
6
|
+
"include": "#jsdocbody"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"jsdocbody": {
|
|
11
|
+
"begin": "(?<=/\\*\\*)([^*]|\\*(?!/))*$",
|
|
12
|
+
"while": "(^|\\G)\\s*\\*(?!/)(?=([^*]|[*](?!/))*$)",
|
|
13
|
+
"patterns": [
|
|
14
|
+
{
|
|
15
|
+
"include": "source.ts#docblock"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scopeName": "documentation.injection.js.jsx"
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
{
|
|
3
|
+
"injectionSelector": "L:comment.block.documentation",
|
|
4
|
+
"patterns": [
|
|
5
|
+
{
|
|
6
|
+
"include": "#jsdocbody"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"jsdocbody": {
|
|
11
|
+
"begin": "(?<=/\\*\\*)([^*]|\\*(?!/))*$",
|
|
12
|
+
"while": "(^|\\G)\\s*\\*(?!/)(?=([^*]|[*](?!/))*$)",
|
|
13
|
+
"patterns": [
|
|
14
|
+
{
|
|
15
|
+
"include": "source.ts#docblock"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scopeName": "documentation.injection.ts"
|
|
21
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Note that this file should stay in sync with 'javascript-language-basics/javascript-language-configuration.json'
|
|
3
|
+
"comments": {
|
|
4
|
+
"lineComment": "//",
|
|
5
|
+
"blockComment": [
|
|
6
|
+
"/*",
|
|
7
|
+
"*/"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"brackets": [
|
|
11
|
+
[
|
|
12
|
+
"${",
|
|
13
|
+
"}"
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
"{",
|
|
17
|
+
"}"
|
|
18
|
+
],
|
|
19
|
+
[
|
|
20
|
+
"[",
|
|
21
|
+
"]"
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
"(",
|
|
25
|
+
")"
|
|
26
|
+
]
|
|
27
|
+
],
|
|
28
|
+
"autoClosingPairs": [
|
|
29
|
+
{
|
|
30
|
+
"open": "{",
|
|
31
|
+
"close": "}"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"open": "[",
|
|
35
|
+
"close": "]"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"open": "(",
|
|
39
|
+
"close": ")"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"open": "'",
|
|
43
|
+
"close": "'",
|
|
44
|
+
"notIn": [
|
|
45
|
+
"string",
|
|
46
|
+
"comment"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"open": "\"",
|
|
51
|
+
"close": "\"",
|
|
52
|
+
"notIn": [
|
|
53
|
+
"string"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"open": "`",
|
|
58
|
+
"close": "`",
|
|
59
|
+
"notIn": [
|
|
60
|
+
"string",
|
|
61
|
+
"comment"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"open": "/**",
|
|
66
|
+
"close": " */",
|
|
67
|
+
"notIn": [
|
|
68
|
+
"string"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"surroundingPairs": [
|
|
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
|
+
"colorizedBracketPairs": [
|
|
103
|
+
[
|
|
104
|
+
"(",
|
|
105
|
+
")"
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"[",
|
|
109
|
+
"]"
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"{",
|
|
113
|
+
"}"
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
"<",
|
|
117
|
+
">"
|
|
118
|
+
]
|
|
119
|
+
],
|
|
120
|
+
"autoCloseBefore": ";:.,=}])>` \n\t",
|
|
121
|
+
"folding": {
|
|
122
|
+
"markers": {
|
|
123
|
+
"start": "^\\s*//\\s*#?region\\b",
|
|
124
|
+
"end": "^\\s*//\\s*#?endregion\\b"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"wordPattern": {
|
|
128
|
+
"pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\@\\~\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)",
|
|
129
|
+
},
|
|
130
|
+
"indentationRules": {
|
|
131
|
+
"decreaseIndentPattern": {
|
|
132
|
+
"pattern": "^((?!.*?/\\*).*\\*\/)?\\s*[\\}\\]].*$"
|
|
133
|
+
},
|
|
134
|
+
"increaseIndentPattern": {
|
|
135
|
+
"pattern": "^((?!//).)*(\\{([^}\"'`/]*|(\\t|[ ])*//.*)|\\([^)\"'`/]*|\\[[^\\]\"'`/]*)$"
|
|
136
|
+
},
|
|
137
|
+
// e.g. * ...| or */| or *-----*/|
|
|
138
|
+
"unIndentedLinePattern": {
|
|
139
|
+
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"onEnterRules": [
|
|
143
|
+
{
|
|
144
|
+
// e.g. /** | */
|
|
145
|
+
"beforeText": {
|
|
146
|
+
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
|
|
147
|
+
},
|
|
148
|
+
"afterText": {
|
|
149
|
+
"pattern": "^\\s*\\*/$"
|
|
150
|
+
},
|
|
151
|
+
"action": {
|
|
152
|
+
"indent": "indentOutdent",
|
|
153
|
+
"appendText": " * "
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
// e.g. /** ...|
|
|
158
|
+
"beforeText": {
|
|
159
|
+
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
|
|
160
|
+
},
|
|
161
|
+
"action": {
|
|
162
|
+
"indent": "none",
|
|
163
|
+
"appendText": " * "
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
// e.g. * ...|
|
|
168
|
+
"beforeText": {
|
|
169
|
+
"pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
|
|
170
|
+
},
|
|
171
|
+
"previousLineText": {
|
|
172
|
+
"pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))"
|
|
173
|
+
},
|
|
174
|
+
"action": {
|
|
175
|
+
"indent": "none",
|
|
176
|
+
"appendText": "* "
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
// e.g. */|
|
|
181
|
+
"beforeText": {
|
|
182
|
+
"pattern": "^(\\t|[ ])*[ ]\\*/\\s*$"
|
|
183
|
+
},
|
|
184
|
+
"action": {
|
|
185
|
+
"indent": "none",
|
|
186
|
+
"removeText": 1
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
// e.g. *-----*/|
|
|
191
|
+
"beforeText": {
|
|
192
|
+
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$"
|
|
193
|
+
},
|
|
194
|
+
"action": {
|
|
195
|
+
"indent": "none",
|
|
196
|
+
"removeText": 1
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"beforeText": {
|
|
201
|
+
"pattern": "^\\s*(\\bcase\\s.+:|\\bdefault:)$"
|
|
202
|
+
},
|
|
203
|
+
"afterText": {
|
|
204
|
+
"pattern": "^(?!\\s*(\\bcase\\b|\\bdefault\\b))"
|
|
205
|
+
},
|
|
206
|
+
"action": {
|
|
207
|
+
"indent": "indent"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
// Decrease indentation after single line if/else if/else, for, or while
|
|
212
|
+
"previousLineText": "^\\s*(((else ?)?if|for|while)\\s*\\(.*\\)\\s*|else\\s*)$",
|
|
213
|
+
// But make sure line doesn't have braces or is not another if statement
|
|
214
|
+
"beforeText": "^\\s+([^{i\\s]|i(?!f\\b))",
|
|
215
|
+
"action": {
|
|
216
|
+
"indent": "outdent"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codingame/monaco-vscode-typescript-basics-default-extension",
|
|
3
|
+
"version": "1.81.8-next.1",
|
|
4
|
+
"keywords": [],
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "CodinGame",
|
|
7
|
+
"url": "http://www.codingame.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/CodinGame/monaco-vscode-api"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"private": false,
|
|
16
|
+
"description": "Default VSCode extension designed to be used with @codingame/monaco-vscode-api",
|
|
17
|
+
"main": "index.js",
|
|
18
|
+
"module": "index.js",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.81.8-next.1"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Constructor": {
|
|
3
|
+
"prefix": "ctor",
|
|
4
|
+
"body": [
|
|
5
|
+
"/**",
|
|
6
|
+
" *",
|
|
7
|
+
" */",
|
|
8
|
+
"constructor() {",
|
|
9
|
+
"\tsuper();",
|
|
10
|
+
"\t$0",
|
|
11
|
+
"}"
|
|
12
|
+
],
|
|
13
|
+
"description": "Constructor"
|
|
14
|
+
},
|
|
15
|
+
"Class Definition": {
|
|
16
|
+
"prefix": "class",
|
|
17
|
+
"isFileTemplate": true,
|
|
18
|
+
"body": [
|
|
19
|
+
"class ${1:name} {",
|
|
20
|
+
"\tconstructor(${2:parameters}) {",
|
|
21
|
+
"\t\t$0",
|
|
22
|
+
"\t}",
|
|
23
|
+
"}"
|
|
24
|
+
],
|
|
25
|
+
"description": "Class Definition"
|
|
26
|
+
},
|
|
27
|
+
"Public Method Definition": {
|
|
28
|
+
"prefix": "public method",
|
|
29
|
+
"body": [
|
|
30
|
+
"/**",
|
|
31
|
+
" * ${1:name}",
|
|
32
|
+
" */",
|
|
33
|
+
"public ${1:name}() {",
|
|
34
|
+
"\t$0",
|
|
35
|
+
"}"
|
|
36
|
+
],
|
|
37
|
+
"description": "Public Method Definition"
|
|
38
|
+
},
|
|
39
|
+
"Private Method Definition": {
|
|
40
|
+
"prefix": "private method",
|
|
41
|
+
"body": [
|
|
42
|
+
"private ${1:name}() {",
|
|
43
|
+
"\t$0",
|
|
44
|
+
"}"
|
|
45
|
+
],
|
|
46
|
+
"description": "Private Method Definition"
|
|
47
|
+
},
|
|
48
|
+
"Import Statement": {
|
|
49
|
+
"prefix": "import",
|
|
50
|
+
"body": [
|
|
51
|
+
"import { $0 } from \"${1:module}\";"
|
|
52
|
+
],
|
|
53
|
+
"description": "Import external module"
|
|
54
|
+
},
|
|
55
|
+
"Property getter": {
|
|
56
|
+
"prefix": "get",
|
|
57
|
+
"body": [
|
|
58
|
+
"",
|
|
59
|
+
"public get ${1:value}() : ${2:string} {",
|
|
60
|
+
"\t${3:return $0}",
|
|
61
|
+
"}",
|
|
62
|
+
""
|
|
63
|
+
],
|
|
64
|
+
"description": "Property getter"
|
|
65
|
+
},
|
|
66
|
+
"Log to the console": {
|
|
67
|
+
"prefix": "log",
|
|
68
|
+
"body": [
|
|
69
|
+
"console.log($1);",
|
|
70
|
+
"$0"
|
|
71
|
+
],
|
|
72
|
+
"description": "Log to the console"
|
|
73
|
+
},
|
|
74
|
+
"Log warning to console": {
|
|
75
|
+
"prefix": "warn",
|
|
76
|
+
"body": [
|
|
77
|
+
"console.warn($1);",
|
|
78
|
+
"$0"
|
|
79
|
+
],
|
|
80
|
+
"description": "Log warning to the console"
|
|
81
|
+
},
|
|
82
|
+
"Log error to console": {
|
|
83
|
+
"prefix": "error",
|
|
84
|
+
"body": [
|
|
85
|
+
"console.error($1);",
|
|
86
|
+
"$0"
|
|
87
|
+
],
|
|
88
|
+
"description": "Log error to the console"
|
|
89
|
+
},
|
|
90
|
+
"Define a full property": {
|
|
91
|
+
"prefix": "prop",
|
|
92
|
+
"body": [
|
|
93
|
+
"",
|
|
94
|
+
"private _${1:value} : ${2:string};",
|
|
95
|
+
"public get ${1:value}() : ${2:string} {",
|
|
96
|
+
"\treturn this._${1:value};",
|
|
97
|
+
"}",
|
|
98
|
+
"public set ${1:value}(v : ${2:string}) {",
|
|
99
|
+
"\tthis._${1:value} = v;",
|
|
100
|
+
"}",
|
|
101
|
+
""
|
|
102
|
+
],
|
|
103
|
+
"description": "Define a full property"
|
|
104
|
+
},
|
|
105
|
+
"Triple-slash reference": {
|
|
106
|
+
"prefix": "ref",
|
|
107
|
+
"body": [
|
|
108
|
+
"/// <reference path=\"$1\" />",
|
|
109
|
+
"$0"
|
|
110
|
+
],
|
|
111
|
+
"description": "Triple-slash reference"
|
|
112
|
+
},
|
|
113
|
+
"Property setter": {
|
|
114
|
+
"prefix": "set",
|
|
115
|
+
"body": [
|
|
116
|
+
"",
|
|
117
|
+
"public set ${1:value}(v : ${2:string}) {",
|
|
118
|
+
"\tthis.$3 = v;",
|
|
119
|
+
"}",
|
|
120
|
+
""
|
|
121
|
+
],
|
|
122
|
+
"description": "Property setter"
|
|
123
|
+
},
|
|
124
|
+
"Throw Exception": {
|
|
125
|
+
"prefix": "throw",
|
|
126
|
+
"body": [
|
|
127
|
+
"throw new Error(\"$1\");",
|
|
128
|
+
"$0"
|
|
129
|
+
],
|
|
130
|
+
"description": "Throw Exception"
|
|
131
|
+
},
|
|
132
|
+
"For Loop": {
|
|
133
|
+
"prefix": "for",
|
|
134
|
+
"body": [
|
|
135
|
+
"for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
|
|
136
|
+
"\tconst ${3:element} = ${2:array}[${1:index}];",
|
|
137
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
138
|
+
"}"
|
|
139
|
+
],
|
|
140
|
+
"description": "For Loop"
|
|
141
|
+
},
|
|
142
|
+
"For-Each Loop using =>": {
|
|
143
|
+
"prefix": "foreach =>",
|
|
144
|
+
"body": [
|
|
145
|
+
"${1:array}.forEach(${2:element} => {",
|
|
146
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
147
|
+
"});"
|
|
148
|
+
],
|
|
149
|
+
"description": "For-Each Loop using =>"
|
|
150
|
+
},
|
|
151
|
+
"For-In Loop": {
|
|
152
|
+
"prefix": "forin",
|
|
153
|
+
"body": [
|
|
154
|
+
"for (const ${1:key} in ${2:object}) {",
|
|
155
|
+
"\tif (Object.prototype.hasOwnProperty.call(${2:object}, ${1:key})) {",
|
|
156
|
+
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
|
|
157
|
+
"\t\t$TM_SELECTED_TEXT$0",
|
|
158
|
+
"\t}",
|
|
159
|
+
"}"
|
|
160
|
+
],
|
|
161
|
+
"description": "For-In Loop"
|
|
162
|
+
},
|
|
163
|
+
"For-Of Loop": {
|
|
164
|
+
"prefix": "forof",
|
|
165
|
+
"body": [
|
|
166
|
+
"for (const ${1:iterator} of ${2:object}) {",
|
|
167
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
168
|
+
"}"
|
|
169
|
+
],
|
|
170
|
+
"description": "For-Of Loop"
|
|
171
|
+
},
|
|
172
|
+
"For-Await-Of Loop": {
|
|
173
|
+
"prefix": "forawaitof",
|
|
174
|
+
"body": [
|
|
175
|
+
"for await (const ${1:iterator} of ${2:object}) {",
|
|
176
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
177
|
+
"}"
|
|
178
|
+
],
|
|
179
|
+
"description": "For-Await-Of Loop"
|
|
180
|
+
},
|
|
181
|
+
"Function Statement": {
|
|
182
|
+
"prefix": "function",
|
|
183
|
+
"body": [
|
|
184
|
+
"function ${1:name}(${2:params}:${3:type}) {",
|
|
185
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
186
|
+
"}"
|
|
187
|
+
],
|
|
188
|
+
"description": "Function Statement"
|
|
189
|
+
},
|
|
190
|
+
"If Statement": {
|
|
191
|
+
"prefix": "if",
|
|
192
|
+
"body": [
|
|
193
|
+
"if (${1:condition}) {",
|
|
194
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
195
|
+
"}"
|
|
196
|
+
],
|
|
197
|
+
"description": "If Statement"
|
|
198
|
+
},
|
|
199
|
+
"If-Else Statement": {
|
|
200
|
+
"prefix": "ifelse",
|
|
201
|
+
"body": [
|
|
202
|
+
"if (${1:condition}) {",
|
|
203
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
204
|
+
"} else {",
|
|
205
|
+
"\t",
|
|
206
|
+
"}"
|
|
207
|
+
],
|
|
208
|
+
"description": "If-Else Statement"
|
|
209
|
+
},
|
|
210
|
+
"New Statement": {
|
|
211
|
+
"prefix": "new",
|
|
212
|
+
"body": [
|
|
213
|
+
"const ${1:name} = new ${2:type}(${3:arguments});$0"
|
|
214
|
+
],
|
|
215
|
+
"description": "New Statement"
|
|
216
|
+
},
|
|
217
|
+
"Switch Statement": {
|
|
218
|
+
"prefix": "switch",
|
|
219
|
+
"body": [
|
|
220
|
+
"switch (${1:key}) {",
|
|
221
|
+
"\tcase ${2:value}:",
|
|
222
|
+
"\t\t$0",
|
|
223
|
+
"\t\tbreak;",
|
|
224
|
+
"",
|
|
225
|
+
"\tdefault:",
|
|
226
|
+
"\t\tbreak;",
|
|
227
|
+
"}"
|
|
228
|
+
],
|
|
229
|
+
"description": "Switch Statement"
|
|
230
|
+
},
|
|
231
|
+
"While Statement": {
|
|
232
|
+
"prefix": "while",
|
|
233
|
+
"body": [
|
|
234
|
+
"while (${1:condition}) {",
|
|
235
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
236
|
+
"}"
|
|
237
|
+
],
|
|
238
|
+
"description": "While Statement"
|
|
239
|
+
},
|
|
240
|
+
"Do-While Statement": {
|
|
241
|
+
"prefix": "dowhile",
|
|
242
|
+
"body": [
|
|
243
|
+
"do {",
|
|
244
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
245
|
+
"} while (${1:condition});"
|
|
246
|
+
],
|
|
247
|
+
"description": "Do-While Statement"
|
|
248
|
+
},
|
|
249
|
+
"Try-Catch Statement": {
|
|
250
|
+
"prefix": "trycatch",
|
|
251
|
+
"body": [
|
|
252
|
+
"try {",
|
|
253
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
254
|
+
"} catch (${1:error}) {",
|
|
255
|
+
"\t",
|
|
256
|
+
"}"
|
|
257
|
+
],
|
|
258
|
+
"description": "Try-Catch Statement"
|
|
259
|
+
},
|
|
260
|
+
"Set Timeout Function": {
|
|
261
|
+
"prefix": "settimeout",
|
|
262
|
+
"body": [
|
|
263
|
+
"setTimeout(() => {",
|
|
264
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
265
|
+
"}, ${1:timeout});"
|
|
266
|
+
],
|
|
267
|
+
"description": "Set Timeout Function"
|
|
268
|
+
},
|
|
269
|
+
"Region Start": {
|
|
270
|
+
"prefix": "#region",
|
|
271
|
+
"body": [
|
|
272
|
+
"//#region $0"
|
|
273
|
+
],
|
|
274
|
+
"description": "Folding Region Start"
|
|
275
|
+
},
|
|
276
|
+
"Region End": {
|
|
277
|
+
"prefix": "#endregion",
|
|
278
|
+
"body": [
|
|
279
|
+
"//#endregion"
|
|
280
|
+
],
|
|
281
|
+
"description": "Folding Region End"
|
|
282
|
+
},
|
|
283
|
+
"new Promise": {
|
|
284
|
+
"prefix": "newpromise",
|
|
285
|
+
"body": [
|
|
286
|
+
"new Promise<${1:void}>((resolve, reject) => {",
|
|
287
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
288
|
+
"})"
|
|
289
|
+
],
|
|
290
|
+
"description": "Create a new Promise"
|
|
291
|
+
},
|
|
292
|
+
"Async Function Statement": {
|
|
293
|
+
"prefix": "async function",
|
|
294
|
+
"body": [
|
|
295
|
+
"async function ${1:name}(${2:params}:${3:type}) {",
|
|
296
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
297
|
+
"}"
|
|
298
|
+
],
|
|
299
|
+
"description": "Async Function Statement"
|
|
300
|
+
},
|
|
301
|
+
"Async Function Expression": {
|
|
302
|
+
"prefix": "async arrow function",
|
|
303
|
+
"body": [
|
|
304
|
+
"async (${1:params}:${2:type}) => {",
|
|
305
|
+
"\t$TM_SELECTED_TEXT$0",
|
|
306
|
+
"}"
|
|
307
|
+
],
|
|
308
|
+
"description": "Async Function Expression"
|
|
309
|
+
}
|
|
310
|
+
}
|