Skip to content

Commit 35da051

Browse files
committed
[flow] Add support for generic types in class functions
1 parent c99c96b commit 35da051

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

extras/flow.vim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ syntax region jsFlowReturnGroup contained matchgroup=jsFlowNoise start=/</ e
2727
syntax match jsFlowReturnOrOp contained /\s*|\s*/ skipwhite skipempty nextgroup=@jsFlowReturnCluster
2828
syntax match jsFlowWildcardReturn contained /*/ skipwhite skipempty nextgroup=jsFuncBlock
2929

30-
syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
31-
syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
30+
syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
31+
syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
32+
syntax region jsFlowClassFunctionGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
3233

3334
syntax region jsFlowTypeStatement start=/type\%(\s\+\k\)\@=/ end=/=\@=/ contains=jsFlowTypeOperator oneline skipwhite skipempty nextgroup=jsFlowTypeValue keepend
3435
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/=/ end=/[\n;]/ contains=@jsFlowCluster,jsFlowGroup,jsFlowMaybe
@@ -81,6 +82,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
8182
HiLink jsFlowReturnGroup jsFlowGroup
8283
HiLink jsFlowFunctionGroup PreProc
8384
HiLink jsFlowClassGroup PreProc
85+
HiLink jsFlowClassFunctionGroup PreProc
8486
HiLink jsFlowArrowArguments PreProc
8587
HiLink jsFlowArrow PreProc
8688
HiLink jsFlowReturnArrow PreProc

syntax/javascript.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ exe 'syntax match jsArrowFunction /_\ze\s*=>/ skipwhite skipempty nextgroup=j
179179
syntax keyword jsClassKeyword contained class
180180
syntax keyword jsExtendsKeyword contained extends skipwhite skipempty nextgroup=@jsExpression
181181
syntax match jsClassNoise contained /\./
182-
syntax match jsClassFuncName contained /\<\K\k*\ze\s*(/ skipwhite skipempty nextgroup=jsFuncArgs
182+
syntax match jsClassFuncName contained /\<\K\k*\ze\s*[(<]/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowClassFunctionGroup
183183
syntax match jsClassMethodType contained /\<\%([gs]et\|static\)\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsClassFuncName,jsClassProperty
184184
syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression,jsFlowClassGroup skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
185185
syntax match jsClassProperty contained /\<\K\k*\ze\s*=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef

0 commit comments

Comments
 (0)