|
20 | 20 | 'name': 'JavaScript'
|
21 | 21 | 'patterns': [
|
22 | 22 | {
|
23 |
| - 'comment': 'ES6 import' |
| 23 | + # ES6 import |
24 | 24 | 'begin': '(?<!\\.)\\b(import)(?!\\s*:)\\b'
|
25 | 25 | 'beginCaptures':
|
26 | 26 | '1':
|
27 | 27 | 'name': 'keyword.control.js'
|
| 28 | + 'end': '(?=;|$)' |
| 29 | + 'name': 'meta.import.js' |
28 | 30 | 'patterns': [
|
29 | 31 | {
|
30 |
| - 'comment': '{ member1 , member2 as alias2 , [...] }' |
| 32 | + # { member1 , member2 as alias2 , [...] } |
31 | 33 | 'begin': '\\{'
|
32 | 34 | 'beginCaptures':
|
33 | 35 | 0:
|
|
38 | 40 | 'name': 'punctuation.definition.modules.end.js'
|
39 | 41 | 'patterns': [
|
40 | 42 | {
|
41 |
| - 'comment': '(default|name) as alias' |
| 43 | + # (default|name) as alias |
| 44 | + 'match': '''(?x) |
| 45 | + (?: \\b(default)\\b | \\b([a-zA-Z_$][\\w$]*)\\b) |
| 46 | + \\s* |
| 47 | + (\\b as \\b) |
| 48 | + \\s* |
| 49 | + (?: (\\b default \\b | \\*) | \\b([a-zA-Z_$][\\w$]*)\\b) |
| 50 | + ''' |
42 | 51 | 'captures':
|
43 | 52 | '1':
|
44 | 53 | 'name': 'variable.language.default.js'
|
|
50 | 59 | 'name': 'invalid.illegal.js'
|
51 | 60 | '5':
|
52 | 61 | 'name': 'variable.other.module-alias.js'
|
53 |
| - 'match': '''(?x) |
54 |
| - (?: \\b(default)\\b | \\b([a-zA-Z_$][\\w$]*)\\b) |
55 |
| - \\s* |
56 |
| - (\\b as \\b) |
57 |
| - \\s* |
58 |
| - (?: (\\b default \\b | \\*) | \\b([a-zA-Z_$][\\w$]*)\\b) |
59 |
| - ''' |
60 | 62 | }
|
61 | 63 | {
|
62 | 64 | 'match': ','
|
|
72 | 74 | ]
|
73 | 75 | }
|
74 | 76 | {
|
75 |
| - 'comment': '(default|*|name) as alias' |
| 77 | + # (default|*|name) as alias |
| 78 | + 'match': '''(?x) |
| 79 | + (?: \\b(default)\\b | (\\*) | \\b([a-zA-Z_$][\\w$]*)\\b) |
| 80 | + \\s* |
| 81 | + (\\b as \\b) |
| 82 | + \\s* |
| 83 | + (?: (\\b default \\b | \\*) | \\b([a-zA-Z_$][\\w$]*)\\b) |
| 84 | + ''' |
76 | 85 | 'captures':
|
77 | 86 | '1':
|
78 | 87 | 'name': 'variable.language.default.js'
|
|
86 | 95 | 'name': 'invalid.illegal.js'
|
87 | 96 | '6':
|
88 | 97 | 'name': 'variable.other.module-alias.js'
|
89 |
| - 'match': '''(?x) |
90 |
| - (?: \\b(default)\\b | (\\*) | \\b([a-zA-Z_$][\\w$]*)\\b) |
91 |
| - \\s* |
92 |
| - (\\b as \\b) |
93 |
| - \\s* |
94 |
| - (?: (\\b default \\b | \\*) | \\b([a-zA-Z_$][\\w$]*)\\b) |
95 |
| - ''' |
96 | 98 | }
|
97 | 99 | {
|
98 | 100 | 'match': '\\*'
|
|
121 | 123 | 'name': 'meta.delimiter.object.comma.js'
|
122 | 124 | }
|
123 | 125 | ]
|
124 |
| - 'end': '(?=;|$)' |
125 |
| - 'name': 'meta.import.js' |
126 | 126 | }
|
127 | 127 | {
|
128 |
| - 'comment': 'ES6 export: `export default (variable|class|function, etc.)`' |
| 128 | + # ES6 export: export default (variable|class|function, etc.) |
129 | 129 | 'match': '''(?x)
|
130 | 130 | \\b(export)\\b\\s*
|
131 | 131 | \\b(default)\\b\\s*
|
|
142 | 142 | 'name': 'variable.other.module.js'
|
143 | 143 | }
|
144 | 144 | {
|
145 |
| - 'comment': 'ES6 export, re-export: `export {member as alias, [...]} [from ...]`' |
| 145 | + # ES6 export, re-export: export {member as alias, [...]} [from ...] |
146 | 146 | 'begin': '(?<!\\.)\\b(export)(?!\\s*:)\\b'
|
147 | 147 | 'beginCaptures':
|
148 | 148 | '1':
|
149 | 149 | 'name': 'keyword.control.js'
|
| 150 | + 'end': '(?=;|\\bfunction\\b|\\bclass\\b|\\blet\\b|\\bvar\\b|\\bconst\\b|$)' |
| 151 | + 'name': 'meta.export.js' |
150 | 152 | 'patterns': [
|
151 | 153 | {
|
152 | 154 | 'include': '#numbers'
|
153 | 155 | }
|
154 | 156 | {
|
155 |
| - 'comment': '`{ member1 , member2 as alias2 , [...] }` inside re-export' |
| 157 | + # { member1 , member2 as alias2 , [...] } inside re-export |
156 | 158 | 'begin': '\\{(?=.*\\bfrom\\b)'
|
157 | 159 | 'beginCaptures':
|
158 | 160 | 0:
|
|
163 | 165 | 'name': 'punctuation.definition.modules.end.js'
|
164 | 166 | 'patterns': [
|
165 | 167 | {
|
166 |
| - 'comment': '(default|name) as alias' |
| 168 | + # (default|name) as alias |
| 169 | + 'match': '''(?x) |
| 170 | + (?: \\b(default)\\b | \\b([a-zA-Z_$][\\w$]*)\\b) |
| 171 | + \\s* |
| 172 | + (\\b as \\b) |
| 173 | + \\s* |
| 174 | + (?: \\b(default)\\b | (\\*) | \\b([a-zA-Z_$][\\w$]*)\\b) |
| 175 | + ''' |
167 | 176 | 'captures':
|
168 | 177 | '1':
|
169 | 178 | 'name': 'variable.language.default.js'
|
|
177 | 186 | 'name': 'invalid.illegal.js'
|
178 | 187 | '6':
|
179 | 188 | 'name': 'variable.other.module-alias.js'
|
180 |
| - 'match': '''(?x) |
181 |
| - (?: \\b(default)\\b | \\b([a-zA-Z_$][\\w$]*)\\b) |
182 |
| - \\s* |
183 |
| - (\\b as \\b) |
184 |
| - \\s* |
185 |
| - (?: \\b(default)\\b | (\\*) | \\b([a-zA-Z_$][\\w$]*)\\b) |
186 |
| - ''' |
187 | 189 | }
|
188 | 190 | {
|
189 | 191 | 'match': ','
|
|
199 | 201 | ]
|
200 | 202 | }
|
201 | 203 | {
|
202 |
| - 'comment': '{ member1 , member2 as alias2 , [...] }' |
| 204 | + # { member1 , member2 as alias2 , [...] } |
203 | 205 | 'begin': '(?![a-zA-Z_$0-9])\\{'
|
204 | 206 | 'beginCaptures':
|
205 | 207 | 0:
|
|
210 | 212 | 'name': 'punctuation.definition.modules.end.js'
|
211 | 213 | 'patterns': [
|
212 | 214 | {
|
213 |
| - 'comment': 'name as (default|alias)' |
| 215 | + # name as (default|alias) |
214 | 216 | 'captures':
|
215 | 217 | '1':
|
216 | 218 | 'name': 'invalid.illegal.js'
|
|
275 | 277 | 'include': '#operators'
|
276 | 278 | }
|
277 | 279 | ]
|
278 |
| - 'end': '(?=;|\\bfunction\\b|\\bclass\\b|\\blet\\b|\\bvar\\b|\\bconst\\b|$)' |
279 |
| - 'name': 'meta.export.js' |
280 | 280 | }
|
281 | 281 | {
|
282 | 282 | 'match': '''(?x)
|
|
816 | 816 | 'include': '#comments'
|
817 | 817 | }
|
818 | 818 | {
|
| 819 | + 'match': '(<!--|-->)' |
819 | 820 | 'captures':
|
820 | 821 | '0':
|
821 | 822 | 'name': 'punctuation.definition.comment.html.js'
|
822 | 823 | '2':
|
823 | 824 | 'name': 'punctuation.definition.comment.html.js'
|
824 |
| - 'match': '(<!--|-->)' |
825 | 825 | 'name': 'comment.block.html.js'
|
826 | 826 | }
|
827 | 827 | {
|
|
1114 | 1114 | 'name': 'meta.delimiter.method.period.js'
|
1115 | 1115 | }
|
1116 | 1116 | {
|
| 1117 | + # Allows the special return snippet to fire. |
| 1118 | + 'match': '({)(})' |
1117 | 1119 | 'captures':
|
1118 | 1120 | '1':
|
1119 | 1121 | 'name': 'punctuation.section.scope.begin.js'
|
1120 | 1122 | '2':
|
1121 | 1123 | 'name': 'punctuation.section.scope.end.js'
|
1122 |
| - 'comment': 'Allows the special return snippet to fire.' |
1123 |
| - 'match': '({)(})' |
1124 | 1124 | }
|
1125 | 1125 | {
|
1126 | 1126 | 'begin': '{'
|
|
1751 | 1751 | 'patterns': [
|
1752 | 1752 | {
|
1753 | 1753 | 'begin': '/\\*\\*(?!/)'
|
1754 |
| - 'captures': |
| 1754 | + 'beginCaptures': |
| 1755 | + '0': |
| 1756 | + 'name': 'punctuation.definition.comment.js' |
| 1757 | + 'end': '\\*/' |
| 1758 | + 'endCaptures': |
1755 | 1759 | '0':
|
1756 | 1760 | 'name': 'punctuation.definition.comment.js'
|
| 1761 | + 'name': 'comment.block.documentation.js' |
1757 | 1762 | 'patterns': [
|
1758 | 1763 | {
|
1759 | 1764 | 'include': '#docblock'
|
1760 | 1765 | }
|
1761 | 1766 | ]
|
1762 |
| - 'end': '\\*/' |
1763 |
| - 'name': 'comment.block.documentation.js' |
1764 | 1767 | }
|
1765 | 1768 | {
|
1766 | 1769 | 'begin': '/\\*'
|
1767 |
| - 'captures': |
| 1770 | + 'beginCaptures': |
1768 | 1771 | '0':
|
1769 | 1772 | 'name': 'punctuation.definition.comment.js'
|
1770 | 1773 | 'end': '\\*/'
|
| 1774 | + 'endCaptures': |
| 1775 | + '0': |
| 1776 | + 'name': 'punctuation.definition.comment.js' |
1771 | 1777 | 'name': 'comment.block.js'
|
1772 | 1778 | }
|
1773 | 1779 | {
|
|
0 commit comments