Mercurial > vim
annotate runtime/syntax/typescriptreact.vim @ 34638:857eb73fb6a7
NSIS: Redesigning the appearance of the vimrc settings page (#14292)
Commit: https://github.com/vim/vim/commit/6dcf59b89fd4a65df4a68a333a66357c2480d7b0
Author: Restorer <69863286+RestorerZ@users.noreply.github.com>
Date: Mon Mar 25 15:38:37 2024 +0000
NSIS: Redesigning the appearance of the vimrc settings page (https://github.com/vim/vim/issues/14292)
Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 25 Mar 2024 16:45:05 +0100 |
parents | 71cbad0921c9 |
children | 5ea191f0c8a1 |
rev | line source |
---|---|
18639 | 1 " Vim syntax file |
2 " Language: TypeScript with React (JSX) | |
32975
71cbad0921c9
runtime: Remove Brams name from a few more runtime files (#12780)
Christian Brabandt <cb@256bit.org>
parents:
29756
diff
changeset
|
3 " Maintainer: The Vim Project <https://github.com/vim/vim> |
71cbad0921c9
runtime: Remove Brams name from a few more runtime files (#12780)
Christian Brabandt <cb@256bit.org>
parents:
29756
diff
changeset
|
4 " Last Change: 2023 Aug 13 |
18639 | 5 " Based On: Herrington Darkholme's yats.vim |
32975
71cbad0921c9
runtime: Remove Brams name from a few more runtime files (#12780)
Christian Brabandt <cb@256bit.org>
parents:
29756
diff
changeset
|
6 " Changes: See https://github.com/HerringtonDarkholme/yats.vim |
18639 | 7 " Credits: See yats.vim on github |
8 | |
9 if !exists("main_syntax") | |
10 if exists("b:current_syntax") | |
11 finish | |
12 endif | |
13 let main_syntax = 'typescriptreact' | |
14 endif | |
15 | |
16 let s:cpo_save = &cpo | |
17 set cpo&vim | |
18 | |
19 syntax region tsxTag | |
20 \ start=+<\([^/!?<>="':]\+\)\@=+ | |
21 \ skip=+</[^ /!?<>"']\+>+ | |
22 \ end=+/\@<!>+ | |
23 \ end=+\(/>\)\@=+ | |
24 \ contained | |
25 \ contains=tsxTagName,tsxIntrinsicTagName,tsxAttrib,tsxEscJs, | |
26 \tsxCloseString,@tsxComment | |
27 | |
28 syntax match tsxTag /<>/ contained | |
29 | |
30 | |
31 " <tag></tag> | |
32 " s~~~~~~~~~e | |
33 " and self close tag | |
34 " <tag/> | |
35 " s~~~~e | |
36 " A big start regexp borrowed from https://git.io/vDyxc | |
37 syntax region tsxRegion | |
38 \ start=+<\_s*\z([a-zA-Z1-9\$_-]\+\(\.\k\+\)*\)+ | |
39 \ skip=+<!--\_.\{-}-->+ | |
40 \ end=+</\_s*\z1>+ | |
41 \ matchgroup=tsxCloseString end=+/>+ | |
42 \ fold | |
43 \ contains=tsxRegion,tsxCloseString,tsxCloseTag,tsxTag,tsxCommentInvalid,tsxFragment,tsxEscJs,@Spell | |
44 \ keepend | |
45 \ extend | |
46 | |
47 " <> </> | |
48 " s~~~~~~e | |
49 " A big start regexp borrowed from https://git.io/vDyxc | |
50 syntax region tsxFragment | |
51 \ start=+\(\((\|{\|}\|\[\|,\|&&\|||\|?\|:\|=\|=>\|\Wreturn\|^return\|\Wdefault\|^\|>\)\_s*\)\@<=<>+ | |
52 \ skip=+<!--\_.\{-}-->+ | |
53 \ end=+</>+ | |
54 \ fold | |
55 \ contains=tsxRegion,tsxCloseString,tsxCloseTag,tsxTag,tsxCommentInvalid,tsxFragment,tsxEscJs,@Spell | |
56 \ keepend | |
57 \ extend | |
58 | |
59 " </tag> | |
60 " ~~~~~~ | |
61 syntax match tsxCloseTag | |
62 \ +</\_s*[^/!?<>"']\+>+ | |
63 \ contained | |
64 \ contains=tsxTagName,tsxIntrinsicTagName | |
65 | |
66 syntax match tsxCloseTag +</>+ contained | |
67 | |
68 syntax match tsxCloseString | |
69 \ +/>+ | |
70 \ contained | |
71 | |
72 " <!-- --> | |
73 " ~~~~~~~~ | |
74 syntax match tsxCommentInvalid /<!--\_.\{-}-->/ display | |
75 | |
76 syntax region tsxBlockComment | |
77 \ contained | |
78 \ start="/\*" | |
79 \ end="\*/" | |
80 | |
81 syntax match tsxLineComment | |
82 \ "//.*$" | |
83 \ contained | |
84 \ display | |
85 | |
86 syntax cluster tsxComment contains=tsxBlockComment,tsxLineComment | |
87 | |
88 syntax match tsxEntity "&[^; \t]*;" contains=tsxEntityPunct | |
89 syntax match tsxEntityPunct contained "[&.;]" | |
90 | |
91 " <tag key={this.props.key}> | |
92 " ~~~ | |
93 syntax match tsxTagName | |
94 \ +[</]\_s*[^/!?<>"'* ]\++hs=s+1 | |
95 \ contained | |
96 \ nextgroup=tsxAttrib | |
97 \ skipwhite | |
98 \ display | |
99 syntax match tsxIntrinsicTagName | |
100 \ +[</]\_s*[a-z1-9-]\++hs=s+1 | |
101 \ contained | |
102 \ nextgroup=tsxAttrib | |
103 \ skipwhite | |
104 \ display | |
105 | |
106 " <tag key={this.props.key}> | |
107 " ~~~ | |
108 syntax match tsxAttrib | |
109 \ +[a-zA-Z_][-0-9a-zA-Z_]*+ | |
110 \ nextgroup=tsxEqual skipwhite | |
111 \ contained | |
112 \ display | |
113 | |
114 " <tag id="sample"> | |
115 " ~ | |
116 syntax match tsxEqual +=+ display contained | |
117 \ nextgroup=tsxString skipwhite | |
118 | |
119 " <tag id="sample"> | |
120 " s~~~~~~e | |
121 syntax region tsxString contained start=+"+ end=+"+ contains=tsxEntity,@Spell display | |
122 | |
123 " <tag key={this.props.key}> | |
124 " s~~~~~~~~~~~~~~e | |
125 syntax region tsxEscJs | |
126 \ contained | |
127 \ contains=@typescriptValue,@tsxComment | |
128 \ matchgroup=typescriptBraces | |
129 \ start=+{+ | |
130 \ end=+}+ | |
131 \ extend | |
132 | |
133 | |
134 """"""""""""""""""""""""""""""""""""""""""""""""""" | |
135 " Source the part common with typescriptreact.vim | |
29756 | 136 source <sfile>:h/shared/typescriptcommon.vim |
18639 | 137 |
138 | |
139 syntax cluster typescriptExpression add=tsxRegion,tsxFragment | |
140 | |
141 hi def link tsxTag htmlTag | |
142 hi def link tsxTagName Function | |
143 hi def link tsxIntrinsicTagName htmlTagName | |
144 hi def link tsxString String | |
145 hi def link tsxNameSpace Function | |
146 hi def link tsxCommentInvalid Error | |
147 hi def link tsxBlockComment Comment | |
148 hi def link tsxLineComment Comment | |
149 hi def link tsxAttrib Type | |
150 hi def link tsxEscJs tsxEscapeJs | |
151 hi def link tsxCloseTag htmlTag | |
152 hi def link tsxCloseString Identifier | |
153 | |
154 let b:current_syntax = "typescriptreact" | |
155 if main_syntax == 'typescriptreact' | |
156 unlet main_syntax | |
157 endif | |
158 | |
159 let &cpo = s:cpo_save | |
160 unlet s:cpo_save |