-
Notifications
You must be signed in to change notification settings - Fork 599
Expand file tree
/
Copy pathTSX.sublime-syntax
More file actions
74 lines (63 loc) · 1.6 KB
/
TSX.sublime-syntax
File metadata and controls
74 lines (63 loc) · 1.6 KB
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
73
74
%YAML 1.2
---
name: TSX
scope: source.tsx
version: 2
extends:
- JSX.sublime-syntax
- TypeScript.sublime-syntax
file_extensions:
- tsx
first_line_match: |-
(?xi:
^ \s* // .*? -\*- .*? \btsx\b .*? -\*- # editorconfig
)
contexts:
ts-old-type-assertion:
# old type assertions are replaced by JSX tags
- match: <
scope: punctuation.definition.tag.begin.js
set:
- jsx-meta
- jsx-tag-begin
jsx-tag: [] # replaced by `ts-old-type-assertion`
jsx-tag-begin:
- meta_include_prototype: false
- meta_scope: meta.tag.js
# note: type parameter modifiers indicate generic lambda
- match: (?=(?:in|out|const){{identifier_break}})
fail: arrow-function
- match: /
scope: punctuation.definition.tag.begin.js
set:
- jsx-expect-unmatched-tag-end
- jsx-tag-name
- match: (?=\S)
set:
- jsx-tag-attributes
- tsx-tag-check
- jsx-tag-name
jsx-tag-name:
- meta_include_prototype: false
- match: ''
set:
- jsx-tag-name-meta
- tsx-tag-generic-arguments
- jsx-tag-name-end
- jsx-tag-name-component-possibly-native
tsx-tag-generic-arguments:
- include: ts-generic-type-arguments
- include: else-pop
tsx-tag-check:
- match: extends{{jsx_identifier_break}}
scope: entity.other.attribute-name.js
set:
- meta_include_prototype: false
- match: (?=[>=])
pop: 1
- match: (?=\S)
fail: arrow-function
- match: (?=[/>{]|{{identifier_start}})
pop: 1
- match: (?=\S)
fail: arrow-function