Skip to content

Commit 52d132c

Browse files
Add highlighting for JSX fragment
1 parent 824f47e commit 52d132c

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

TypeScriptReact.YAML-tmLanguage

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,23 @@ repository:
2828
patterns:
2929
- include: '#jsx-tag-without-attributes-in-expression'
3030
- include: '#jsx-tag-in-expression'
31-
- include: '#jsx-tag-invalid'
31+
- include: '#jsx-fragment'
3232

3333
#jsx tags
34+
jsx-fragment:
35+
name: meta.tag.fragment.tsx
36+
begin: (<)\s*(>)
37+
end: (</)\s*(>)
38+
beginCaptures:
39+
'1': {name: punctuation.definition.tag.begin.tsx}
40+
'2': {name: punctuation.definition.tag.end.tsx}
41+
endCaptures:
42+
'1': {name: punctuation.definition.tag.begin.tsx}
43+
'2': {name: punctuation.definition.tag.end.tsx}
44+
contentName: meta.jsx.children.tsx
45+
patterns:
46+
- include: '#jsx-children'
47+
3448
jsx-tag-without-attributes-in-expression:
3549
begin: |-
3650
(?x)
@@ -128,16 +142,12 @@ repository:
128142
patterns:
129143
- include: '#jsx-children'
130144

131-
jsx-tag-invalid:
132-
name: invalid.illegal.tag.incomplete.tsx
133-
match: <\s*>
134-
135145
#jsx children
136146
jsx-children:
137147
patterns:
138148
- include: '#jsx-tag-without-attributes'
139149
- include: '#jsx-child-tag'
140-
- include: '#jsx-tag-invalid'
150+
- include: '#jsx-fragment'
141151
- include: '#jsx-evaluated-code'
142152
- include: '#jsx-entities'
143153

0 commit comments

Comments
 (0)