Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/javascript/javascript-language-configuration.json
3311 views
1
{
2
// Note that this file should stay in sync with 'typescript-language-basics/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
"autoCloseBefore": ";:.,=}])>` \n\t",
103
"folding": {
104
"markers": {
105
"start": "^\\s*//\\s*#?region\\b",
106
"end": "^\\s*//\\s*#?endregion\\b"
107
}
108
},
109
"wordPattern": {
110
"pattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\@\\!\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>/\\?\\s]+)",
111
},
112
"indentationRules": {
113
"decreaseIndentPattern": {
114
"pattern": "^\\s*[\\}\\]\\)].*$"
115
},
116
"increaseIndentPattern": {
117
"pattern": "^.*(\\{[^}]*|\\([^)]*|\\[[^\\]]*)$"
118
},
119
// e.g. * ...| or */| or *-----*/|
120
"unIndentedLinePattern": {
121
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
122
},
123
"indentNextLinePattern": {
124
"pattern": "^((.*=>\\s*)|((.*[^\\w]+|\\s*)((if|while|for)\\s*\\(.*\\)\\s*|else\\s*)))$"
125
}
126
},
127
"onEnterRules": [
128
{
129
// e.g. /** | */
130
"beforeText": {
131
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
132
},
133
"afterText": {
134
"pattern": "^\\s*\\*/$"
135
},
136
"action": {
137
"indent": "indentOutdent",
138
"appendText": " * "
139
}
140
},
141
{
142
// e.g. /** ...|
143
"beforeText": {
144
"pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$"
145
},
146
"action": {
147
"indent": "none",
148
"appendText": " * "
149
}
150
},
151
{
152
// e.g. * ...|
153
"beforeText": {
154
"pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
155
},
156
"previousLineText": {
157
"pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))"
158
},
159
"action": {
160
"indent": "none",
161
"appendText": "* "
162
}
163
},
164
{
165
// e.g. */|
166
"beforeText": {
167
"pattern": "^(\\t|[ ])*[ ]\\*/\\s*$"
168
},
169
"action": {
170
"indent": "none",
171
"removeText": 1
172
},
173
},
174
{
175
// e.g. *-----*/|
176
"beforeText": {
177
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$"
178
},
179
"action": {
180
"indent": "none",
181
"removeText": 1
182
},
183
},
184
{
185
"beforeText": {
186
"pattern": "^\\s*(\\bcase\\s.+:|\\bdefault:)$"
187
},
188
"afterText": {
189
"pattern": "^(?!\\s*(\\bcase\\b|\\bdefault\\b))"
190
},
191
"action": {
192
"indent": "indent"
193
}
194
},
195
{
196
// Decrease indentation after single line if/else if/else, for, or while
197
"previousLineText": "^\\s*(((else ?)?if|for|while)\\s*\\(.*\\)\\s*|else\\s*)$",
198
// But make sure line doesn't have braces or is not another if statement
199
"beforeText": "^\\s+([^{i\\s]|i(?!f\\b))",
200
"action": {
201
"indent": "outdent"
202
}
203
},
204
// Indent when pressing enter from inside ()
205
{
206
"beforeText": "^.*\\([^\\)]*$",
207
"afterText": "^\\s*\\).*$",
208
"action": {
209
"indent": "indentOutdent",
210
"appendText": "\t",
211
}
212
},
213
// Indent when pressing enter from inside {}
214
{
215
"beforeText": "^.*\\{[^\\}]*$",
216
"afterText": "^\\s*\\}.*$",
217
"action": {
218
"indent": "indentOutdent",
219
"appendText": "\t",
220
}
221
},
222
// Indent when pressing enter from inside []
223
{
224
"beforeText": "^.*\\[[^\\]]*$",
225
"afterText": "^\\s*\\].*$",
226
"action": {
227
"indent": "indentOutdent",
228
"appendText": "\t",
229
}
230
},
231
// Add // when pressing enter from inside line comment
232
{
233
"beforeText": "(?<!\\\\|\\w:)\/\/\\s*\\S",
234
"afterText": "^(?!\\s*$).+",
235
"action": {
236
"indent": "none",
237
"appendText": "// "
238
}
239
},
240
]
241
}
242
243