diff --git a/extras/flow.vim b/extras/flow.vim index 7d981a80..6ae9b901 100644 --- a/extras/flow.vim +++ b/extras/flow.vim @@ -12,6 +12,7 @@ syntax match jsFlowNoise contained /[:;,<>]/ syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise syntax keyword jsFlowStorageClass contained const var let syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue +syntax region jsFlowClass contained matchgroup=jsFlowNoise start=// oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock if version >= 508 || !exists("did_javascript_syn_inits") if version < 508 @@ -26,6 +27,8 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsFlowDeclareBlock PreProc HiLink jsFlowObject PreProc HiLink jsFlowParenRegion PreProc + HiLink jsFlowClass PreProc + HiLink jsFlowClassProperty jsClassProperty HiLink jsFlowType Type HiLink jsFlowDeclareKeyword Type HiLink jsFlowNoise Noise diff --git a/syntax/javascript.vim b/syntax/javascript.vim index 54c72096..8486cce0 100644 --- a/syntax/javascript.vim +++ b/syntax/javascript.vim @@ -45,7 +45,7 @@ syntax match jsModuleAsterisk contained /*/ syntax keyword jsModuleDefault contained default skipwhite kipempty nextgroup=@jsExpression syntax region jsImportContainer start=/\ / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsComment,jsString,jsTemplateString,jsNoise,jsModuleGroup,jsModuleAsterisk syntax region jsExportContainer start=/\ / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsStorageClass,jsModuleDefault,@jsExpression -syntax region jsExportBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise +syntax region jsExportBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise " Strings, Templates, Numbers syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend @@ -165,7 +165,7 @@ exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFunc syntax keyword jsClassKeywords contained extends class syntax match jsClassNoise contained /\./ syntax match jsClassMethodDefinitions contained /\%(get\|set\|static\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsFuncName,jsClassProperty -syntax match jsClassDefinition /\\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise skipwhite skipempty nextgroup=jsClassBlock +syntax match jsClassDefinition /\\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise skipwhite skipempty nextgroup=jsClassBlock,jsFlowClass syntax match jsDecorator contained "@" nextgroup=jsDecoratorFunction syntax match jsDecoratorFunction contained "[a-zA-Z_][a-zA-Z0-9_.]*" syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsClassValue @@ -180,9 +180,9 @@ syntax match jsDestructuringPropertyValue contained /\<[0-9a-zA-Z_$]*\>/ syntax match jsDestructuringProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValue syntax match jsDestructuringAssignment contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend -syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise extend +syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend syntax match jsDestructuringNoise contained /[,\[\]]/ -syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpresslon skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold +syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold " Comments syntax keyword jsCommentTodo contained TODO FIXME XXX TBD