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
---
name: JSX
file_extensions:
- jsx
scope: source.jsx
variables:
identifier: '[A-Za-z_$][A-Za-z0-9_$]*'
contexts:
prototype:
- include: comments
main:
- include: jsx-tags
- include: strings
- include: template-strings
- match: '\b(?:import|export|from|as|const|let|var|function|return|if|else|for|while|switch|case|break|continue|new|this|class|extends|static|async|await|try|catch|finally|throw)\b'
scope: keyword.control.jsx
- match: '\b[A-Z][A-Za-z0-9_]*\b'
scope: entity.name.type.jsx
- match: '\b{{identifier}}(?=\s*\()'
scope: entity.name.function.jsx
- match: '\b(?:0x[0-9A-Fa-f_]+|\d[\d_]*(?:\.\d[\d_]*)?)\b'
scope: constant.numeric.jsx
- match: '=>|[-+*/%=&|<>!?:]+'
scope: keyword.operator.jsx
jsx-tags:
- match: '(</?)([A-Za-z][A-Za-z0-9._:-]*)'
captures:
1: punctuation.definition.tag.jsx
2: entity.name.tag.jsx
- match: '(/?>)'
scope: punctuation.definition.tag.jsx
- match: '\b([A-Za-z_:][-A-Za-z0-9_:.]*)(?=\s*=)'
captures:
1: entity.other.attribute-name.jsx
comments:
- match: '//.*$'
scope: comment.line.double-slash.jsx
- match: '/\*'
push: block-comment
block-comment:
- meta_scope: comment.block.jsx
- match: '/\*'
push: block-comment
- match: '\*/'
pop: true
strings:
- match: '"'
push: double-quoted-string
- match: "'"
push: single-quoted-string
double-quoted-string:
- meta_scope: string.quoted.double.jsx
- match: '\\.'
scope: constant.character.escape.jsx
- match: '"'
pop: true
single-quoted-string:
- meta_scope: string.quoted.single.jsx
- match: '\\.'
scope: constant.character.escape.jsx
- match: "'"
pop: true
template-strings:
- match: '`'
push: template-string
template-string:
- meta_scope: string.quoted.template.jsx
- match: '\\.'
scope: constant.character.escape.jsx
- match: '`'
pop: true