Skip to content

Commit 0d07dc8

Browse files
authored
Fix matchparen problem (#112)
1 parent 8b96cea commit 0d07dc8

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

after/syntax/jsx_pretty.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ syntax region jsxTag
1818
\ matchgroup=NONE
1919
\ end=+\%(/\_s*>\)\@=+
2020
\ contained
21-
\ contains=jsxOpenTag,jsxAttrib,jsxEscapeJs,jsxSpreadOperator,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment
21+
\ contains=jsxOpenTag,jsxAttrib,jsxExpressionBlock,jsxSpreadOperator,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment
2222
\ keepend
2323
\ extend
2424
\ skipwhite
@@ -37,7 +37,7 @@ syntax region jsxElement
3737
\ start=+<\_s*\%(>\|\${\|\z(\<[-:._$A-Za-z0-9]\+\>\)\)+
3838
\ end=+/\_s*>+
3939
\ end=+<\_s*/\_s*\z1\_s*>+
40-
\ contains=jsxElement,jsxTag,jsxEscapeJs,jsxComment,jsxCloseTag,@Spell
40+
\ contains=jsxElement,jsxTag,jsxExpressionBlock,jsxComment,jsxCloseTag,@Spell
4141
\ keepend
4242
\ extend
4343
\ contained
@@ -64,7 +64,7 @@ exe 'syntax region jsxOpenTag
6464

6565
" <tag key={this.props.key}>
6666
" ~~~~~~~~~~~~~~~~
67-
syntax region jsxEscapeJs
67+
syntax region jsxExpressionBlock
6868
\ matchgroup=jsxBraces
6969
\ start=+{+
7070
\ end=+}+
@@ -82,7 +82,7 @@ syntax match jsxNamespace +:+ contained
8282

8383
" <tag id="sample">
8484
" ~
85-
syntax match jsxEqual +=+ contained skipwhite skipempty nextgroup=jsxString,jsxEscapeJs,jsxRegion
85+
syntax match jsxEqual +=+ contained skipwhite skipempty nextgroup=jsxString,jsxExpressionBlock,jsxRegion
8686

8787
" <tag />
8888
" ~~
@@ -152,10 +152,10 @@ if s:enable_tagged_jsx
152152
\ end=+`+
153153
\ extend
154154
\ contained
155-
\ contains=jsxElement,jsxEscapeJs
155+
\ contains=jsxElement,jsxExpressionBlock
156156
\ transparent
157157

158-
syntax region jsxEscapeJs
158+
syntax region jsxExpressionBlock
159159
\ matchgroup=jsxBraces
160160
\ start=+\${+
161161
\ end=+}+
@@ -169,14 +169,14 @@ if s:enable_tagged_jsx
169169
\ matchgroup=NONE
170170
\ end=+}\@1<=+
171171
\ contained
172-
\ contains=jsxEscapeJs
172+
\ contains=jsxExpressionBlock
173173
\ skipwhite
174174
\ skipempty
175175
\ nextgroup=jsxAttrib,jsxSpreadOperator
176176

177177
syntax keyword jsxAttribKeyword class contained
178178

179-
syntax match jsxSpreadOperator +\.\.\.+ contained nextgroup=jsxEscapeJs skipwhite
179+
syntax match jsxSpreadOperator +\.\.\.+ contained nextgroup=jsxExpressionBlock skipwhite
180180

181181
syntax match jsxCloseTag +<//>+ contained
182182

autoload/jsx_pretty/indent.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ function s:is_jsx_element(syntax)
6868
return a:syntax =~? 'jsxElement'
6969
endfunction
7070

71-
" Whether the specified syntax group is the jsxEscapeJs
72-
function s:is_jsx_escape(syntax)
73-
return a:syntax =~? 'jsxEscapeJs'
71+
" Whether the specified syntax group is the jsxExpressionBlock
72+
function s:is_jsx_expression(syntax)
73+
return a:syntax =~? 'jsxExpressionBlock'
7474
endfunction
7575

7676
" Whether the specified syntax group is the jsxBraces
@@ -189,7 +189,7 @@ endfunction
189189
" - jsxRegion
190190
" - jsxTaggedRegion
191191
" - jsxElement
192-
" - jsxEscapeJs
192+
" - jsxExpressionBlock
193193
" - Other
194194
function s:syntax_context(lnum)
195195
let start_col = s:start_col(a:lnum)
@@ -199,9 +199,9 @@ function s:syntax_context(lnum)
199199
let i = 0
200200

201201
for syntax_name in reversed
202-
" If the current line is jsxEscapeJs and not starts with jsxBraces
203-
if s:is_jsx_escape(syntax_name)
204-
return 'jsxEscapeJs'
202+
" If the current line is jsxExpressionBlock and not starts with jsxBraces
203+
if s:is_jsx_expression(syntax_name)
204+
return 'jsxExpressionBlock'
205205
endif
206206

207207
if s:is_jsx_region(syntax_name)
@@ -285,7 +285,7 @@ function! jsx_pretty#indent#get(js_indent)
285285
endif
286286

287287
return s:jsx_indent_element(v:lnum)
288-
elseif syntax_context == 'jsxEscapeJs'
288+
elseif syntax_context == 'jsxExpressionBlock'
289289
let prev_lnum = s:prev_lnum(v:lnum)
290290
let prev_line = s:trim(getline(prev_lnum))
291291

doc/vim-jsx-pretty-doc.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ highlight setting.
6262
highlight def link jsxNameSpace Function
6363
highlight def link jsxComment Error
6464
highlight def link jsxAttrib Type
65-
highlight def link jsxEscapeJs jsxEscapeJs
6665
highlight def link jsxCloseTag Identifier
6766
highlight def link jsxCloseString Identifier
6867

0 commit comments

Comments
 (0)