Skip to content

Commit 355d665

Browse files
committed
Add individual syntax groups for various parenthesis
Many of these are noise, but I don't consider function parenthesis to be so. Rather than creating a non-function parens group, I just created a group for each type and then linked them all to `jsParens` so that everything will behave as it currently does for users who are using `jsParens`.
1 parent 4e2e377 commit 355d665

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

syntax/javascript.vim

+8-4
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus
136136
"" Code blocks
137137
syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression extend fold
138138
syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll extend fold
139-
syntax region jsParenIfElse contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsBlock extend fold
140-
syntax region jsParenRepeat contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsBlock extend fold
141-
syntax region jsParenSwitch contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold
142-
syntax region jsParenCatch contained matchgroup=jsParens start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold
139+
syntax region jsParenIfElse contained matchgroup=jsParensIfElse start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsBlock extend fold
140+
syntax region jsParenRepeat contained matchgroup=jsParensRepeat start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsBlock extend fold
141+
syntax region jsParenSwitch contained matchgroup=jsParensSwitch start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold
142+
syntax region jsParenCatch contained matchgroup=jsParensCatch start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold
143143
syntax region jsFuncArgs contained matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsRestExpression,jsFlowArgumentDef skipwhite skipempty nextgroup=jsCommentFunction,jsFuncBlock,jsFlowReturn extend fold
144144
syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsNoise extend fold
145145
syntax region jsFuncBlock contained matchgroup=jsFuncBraces start=/{/ end=/}/ contains=@jsAll extend fold
@@ -233,6 +233,10 @@ if version >= 508 || !exists("did_javascript_syn_inits")
233233
endif
234234
HiLink jsComment Comment
235235
HiLink jsEnvComment PreProc
236+
HiLink jsParensIfElse jsParens
237+
HiLink jsParensRepeat jsParens
238+
HiLink jsParensSwitch jsParens
239+
HiLink jsParensCatch jsParens
236240
HiLink jsCommentTodo Todo
237241
HiLink jsString String
238242
HiLink jsObjectKeyString String

0 commit comments

Comments
 (0)