@ -24,53 +24,55 @@ syntax sync fromstart
" syntax case ignore
" syntax case ignore
syntax case match
syntax case match
syntax match jsNoise /[:,\;\.]\{1}/
syntax match jsNoise /[:,\;]\{1}/
syntax match jsNoise /[\.]\{1}/ skipwhite skipempty nextgroup = jsObjectProp , jsFuncCall , jsPrototype , jsTaggedTemplate
syntax match jsObjectProp contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
syntax match jsParensError /[)}\]]/
syntax match jsParensError /[)}\]]/
" Program Keywords
" Program Keywords
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup = jsDestructuringBlock , jsDestructuringArray , jsVariableDef
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup = jsDestructuringBlock , jsDestructuringArray , jsVariableDef
syntax match jsVariableDef contained /\k\+/ nextgroup = jsFlowDefinition
syntax match jsVariableDef contained /\k\+/ skipwhite skipempty nextgroup = jsFlowDefinition
syntax keyword jsOperator delete instanceof typeof void new in of
syntax keyword jsOperator delete instanceof typeof void new in of skipwhite skipempty nextgroup = @jsExpression
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/ skipwhite skipempty nextgroup = @jsExpression
syntax match jsOperator /::/ skipwhite skipempty nextgroup = @jsExpression
syntax keyword jsBooleanTrue true
syntax keyword jsBooleanTrue true
syntax keyword jsBooleanFalse false
syntax keyword jsBooleanFalse false
" Modules
" Modules
syntax keyword jsModuleKeywords contained import
syntax keyword jsImport import skipwhite skipempty nextgroup = jsModuleAsterisk , jsModuleKeyword , jsModuleGroup , jsFlowImportType
syntax keyword jsModuleKeywords contained export skipwhite skipempty nextgroup = jsExportBlock , jsModuleDefault
syntax keyword jsExport export skipwhite skipempty nextgroup = @jsAll , jsModuleGroup , jsExportDefault , jsModuleAsterisk , jsModuleKeyword , jsFlowTypeStatement
syntax keyword jsModuleOperators contained from
syntax match jsModuleKeyword contained /\k\+/ skipwhite skipempty nextgroup = jsModuleAs , jsFrom , jsModuleComma
syntax keyword jsModuleOperators contained as
syntax keyword jsExportDefault contained default skipwhite skipempty nextgroup = @jsExpression
syntax region jsModuleGroup contained matchgroup = jsModuleBraces start = /{/ end = /}/ contains = jsModuleOperators , jsNoise , jsComment
syntax keyword jsExportDefaultGroup contained default skipwhite skipempty nextgroup = jsModuleAs , jsFrom , jsModuleComma
syntax match jsModuleAsterisk contained /*/
syntax match jsModuleAsterisk contained /\*/ skipwhite skipempty nextgroup = jsModuleKeyword , jsModuleAs , jsFrom
syntax keyword jsModuleDefault contained default skipwhite skipempty nextgroup = @jsExpression
syntax keyword jsModuleAs contained as skipwhite skipempty nextgroup = jsModuleKeyword , jsExportDefaultGroup
syntax region jsImportContainer start = /\<import\> / end = "\%(;\|$\)" contains = jsModuleKeywords , jsModuleOperators , jsComment , jsString , jsTemplateString , jsNoise , jsModuleGroup , jsModuleAsterisk
syntax keyword jsFrom contained from skipwhite skipempty nextgroup = jsString
syntax region jsExportContainer start = /\<export\> / end = "\%(;\|$\)" contains = jsModuleKeywords , jsModuleOperators , jsStorageClass , jsModuleDefault , @jsExpression
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup = jsModuleKeyword , jsModuleAsterisk , jsModuleGroup , jsFlowTypeKeyword
syntax region jsExportBlock contained matchgroup = jsExportBraces start = /{/ end = /}/ contains = jsModuleOperators , jsNoise , jsComment
" Strings, Templates, Numbers
" Strings, Templates, Numbers
syntax region jsString start = + "+ skip=+\\\(" \| $\) + end = + "\| $+ contains = jsSpecial , @Spell extend
syntax region jsString start = + "+ skip=+\\\(" \| $\) + end = + "\| $+ contains = jsSpecial , @Spell extend
syntax region jsString start = + '+ skip=+\\\(' \| $\) + end = + '\| $+ contains = jsSpecial , @Spell extend
syntax region jsString start = + '+ skip=+\\\(' \| $\) + end = + '\| $+ contains = jsSpecial , @Spell extend
syntax region jsTemplateString start = + `+ skip = + \\\( `\| $\) + end = + `+ contains = jsTemplate Var, jsSpecia l extend
syntax region jsTemplateString start = + `+ skip = + \\\( `\| $\) + end = + `+ contains = jsTemplate Expression, jsSpecial , @Spel l extend
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup = jsTemplateString
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup = jsTemplateString
syntax match jsNumber /\<\d\+\%([eE][+-]\=\d\+\)\=\>\|\<0[bB][01]\+\>\|\<0[oO]\o\+\>\|\<0[xX]\x\+\>/
syntax match jsNumber /\<\d\+\%([eE][+-]\=\d\+\)\=\>\|\<0[bB][01]\+\>\|\<0[oO]\o\+\>\|\<0[xX]\x\+\>/
syntax keyword jsNumber Infinity
syntax keyword jsNumber Infinity
syntax match jsFloat /\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
syntax match jsFloat /\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
" Regular Expressions
" Regular Expressions
syntax match jsSpecial contained "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)"
syntax match jsSpecial contained "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)"
syntax region jsTemplate Var contained matchgroup = jsTemplateBraces start = + ${+ end = + }+ contains = @jsExpression
syntax region jsTemplate Expression contained matchgroup = jsTemplateBraces start = + ${+ end = + }+ contains = @jsExpression keepend
syntax region jsRegexpCharClass contained start = + \[+ skip = + \\.+ end = + \]+
syntax region jsRegexpCharClass contained start = + \[+ skip = + \\.+ end = + \]+
syntax match jsRegexpBoundary contained "\v%(\<@![\^$]|\\[bB])"
syntax match jsRegexpBoundary contained "\v%(\<@![\^$]|\\[bB])"
syntax match jsRegexpBackRef contained "\v\\[1-9][0-9]*"
syntax match jsRegexpBackRef contained "\v\\[1-9][0-9]*"
syntax match jsRegexpQuantifier contained "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??"
syntax match jsRegexpQuantifier contained "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??"
syntax match jsRegexpOr contained "\v\<@!\|"
syntax match jsRegexpOr contained "\v\<@!\|"
syntax match jsRegexpMod contained "\v\(@<=\?[:=!>]"
syntax match jsRegexpMod contained "\v\(@<=\?[:=!>]"
syntax region jsRegexpGroup contained start = "\\\@<!(" skip = "\\.\|\[\(\\.\|[^]]\)*\]" end = "\\\@<!)" contains = jsRegexpCharClass , @jsRegexpSpecial keepend
syntax region jsRegexpGroup contained start = "\\\@<!(" skip = "\\.\|\[\(\\.\|[^]]\)*\]" end = "\\\@<!)" contains = jsRegexpCharClass , @jsRegexpSpecial keepend
if v :version > 703 | | v :version = = 603 && has ( "patch1088" )
if v :version > 703 | | v :version = = 603 && has ( "patch1088" )
syntax region jsRegexpString start = + \%( \%( \%( return \| case \) \s \+ \) \@50 < = \| \%( \%( [) \]"']\| \d \| \w \) \s *\) \@50 < ! \) /\(\*\|/ \) \@! + skip = + \\.\| \[\%( \\.\| [^]]\) *\]+ end = + /[gimy ]\{, 4 }+ contains = jsRegexpCharClass , jsRegexpGroup , @jsRegexpSpecial oneline keepend extend
syntax region jsRegexpString start = + \%( \%( \%( return \| case \) \s \+ \) \@50 < = \| \%( \%( [) \]"']\| \d \| \w \) \s *\) \@50 < ! \) /\(\*\|/ \) \@! + skip = + \\.\| \[\%( \\.\| [^]]\) *\]+ end = + /[gimy u]\{, 5 }+ contains = jsRegexpCharClass , jsRegexpGroup , @jsRegexpSpecial oneline keepend extend
else
else
syntax region jsRegexpString start = + \%( \%( \%( return \| case \) \s \+ \) \@< = \| \%( \%( [) \]"']\| \d \| \w \) \s *\) \@< ! \) /\(\*\|/ \) \@! + skip = + \\.\| \[\%( \\.\| [^]]\) *\]+ end = + /[gimy ]\{, 4 }+ contains = jsRegexpCharClass , jsRegexpGroup , @jsRegexpSpecial oneline keepend extend
syntax region jsRegexpString start = + \%( \%( \%( return \| case \) \s \+ \) \@< = \| \%( \%( [) \]"']\| \d \| \w \) \s *\) \@< ! \) /\(\*\|/ \) \@! + skip = + \\.\| \[\%( \\.\| [^]]\) *\]+ end = + /[gimy u]\{, 5 }+ contains = jsRegexpCharClass , jsRegexpGroup , @jsRegexpSpecial oneline keepend extend
endif
endif
syntax cluster jsRegexpSpecial contains = jsSpecial , jsRegexpBoundary , jsRegexpBackRef , jsRegexpQuantifier , jsRegexpOr , jsRegexpMod
syntax cluster jsRegexpSpecial contains = jsSpecial , jsRegexpBoundary , jsRegexpBackRef , jsRegexpQuantifier , jsRegexpOr , jsRegexpMod
@ -81,15 +83,15 @@ syntax region jsObjectKeyString contained start=+"+ skip=+\\\("\|$\)+ end=+
syntax region jsObjectKeyString contained start = + '+ skip=+\\\(' \| $\) + end = + '\| $+ contains = jsSpecial , @Spell skipwhite skipempty nextgroup = jsObjectValue
syntax region jsObjectKeyString contained start = + '+ skip=+\\\(' \| $\) + end = + '\| $+ contains = jsSpecial , @Spell skipwhite skipempty nextgroup = jsObjectValue
syntax region jsObjectKeyComputed contained matchgroup = jsBrackets start = /\[/ end = /]/ contains = @jsExpression skipwhite skipempty nextgroup = jsObjectValue , jsFuncArgs extend
syntax region jsObjectKeyComputed contained matchgroup = jsBrackets start = /\[/ end = /]/ contains = @jsExpression skipwhite skipempty nextgroup = jsObjectValue , jsFuncArgs extend
syntax match jsObjectSeparator contained /,/
syntax match jsObjectSeparator contained /,/
syntax region jsObjectValue contained start= /:/ end = /\%(,\|}\)\@=/ contains = jsObjectColon , @jsExpression extend
syntax region jsObjectValue contained matchgroup= jsNoise start= /:/ end = /\%(,\|}\)\@=/ contains = @jsExpression extend
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup = jsFuncArgs
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup = jsFuncArgs
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/
syntax match jsObjectMethodType contained /\%(get\|set\ |static\|async\ )\%( \k\+\)\@=/ skipwhite skipempty nextgroup = jsObjectFuncName
syntax match jsObjectMethodType contained /\%(get\|set\ )\%( \k\+\)\@=/ skipwhite skipempty nextgroup = jsObjectFuncName
syntax region jsObjectStringKey contained start = + "+ skip=+\\\(" \| $\) + end = + "\| $+ contains = jsSpecial , @Spell extend skipwhite skipempty nextgroup = jsFuncArgs , jsObjectValue
syntax region jsObjectStringKey contained start = + "+ skip=+\\\(" \| $\) + end = + "\| $+ contains = jsSpecial , @Spell extend skipwhite skipempty nextgroup = jsFuncArgs , jsObjectValue
syntax region jsObjectStringKey contained start = + '+ skip=+\\\(' \| $\) + end = + '\| $+ contains = jsSpecial , @Spell extend skipwhite skipempty nextgroup = jsFuncArgs , jsObjectValue
syntax region jsObjectStringKey contained start = + '+ skip=+\\\(' \| $\) + end = + '\| $+ contains = jsSpecial , @Spell extend skipwhite skipempty nextgroup = jsFuncArgs , jsObjectValue
exe 'syntax keyword jsNull null ' .( exists ( 'g:javascript_conceal_null' ) ? 'conceal cchar=' .g :javascript_conceal_null : '' )
exe 'syntax keyword jsNull null ' .( exists ( 'g:javascript_conceal_null' ) ? 'conceal cchar=' .g :javascript_conceal_null : '' )
exe 'syntax keyword jsReturn return contained ' .( exists ( 'g:javascript_conceal_return' ) ? 'conceal cchar=' .g :javascript_conceal_return : '' )
exe 'syntax keyword jsReturn return contained ' .( exists ( 'g:javascript_conceal_return' ) ? 'conceal cchar=' .g :javascript_conceal_return : '' ) .' skipwhite skipempty nextgroup=@jsExpression'
exe 'syntax keyword jsUndefined undefined ' .( exists ( 'g:javascript_conceal_undefined' ) ? 'conceal cchar=' .g :javascript_conceal_undefined : '' )
exe 'syntax keyword jsUndefined undefined ' .( exists ( 'g:javascript_conceal_undefined' ) ? 'conceal cchar=' .g :javascript_conceal_undefined : '' )
exe 'syntax keyword jsNan NaN ' .( exists ( 'g:javascript_conceal_NaN' ) ? 'conceal cchar=' .g :javascript_conceal_NaN : '' )
exe 'syntax keyword jsNan NaN ' .( exists ( 'g:javascript_conceal_NaN' ) ? 'conceal cchar=' .g :javascript_conceal_NaN : '' )
exe 'syntax keyword jsPrototype prototype ' .( exists ( 'g:javascript_conceal_prototype' ) ? 'conceal cchar=' .g :javascript_conceal_prototype : '' )
exe 'syntax keyword jsPrototype prototype ' .( exists ( 'g:javascript_conceal_prototype' ) ? 'conceal cchar=' .g :javascript_conceal_prototype : '' )
@ -97,24 +99,27 @@ exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal
exe 'syntax keyword jsSuper super contained ' .( exists ( 'g:javascript_conceal_super' ) ? 'conceal cchar=' .g :javascript_conceal_super : '' )
exe 'syntax keyword jsSuper super contained ' .( exists ( 'g:javascript_conceal_super' ) ? 'conceal cchar=' .g :javascript_conceal_super : '' )
" Statement Keywords
" Statement Keywords
syntax keyword jsStatement contained break continue with yield debugger
syntax match jsBlockLabel /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\s*::\@!/ contains = jsNoise skipwhite skipempty nextgroup = jsBlock
syntax keyword jsConditional if skipwhite skipempty nextgroup = jsParenIfElse
syntax match jsBlockLabelKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*\%(;\|\n\)\)\@=/
syntax keyword jsConditional else skipwhite skipempty nextgroup = jsCommentMisc , jsIfElseBlock
syntax keyword jsStatement contained with yield debugger
syntax keyword jsConditional switch skipwhite skipempty nextgroup = jsParenSwitch
syntax keyword jsStatement contained break continue skipwhite skipempty nextgroup = jsBlockLabelKey
syntax keyword jsRepeat while for skipwhite skipempty nextgroup = jsParenRepeat , jsForAwait
syntax keyword jsConditional if skipwhite skipempty nextgroup = jsParenIfElse
syntax keyword jsDo do skipwhite skipempty nextgroup = jsRepeatBlock
syntax keyword jsConditional else skipwhite skipempty nextgroup = jsCommentIfElse , jsIfElseBlock
syntax keyword jsLabel contained case default
syntax keyword jsConditional switch skipwhite skipempty nextgroup = jsParenSwitch
syntax keyword jsTry try skipwhite skipempty nextgroup = jsTryCatchBlock
syntax keyword jsRepeat while for skipwhite skipempty nextgroup = jsParenRepeat , jsForAwait
syntax keyword jsFinally contained finally skipwhite skipempty nextgroup = jsFinallyBlock
syntax keyword jsDo do skipwhite skipempty nextgroup = jsRepeatBlock
syntax keyword jsCatch contained catch skipwhite skipempty nextgroup = jsParenCatch
syntax region jsSwitchCase contained matchgroup = jsLabel start = /\<\%(case\|default\)\>/ end = /:\@=/ contains = @jsExpression , jsLabel skipwhite skipempty nextgroup = jsSwitchColon keepend
syntax keyword jsTry try skipwhite skipempty nextgroup = jsTryCatchBlock
syntax keyword jsFinally contained finally skipwhite skipempty nextgroup = jsFinallyBlock
syntax keyword jsCatch contained catch skipwhite skipempty nextgroup = jsParenCatch
syntax keyword jsException throw
syntax keyword jsException throw
syntax keyword jsAsyncKeyword async await
syntax keyword jsAsyncKeyword async await
syntax match jsSwitchColon contained /:/ skipwhite skipempty nextgroup = jsSwitchBlock
syntax match jsSwitchColon contained /: :\@! / skipwhite skipempty nextgroup = jsSwitchBlock
" Keywords
" Keywords
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
syntax keyword jsGlobalNodeObjects module exports global process
syntax keyword jsGlobalNodeObjects module exports global process __dirname __filename
syntax match jsGlobalNodeObjects / require/ containedin = jsFuncCall
syntax match jsGlobalNodeObjects / \< require\> / containedin = jsFuncCall
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval
syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval
" DISCUSS: How imporant is this, really? Perhaps it should be linked to an error because I assume the keywords are reserved?
" DISCUSS: How imporant is this, really? Perhaps it should be linked to an error because I assume the keywords are reserved?
@ -135,29 +140,29 @@ syntax keyword jsDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECT
syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
" Code blocks
" Code blocks
syntax region jsBracket matchgroup = jsBrackets start = /\[/ end = /\]/ contains = @jsExpression extend fold
syntax region jsBracket matchgroup = jsBrackets start = /\[/ end = /\]/ contains = @jsExpression , jsSpreadExpression extend fold
syntax region jsParen matchgroup = jsParens start = /(/ end = /)/ contains = @js All extend fold
syntax region jsParen matchgroup = jsParens start = /(/ end = /)/ contains = @js Expression extend fold nextgroup = jsFlowDefinition
syntax region jsParenDecorator contained matchgroup = jsParensDecorator start = /(/ end = /)/ contains = @jsAll skipwhite skipempty nextgroup = jsCommentMisc extend fold
syntax region jsParenDecorator contained matchgroup = jsParensDecorator start = /(/ end = /)/ contains = @jsAll extend fold
syntax region jsParenIfElse contained matchgroup = jsParensIfElse start = /(/ end = /)/ contains = @jsAll skipwhite skipempty nextgroup = jsComment Misc , jsIfElseBlock extend fold
syntax region jsParenIfElse contained matchgroup = jsParensIfElse start = /(/ end = /)/ contains = @jsAll skipwhite skipempty nextgroup = jsComment IfElse , jsIfElseBlock extend fold
syntax region jsParenRepeat contained matchgroup = jsParensRepeat start = /(/ end = /)/ contains = @jsAll skipwhite skipempty nextgroup = jsComment Misc , jsRepeatBlock extend fold
syntax region jsParenRepeat contained matchgroup = jsParensRepeat start = /(/ end = /)/ contains = @jsAll skipwhite skipempty nextgroup = jsComment Repeat , jsRepeatBlock extend fold
syntax region jsParenSwitch contained matchgroup = jsParensSwitch start = /(/ end = /)/ contains = @jsAll skipwhite skipempty nextgroup = jsSwitchBlock extend fold
syntax region jsParenSwitch contained matchgroup = jsParensSwitch start = /(/ end = /)/ contains = @jsAll skipwhite skipempty nextgroup = jsSwitchBlock extend fold
syntax region jsParenCatch contained matchgroup = jsParensCatch start = /(/ end = /)/ skipwhite skipempty nextgroup = jsTryCatchBlock extend fold
syntax region jsParenCatch contained matchgroup = jsParensCatch start = /(/ end = /)/ skipwhite skipempty nextgroup = jsTryCatchBlock extend fold
syntax region jsFuncArgs contained matchgroup = jsFuncParens start = /(/ end = /)/ contains = jsFuncArgCommas , jsComment , jsFuncArgExpression , jsDestructuringBlock , js RestExpression, jsFlowArgumentDef skipwhite skipempty nextgroup = jsCommentFunction , jsFuncBlock , jsFlowReturn extend fold
syntax region jsFuncArgs contained matchgroup = jsFuncParens start = /(/ end = /)/ contains = jsFuncArgCommas , jsComment , jsFuncArgExpression , jsDestructuringBlock , js DestructuringArray, js RestExpression, jsFlowArgumentDef skipwhite skipempty nextgroup = jsCommentFunction , jsFuncBlock , jsFlowReturn extend fold
syntax region jsClassBlock contained matchgroup = jsClassBraces start = /{/ end = /}/ contains = jsClassFuncName , jsClassMethodType , jsArrowFunction , jsArrowFuncArgs , jsComment , jsGenerator , jsDecorator , jsClassProperty , jsClassPropertyComputed , jsClassStringKey , js Noise extend fold
syntax region jsClassBlock contained matchgroup = jsClassBraces start = /{/ end = /}/ contains = jsClassFuncName , jsClassMethodType , jsArrowFunction , jsArrowFuncArgs , jsComment , jsGenerator , jsDecorator , jsClassProperty , jsClassPropertyComputed , jsClassStringKey , js AsyncKeyword, js Noise extend fold
syntax region jsFuncBlock contained matchgroup = jsFuncBraces start = /{/ end = /}/ contains = @jsAll extend fold
syntax region jsFuncBlock contained matchgroup = jsFuncBraces start = /{/ end = /}/ contains = @jsAll , jsBlock extend fold
syntax region jsIfElseBlock contained matchgroup = jsIfElseBraces start = /{/ end = /}/ contains = @jsAll extend fold
syntax region jsIfElseBlock contained matchgroup = jsIfElseBraces start = /{/ end = /}/ contains = @jsAll , jsBlock extend fold
syntax region js Block contained matchgroup = js Braces start = /{/ end = /}/ contains = @jsAll extend fold
syntax region js TryCatch Block contained matchgroup = js TryCatch Braces start = /{/ end = /}/ contains = @jsAll , jsBlock skipwhite skipempty nextgroup = jsCatch , jsFinally extend fold
syntax region js TryCatchBlock contained matchgroup = jsTryCatchBraces start = /{/ end = /}/ contains = @jsAll skipwhite skipempty nextgroup = jsCatch , jsFinally extend fold
syntax region js FinallyBlock contained matchgroup = jsFinallyBraces start = /{/ end = /}/ contains = @jsAll , jsBlock extend fold
syntax region js FinallyBlock contained matchgroup = jsFinallyBraces start = /{/ end = /}/ contains = @jsAll extend fold
syntax region js SwitchBlock contained matchgroup = jsSwitchBraces start = /{/ end = /}/ contains = @jsAll , jsBlock , jsSwitchCase extend fold
syntax region js SwitchBlock contained matchgroup = jsSwitch Braces start = /{/ end = /}/ contains = @jsAll , js Label, jsSwitchColon extend fold
syntax region js RepeatBlock contained matchgroup = jsRepeat Braces start = /{/ end = /}/ contains = @jsAll , js Block extend fold
syntax region js RepeatBlock contained matchgroup = jsRepeatBraces start = /{/ end = /}/ contains = @jsAll extend fold
syntax region js DestructuringBlock contained matchgroup = jsDestructuringBraces start = /{/ end = /}/ contains = jsDestructuringProperty , jsDestructuringAssignment , jsDestructuringNoise , jsDestructuringPropertyComputed , jsSpreadExpression , jsComment extend fold
syntax region jsDestructuring Block contained matchgroup = jsDestructuringBraces start = / {/ end = /}/ contains = jsDestructuringProperty , jsDestructuringAssignment , jsDestructuringNoise , jsDestructuringPropertyComputed , jsSpreadExpression extend fold
syntax region jsDestructuring Array contained matchgroup = jsDestructuringBraces start = / \[/ end = /\]/ contains = jsDestructuringPropertyValue , jsNoise , jsDestructuringProperty , jsSpreadExpression , jsComment extend fold
syntax region js DestructuringArray contained matchgroup = jsDestructuringBraces start = /\[/ end = /\]/ contains = jsDestructuringPropertyValue , jsNoise , jsDestructuringProperty , jsSpreadExpression extend fold
syntax region js Object contained matchgroup = jsObjectBraces start = /{/ end = /}/ contains = jsObjectKey , jsObjectKeyString , jsObjectKeyComputed , jsObjectSeparator , jsObjectFuncName , jsObjectMethodType , jsGenerator , jsComment , jsObjectStringKey , jsSpreadExpression , jsDecorator , jsAsyncKeyword extend fold
syntax region js Object matchgroup = js Object Braces start = /{/ end = /}/ contains = jsObjectKey , jsObjectKeyString , jsObjectKeyComputed , jsObjectSeparator , jsObjectFuncName , jsObjectMethodType , jsGenerator , jsComment , jsObjectStringKey , jsSpreadExpression , jsDecorator extend fold
syntax region js Block matchgroup = js Braces start = /{/ end = /}/ contains = @jsAll , jsSpreadExpression extend fold
syntax region js TernaryIf matchgroup = jsTernaryIfOperator start = /?/ end = /\%(:\|[\}]\@=\)/ contains = @jsExpression
syntax region js ModuleGroup contained matchgroup = jsModuleBraces start = /{/ end = /}/ contains = jsModuleKeyword , jsModuleComma , jsModuleAs , jsComment , jsFlowTypeKeyword skipwhite skipempty nextgroup = jsFrom fold
syntax region jsSpreadExpression contained matchgroup = jsSpreadOperator start = /\.\.\./ end = /[,}\]]\@=/ contains = @jsExpression
syntax region jsSpreadExpression contained matchgroup = jsSpreadOperator start = /\.\.\./ end = /[,}\]]\@=/ contains = @jsExpression
syntax region jsRestExpression contained matchgroup = jsRestOperator start = /\.\.\./ end = /[,)]\@=/
syntax region jsRestExpression contained matchgroup = jsRestOperator start = /\.\.\./ end = /[,)]\@=/
syntax region jsTernaryIf matchgroup = jsTernaryIfOperator start = /?/ end = /\%(:\|[\}]\@=\)/ contains = @jsExpression
syntax region jsTernaryIf matchgroup = jsTernaryIfOperator start = /?/ end = /\%(:\|[\}]\@=\)/ contains = @jsExpression extend skipwhite skipempty nextgroup = @jsExpression
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup = jsFuncName , jsFuncArgs
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup = jsFuncName , jsFuncArgs
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup = jsFuncArgs , jsFlowFunctionGroup
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup = jsFuncArgs , jsFlowFunctionGroup
@ -173,13 +178,16 @@ syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipe
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite ' .( exists ( 'g:javascript_conceal_function' ) ? 'conceal cchar=' .g :javascript_conceal_function : '' )
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite ' .( exists ( 'g:javascript_conceal_function' ) ? 'conceal cchar=' .g :javascript_conceal_function : '' )
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock,jsCommentFunction ' .( exists ( 'g:javascript_conceal_arrow_function' ) ? 'conceal cchar=' .g :javascript_conceal_arrow_function : '' )
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock,jsCommentFunction ' .( exists ( 'g:javascript_conceal_arrow_function' ) ? 'conceal cchar=' .g :javascript_conceal_arrow_function : '' )
exe 'syntax match jsArrowFunction /()\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction ' .( exists ( 'g:javascript_conceal_noarg_arrow_function' ) ? 'conceal cchar=' .g :javascript_conceal_noarg_arrow_function : '' ) .( ' contains=jsArrowFuncArgs' )
exe 'syntax match jsArrowFunction /_\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction ' .( exists ( 'g:javascript_conceal_underscore_arrow_function' ) ? 'conceal cchar=' .g :javascript_conceal_underscore_arrow_function : '' )
" Classes
" Classes
syntax keyword jsClassKeywords contained extends class
syntax keyword jsClassKeyword contained class
syntax keyword jsExtendsKeyword contained extends skipwhite skipempty nextgroup = @jsExpression
syntax match jsClassNoise contained /\./
syntax match jsClassNoise contained /\./
syntax match jsClassMethodType contained /\%(get\|set\|static\ |async\ )\%( \k\+\)\@=/ skipwhite skipempty nextgroup = jsFuncName , jsClassProperty
syntax match jsClassMethodType contained /\%(get\|set\|static\ )\%( \k\+\)\@=/ skipwhite skipempty nextgroup = jsAsyncKeyword , jsFuncName , jsClassProperty
syntax match jsClassDefinition /\<class\>\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains = jsClassKeywords , jsClassNoise skipwhite skipempty nextgroup = jsCommentClass , jsClassBlock , jsFlowClassGroup
syntax region jsClassDefinition start = /\<class\>/ end = /\(\<extends\>\s\+\)\@<!{\@=/ contains = jsClassKeyword , jsExtendsKeyword , jsClassNoise , @jsExpression , jsFlowClassGroup skipwhite skipempty nextgroup = jsCommentClass , jsClassBlock , jsFlowClassGroup
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s* =\)\@=/ skipwhite skipempty nextgroup = jsClassValue
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s* [ =:] \)\@=/ skipwhite skipempty nextgroup = jsClassValue , jsFlowClassDef
syntax region jsClassValue contained start = /=/ end = /\%(;\|}\|\n\)\@=/ contains = @jsExpression
syntax region jsClassValue contained start = /=/ end = /\%(;\|}\|\n\)\@=/ contains = @jsExpression
syntax region jsClassPropertyComputed contained matchgroup = jsBrackets start = /\[/ end = /]/ contains = @jsExpression skipwhite skipempty nextgroup = jsFuncArgs , jsClassValue extend
syntax region jsClassPropertyComputed contained matchgroup = jsBrackets start = /\[/ end = /]/ contains = @jsExpression skipwhite skipempty nextgroup = jsFuncArgs , jsClassValue extend
syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*(\)\@=/ skipwhite skipempty nextgroup = jsFuncArgs
syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*(\)\@=/ skipwhite skipempty nextgroup = jsFuncArgs
@ -208,8 +216,10 @@ syntax region jsCommentFunction contained start=/\/\// end=/$/ contains=j
syntax region jsCommentFunction contained start = /\/\*/ end = /\*\// contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsFuncBlock , jsFlowReturn fold extend keepend
syntax region jsCommentFunction contained start = /\/\*/ end = /\*\// contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsFuncBlock , jsFlowReturn fold extend keepend
syntax region jsCommentClass contained start = /\/\// end = /$/ contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsClassBlock , jsFlowClassGroup extend keepend
syntax region jsCommentClass contained start = /\/\// end = /$/ contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsClassBlock , jsFlowClassGroup extend keepend
syntax region jsCommentClass contained start = /\/\*/ end = /\*\// contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsClassBlock , jsFlowClassGroup fold extend keepend
syntax region jsCommentClass contained start = /\/\*/ end = /\*\// contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsClassBlock , jsFlowClassGroup fold extend keepend
syntax region jsCommentMisc contained start = /\/\// end = /$/ contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsBlock extend keepend
syntax region jsCommentIfElse contained start = /\/\// end = /$/ contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsIfElseBlock extend keepend
syntax region jsCommentMisc contained start = /\/\*/ end = /\*\// contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsBlock fold extend keepend
syntax region jsCommentIfElse contained start = /\/\*/ end = /\*\// contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsIfElseBlock fold extend keepend
syntax region jsCommentRepeat contained start = /\/\// end = /$/ contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsRepeatBlock extend keepend
syntax region jsCommentRepeat contained start = /\/\*/ end = /\*\// contains = jsCommentTodo , @Spell skipwhite skipempty nextgroup = jsRepeatBlock fold extend keepend
" Decorators
" Decorators
syntax match jsDecorator /^\s*@/ nextgroup = jsDecoratorFunction
syntax match jsDecorator /^\s*@/ nextgroup = jsDecoratorFunction
@ -227,8 +237,8 @@ if exists("javascript_plugin_flow")
runtime extras /flow .vim
runtime extras /flow .vim
endif
endif
syntax cluster jsExpression contains = jsBracket , jsParen , jsObject , js Block, js TernaryIf, jsTaggedTemplate , jsTemplateString , jsString , jsRegexpString , jsNumber , jsFloat , jsOperator , jsBooleanTrue , jsBooleanFalse , jsNull , jsFunction , jsArrowFunction , jsGlobalObjects , jsExceptions , jsFutureKeys , jsDomErrNo , jsDomNodeConsts , jsHtmlEvents , jsFuncCall , jsUndefined , jsNan , jsPrototype , jsBuiltins , jsNoise , jsClassDefinition , jsArrowFunction , jsArrowFuncArgs , jsParensError , jsComment , jsArguments , jsThis , jsSuper , jsDo
syntax cluster jsExpression contains = jsBracket , jsParen , jsObject , js TernaryIf, jsTaggedTemplate , jsTemplateString , jsString , jsRegexpString , jsNumber , jsFloat , jsOperator , jsBooleanTrue , jsBooleanFalse , jsNull , jsFunction , jsArrowFunction , jsGlobalObjects , jsExceptions , jsFutureKeys , jsDomErrNo , jsDomNodeConsts , jsHtmlEvents , jsFuncCall , jsUndefined , jsNan , jsPrototype , jsBuiltins , jsNoise , jsClassDefinition , jsArrowFunction , jsArrowFuncArgs , jsParensError , jsComment , jsArguments , jsThis , jsSuper , jsDo , jsForAwait , jsAsyncKeyword
syntax cluster jsAll contains = @jsExpression , js ExportContainer, jsImportContainer , js StorageClass, jsConditional , jsRepeat , jsReturn , jsStatement , jsException , jsTry , js AsyncKeyword
syntax cluster jsAll contains = @jsExpression , js StorageClass, jsConditional , jsRepeat , jsReturn , jsStatement , jsException , jsTry , js Noise, jsBlockLabel
" Define the default highlighting.
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.7 and earlier: only when not done already
@ -290,7 +300,8 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsOperator Operator
HiLink jsOperator Operator
HiLink jsOf Operator
HiLink jsOf Operator
HiLink jsStorageClass StorageClass
HiLink jsStorageClass StorageClass
HiLink jsClassKeywords Keyword
HiLink jsClassKeyword Keyword
HiLink jsExtendsKeyword Keyword
HiLink jsThis Special
HiLink jsThis Special
HiLink jsSuper Constant
HiLink jsSuper Constant
HiLink jsNan Number
HiLink jsNan Number
@ -309,30 +320,32 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsFuncParens Noise
HiLink jsFuncParens Noise
HiLink jsClassBraces Noise
HiLink jsClassBraces Noise
HiLink jsClassNoise Noise
HiLink jsClassNoise Noise
HiLink jsIfElseBraces jsBraces
HiLink jsIfElseBraces Noise
HiLink jsTryCatchBraces jsBraces
HiLink jsTryCatchBraces Noise
HiLink jsModuleBraces jsBraces
HiLink jsModuleBraces Noise
HiLink jsObjectBraces Noise
HiLink jsObjectBraces Noise
HiLink jsObjectSeparator Noise
HiLink jsObjectSeparator Noise
HiLink jsFinallyBraces jsBraces
HiLink jsFinallyBraces Noise
HiLink jsRepeatBraces jsBraces
HiLink jsRepeatBraces Noise
HiLink jsSwitchBraces jsBraces
HiLink jsSwitchBraces Noise
HiLink jsExportBraces jsBraces
HiLink jsSpecial Special
HiLink jsSpecial Special
HiLink jsTemplateVar Special
HiLink jsTemplateBraces Noise
HiLink jsTemplateBraces jsBraces
HiLink jsGlobalObjects Constant
HiLink jsGlobalObjects Constant
HiLink jsGlobalNodeObjects Constant
HiLink jsGlobalNodeObjects Constant
HiLink jsExceptions Constant
HiLink jsExceptions Constant
HiLink jsBuiltins Constant
HiLink jsBuiltins Constant
HiLink jsModuleKeywords Include
HiLink jsImport Include
HiLink jsModuleOperators Include
HiLink jsExport Include
HiLink jsModuleDefault Include
HiLink jsExportDefault StorageClass
HiLink jsExportDefaultGroup jsExportDefault
HiLink jsModuleAs Include
HiLink jsModuleComma jsNoise
HiLink jsModuleAsterisk Noise
HiLink jsFrom Include
HiLink jsDecorator Special
HiLink jsDecorator Special
HiLink jsDecoratorFunction Function
HiLink jsDecoratorFunction Function
HiLink jsParensDecorator jsParens
HiLink jsParensDecorator jsParens
HiLink jsFuncArgOperator jsFuncArgs
HiLink jsFuncArgOperator jsFuncArgs
HiLink jsModuleAsterisk Noise
HiLink jsClassProperty jsObjectKey
HiLink jsClassProperty jsObjectKey
HiLink jsSpreadOperator Operator
HiLink jsSpreadOperator Operator
HiLink jsRestOperator Operator
HiLink jsRestOperator Operator
@ -341,6 +354,8 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsClassMethodType Type
HiLink jsClassMethodType Type
HiLink jsObjectMethodType Type
HiLink jsObjectMethodType Type
HiLink jsClassDefinition jsFuncName
HiLink jsClassDefinition jsFuncName
HiLink jsBlockLabel Identifier
HiLink jsBlockLabelKey jsBlockLabel
HiLink jsDestructuringBraces Noise
HiLink jsDestructuringBraces Noise
HiLink jsDestructuringProperty jsFuncArgs
HiLink jsDestructuringProperty jsFuncArgs
@ -349,7 +364,8 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsCommentFunction jsComment
HiLink jsCommentFunction jsComment
HiLink jsCommentClass jsComment
HiLink jsCommentClass jsComment
HiLink jsCommentMisc jsComment
HiLink jsCommentIfElse jsComment
HiLink jsCommentRepeat jsComment
HiLink jsDomErrNo Constant
HiLink jsDomErrNo Constant
HiLink jsDomNodeConsts Constant
HiLink jsDomNodeConsts Constant
@ -366,7 +382,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
endif
endif
" Define the htmlJavaScript for HTML syntax html.vim
" Define the htmlJavaScript for HTML syntax html.vim
syntax cluster htmlJavaScript contains = @jsAll
syntax cluster htmlJavaScript contains = @jsAll , jsImport , jsExport
syntax cluster javaScriptExpression contains = @jsAll
syntax cluster javaScriptExpression contains = @jsAll
" Vim's default html.vim highlights all javascript as 'Special'
" Vim's default html.vim highlights all javascript as 'Special'