Skip to content

Commit c5f2bf7

Browse files
committed
fix for highliting
fix for #666
1 parent 40fc4f7 commit c5f2bf7

File tree

1 file changed

+148
-149
lines changed

1 file changed

+148
-149
lines changed

grammars/tsx.cson

Lines changed: 148 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,150 @@
1-
'name': 'TypeScript (TSX)'
2-
'scopeName': 'source.ts.tsx'
3-
'fileTypes': [
4-
'tsx'
1+
name: "TypeScript (TSX)"
2+
scopeName: "source.ts.tsx"
3+
fileTypes: [
4+
"tsx"
55
]
6-
'patterns': [
7-
{
8-
'include': '#pcdata'
9-
}
10-
{
11-
'include': '#jsx'
12-
}
13-
{
14-
'include': 'source.ts'
15-
}
6+
patterns: [
7+
{
8+
include: "#pcdata"
9+
}
10+
{
11+
include: "#literal-jsx"
12+
}
13+
{
14+
include: "source.ts"
15+
}
1616
]
17-
'repository':
18-
'pcdata':
19-
'patterns': [
20-
{
21-
'include': '#pcdata-quotes'
22-
}
23-
]
24-
'pcdata-quotes':
25-
'name': 'meta.other.pcdata.js'
26-
'match': '\\b\\w+[\'"]\\w+\\b'
27-
'jsx-tag-attributes':
28-
'patterns': [
29-
{
30-
'include': '#jsx-tag-attribute-name'
31-
}
32-
{
33-
'include': '#jsx-string-double-quoted'
34-
}
35-
{
36-
'include': '#jsx-string-single-quoted'
37-
}
38-
{
39-
'include': '#jsx-evaluated-code'
40-
}
41-
]
42-
'jsx-tag-attribute-name':
43-
'name': 'meta.tag.attribute-name.js'
44-
'match': '\\b([a-zA-Z0-9\\-:]+)'
45-
'captures':
46-
'1':
47-
'name': 'entity.other.attribute-name.js'
48-
'jsx-string-double-quoted':
49-
'begin': '"'
50-
'end': '"'
51-
'name': 'string.quoted.double.js'
52-
'endCaptures':
53-
'0':
54-
'name': 'punctuation.definition.string.end.js'
55-
'beginCaptures':
56-
'0':
57-
'name': 'punctuation.definition.string.begin.js'
58-
'patterns': [
59-
{
60-
'include': '#jsx-entities'
61-
}
62-
]
63-
'jsx-string-single-quoted':
64-
'begin': '\''
65-
'end': '\''
66-
'name': 'string.quoted.single.js'
67-
'endCaptures':
68-
'0':
69-
'name': 'punctuation.definition.string.end.js'
70-
'beginCaptures':
71-
'0':
72-
'name': 'punctuation.definition.string.begin.js'
73-
'patterns': [
74-
{
75-
'include': '#jsx-entities'
76-
}
77-
]
78-
'jsx-entities':
79-
'patterns': [
80-
{
81-
'name': 'constant.character.entity.js'
82-
'match': '(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)'
83-
'captures':
84-
'1':
85-
'name': 'punctuation.definition.entity.js'
86-
'3':
87-
'name': 'punctuation.definition.entity.js'
88-
}
89-
{
90-
'name': 'invalid.illegal.bad-ampersand.js'
91-
'match': '&'
92-
}
93-
]
94-
'jsx-evaluated-code':
95-
'begin': '{'
96-
'end': '}'
97-
'name': 'meta.brace.curly.js'
98-
'endCaptures':
99-
'0':
100-
'name': 'punctuation.definition.brace.curly.end.js'
101-
'beginCaptures':
102-
'0':
103-
'name': 'punctuation.definition.brace.curly.start.js'
104-
'patterns': [
105-
{
106-
'include': '$self'
107-
}
108-
]
109-
'jsx-tag-open':
110-
'begin': '(<)([a-zA-Z0-9\.:$_]+)'
111-
'end': '(/?>)'
112-
'name': 'tag.open.js'
113-
'endCaptures':
114-
'1':
115-
'name': 'punctuation.definition.tag.end.js'
116-
'beginCaptures':
117-
'1':
118-
'name': 'punctuation.definition.tag.begin.js'
119-
'2':
120-
'name': 'entity.name.tag.js'
121-
'patterns': [
122-
{
123-
'include': '#jsx-tag-attributes'
124-
}
125-
]
126-
'jsx-tag-close':
127-
'match': '(</)([^>]+)(>)'
128-
'name': 'tag.closed.js'
129-
'captures':
130-
'1':
131-
'name': 'punctuation.definition.tag.begin.js'
132-
'2':
133-
'name': 'entity.name.tag.js'
134-
'3':
135-
'name': 'punctuation.definition.tag.end.js'
136-
'jsx-tag-invalid':
137-
'name': 'invalid.illegal.tag.incomplete.js'
138-
'match': '<\\s*>'
139-
'jsx':
140-
'name': 'meta.jsx.js'
141-
'patterns': [
142-
{
143-
'include': '#jsx-tag-open'
144-
}
145-
{
146-
'include': '#jsx-tag-close'
147-
}
148-
{
149-
'include': '#jsx-tag-invalid'
150-
}
151-
]
17+
repository:
18+
pcdata:
19+
patterns: [
20+
{
21+
include: "#pcdata-quotes"
22+
}
23+
]
24+
"pcdata-quotes":
25+
name: "meta.other.pcdata.js"
26+
match: "\\b\\w+[\"]\\w+\\b"
27+
"literal-jsx":
28+
contentName: "meta.jsx.js"
29+
begin: "(?<=\\(|\\{|\\[|,|&&|\\|\\||\\?|:|=|=>|\\Wreturn|^return|^)(?=\\s*<[_$a-zA-Z])"
30+
end: "(?<=/>|>)"
31+
patterns: [
32+
{
33+
include: "#jsx-tag-start"
34+
}
35+
]
36+
"jsx-tag-start":
37+
patterns: [
38+
{
39+
begin: "(<)([_$a-zA-Z][-$:.\\w]*[$\\w]*)"
40+
beginCaptures:
41+
"1":
42+
name: "punctuation.definition.tag.begin.jsx"
43+
"2":
44+
name: "entity.name.tag.jsx"
45+
end: "(</)(\\2)(>)|(/>)"
46+
endCaptures:
47+
"1":
48+
name: "punctuation.definition.tag.begin.jsx"
49+
"2":
50+
name: "entity.name.tag.jsx"
51+
"3":
52+
name: "punctuation.definition.tag.end.jsx"
53+
"4":
54+
name: "punctuation.definition.tag.end.jsx"
55+
patterns: [
56+
{
57+
include: "#jsx-tag-end"
58+
}
59+
{
60+
include: "#jsx-attributes"
61+
}
62+
]
63+
}
64+
{
65+
name: "invalid.illegal.tag.incomplete.jsx"
66+
match: "<"
67+
}
68+
]
69+
"jsx-tag-end":
70+
begin: ">"
71+
beginCaptures:
72+
"0":
73+
name: "punctuation.definition.tag.end.jsx"
74+
end: "(?=</)"
75+
patterns: [
76+
{
77+
include: "#jsx-tag-start"
78+
}
79+
{
80+
include: "#jsx-evaluated-code"
81+
}
82+
{
83+
include: "#jsx-entities"
84+
}
85+
]
86+
"jsx-attributes":
87+
patterns: [
88+
{
89+
include: "#jsx-attribute-name"
90+
}
91+
{
92+
include: "#jsx-attribute-assignment"
93+
}
94+
{
95+
include: "#jsx-string-quoted"
96+
}
97+
{
98+
include: "#jsx-evaluated-code"
99+
}
100+
{
101+
include: "#comments"
102+
}
103+
]
104+
"jsx-attribute-name":
105+
name: "entity.other.attribute-name.jsx"
106+
match: "[_$a-zA-Z][-$\\w]*"
107+
"jsx-attribute-assignment":
108+
name: "keyword.operator.assignment.jsx"
109+
match: "="
110+
"jsx-evaluated-code":
111+
name: "meta.embedded.expression.jsx"
112+
begin: "{"
113+
beginCaptures:
114+
"0":
115+
name: "punctuation.section.embedded.begin.jsx"
116+
end: "}"
117+
endCaptures:
118+
"0":
119+
name: "punctuation.section.embedded.end.jsx"
120+
patterns: [
121+
{
122+
include: "#expression"
123+
}
124+
]
125+
"jsx-string-quoted":
126+
name: "string.quoted.jsx"
127+
begin: "([\"'])"
128+
beginCaptures:
129+
"0":
130+
name: "punctuation.definition.string.begin.jsx"
131+
end: "\\1"
132+
endCaptures:
133+
"0":
134+
name: "punctuation.definition.string.end.jsx"
135+
patterns: [
136+
{
137+
include: "#jsx-entities"
138+
}
139+
]
140+
"jsx-entities":
141+
patterns: [
142+
{
143+
name: "constant.character.entity.jsx"
144+
match: "&(?:[a-zA-Z0-9]+|#\\d+|#x\\h+);"
145+
}
146+
{
147+
name: "invalid.illegal.bad-ampersand.jsx"
148+
match: "&\\S*;"
149+
}
150+
]

0 commit comments

Comments
 (0)