Skip to content

Commit 0992aa1

Browse files
committed
Misc improvements to flow
1 parent 3c90d0c commit 0992aa1

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

extras/flow.vim

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ syntax match jsFlowNoise contained /[:;,<>]/
88
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array Function object array bool class
99
syntax keyword jsFlowTypeof contained typeof skipempty skipwhite nextgroup=jsFlowTypeCustom,jsFlowType
1010
syntax match jsFlowTypeCustom contained /[0-9a-zA-Z_.]*/ skipwhite skipempty nextgroup=jsFlowGeneric
11-
syntax region jsFlowGeneric matchgroup=jsFlowNoise start=/\k\@<=</ end=/>/ contains=@jsFlowCluster containedin=@jsExpression,jsFlowDeclareBlock
12-
syntax region jsFlowGeneric contained matchgroup=jsFlowNoise start=/</ end=/>(\@=/ oneline contains=@jsFlowCluster containedin=@jsExpression,jsFlowDeclareBlock
13-
syntax region jsFlowObjectGeneric contained matchgroup=jsFlowNoise start=/\k\@<=</ end=/>/ contains=@jsFlowCluster nextgroup=jsFuncArgs
11+
syntax region jsFlowGeneric matchgroup=jsFlowNoise start=/\k\@<=</ end=/>/ keepend extend contains=@jsFlowCluster containedin=@jsExpression,jsFlowDeclareBlock
12+
syntax region jsFlowFunctionGeneric contained matchgroup=jsFlowNoise start=/</ end=/>(\@=/ keepend extend oneline contains=@jsFlowCluster nextgroup=jsFuncArgs
13+
" syntax region jsFlowFunctionGeneric contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
14+
" syntax region jsFlowObjectGeneric contained matchgroup=jsFlowNoise start=/\k\@<=</ end=/>/ keepend extend contains=@jsFlowCluster nextgroup=jsFuncArgs
1415
syntax match jsFlowArrow contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens
1516
syntax match jsFlowObjectKey contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject
1617
syntax match jsFlowOrOperator contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster
@@ -29,7 +30,6 @@ syntax match jsFlowReturnOrOp contained /\s*|\s*/ skipwhite skipempty next
2930
syntax match jsFlowWildcardReturn contained /*/ skipwhite skipempty nextgroup=jsFuncBlock
3031
syntax keyword jsFlowTypeofReturn contained typeof skipempty skipwhite nextgroup=@jsFlowReturnCluster
3132

32-
syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
3333
syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
3434
syntax region jsFlowClassFunctionGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
3535
syntax match jsFlowObjectFuncName contained /\<\K\k*<\@=/ skipwhite skipempty nextgroup=jsFlowObjectGeneric containedin=jsObject
@@ -40,20 +40,23 @@ syntax match jsFlowTypeOperator contained /=/ containedin=jsFlowTypeValue
4040
syntax match jsFlowTypeOperator contained /=/
4141
syntax keyword jsFlowTypeKeyword contained type
4242

43-
syntax keyword jsFlowDeclare declare skipwhite skipempty nextgroup=jsFlowTypeStatement,jsClassDefinition,jsStorageClass,jsFlowModule,jsFlowInterface
43+
syntax keyword jsFlowDeclare declare skipwhite skipempty nextgroup=jsFlowTypeStatement,jsClassDefinition,jsStorageClass,jsFlowModule,jsFlowInterface,jsFlowExport
44+
syntax keyword jsFlowInterface interface skipwhite skipempty nextgroup=jsFlowInterfaceName
45+
syntax match jsFlowInterfaceName contained /\<[0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup=jsClassBlock
46+
syntax keyword jsFlowExport export skipwhite skipempty nextgroup=jsFlowTypeStatement,jsClassDefinition,jsStorageClass,jsFlowModule,jsFlowInterface,jsExportDefault
4447
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlowClassDef containedin=jsClassBlock
4548
syntax region jsFlowClassDef contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassValue
4649

4750
syntax region jsFlowModule contained start=/module/ end=/\%({\|:\)\@=/ skipempty skipwhite nextgroup=jsFlowDeclareBlock contains=jsString
4851
syntax region jsFlowInterface contained start=/interface/ end=/{\@=/ skipempty skipwhite nextgroup=jsFlowInterfaceBlock contains=@jsFlowCluster
49-
syntax region jsFlowDeclareBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise fold
52+
syntax region jsFlowDeclareBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise,jsComment fold
5053

5154
syntax match jsFlowMaybe contained /?/
5255
syntax region jsFlowInterfaceBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsFlowObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsFlowNoise,jsFlowParens,jsFlowGeneric keepend fold
5356

5457
syntax region jsFlowParenAnnotation contained start=/:/ end=/[,=)]\@=/ containedin=jsParen contains=@jsFlowCluster
5558

56-
syntax cluster jsFlowReturnCluster contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp,jsFlowWildcardReturn,jsFlowReturnArrow,jsFlowTypeofReturn
59+
syntax cluster jsFlowReturnCluster contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp,jsFlowWildcardReturn,jsFlowReturnArrow,jsFlowTypeofReturn,jsFlowGeneric
5760
syntax cluster jsFlowCluster contains=jsFlowArray,jsFlowObject,jsFlowExactObject,jsFlowNoise,jsFlowTypeof,jsFlowType,jsFlowGeneric,jsFlowMaybe,jsFlowParens,jsFlowOrOperator,jsFlowWildcard
5861

5962
if version >= 508 || !exists("did_javascript_syn_inits")
@@ -75,14 +78,15 @@ if version >= 508 || !exists("did_javascript_syn_inits")
7578
HiLink jsFlowExactObject PreProc
7679
HiLink jsFlowParens PreProc
7780
HiLink jsFlowGeneric PreProc
81+
HiLink jsFlowFunctionGeneric jsFlowGeneric
7882
HiLink jsFlowObjectGeneric jsFlowGeneric
7983
HiLink jsFlowReturn PreProc
8084
HiLink jsFlowParenAnnotation PreProc
8185
HiLink jsFlowReturnObject jsFlowReturn
8286
HiLink jsFlowReturnArray jsFlowArray
8387
HiLink jsFlowReturnParens jsFlowParens
8488
HiLink jsFlowReturnGroup jsFlowGeneric
85-
HiLink jsFlowFunctionGroup PreProc
89+
" HiLink jsFlowFunctionGroup PreProc
8690
HiLink jsFlowClassGroup PreProc
8791
HiLink jsFlowClassFunctionGroup PreProc
8892
HiLink jsFlowArrow PreProc
@@ -94,6 +98,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
9498
HiLink jsFlowReturnMaybe PreProc
9599
HiLink jsFlowClassProperty jsClassProperty
96100
HiLink jsFlowDeclare PreProc
101+
HiLink jsFlowExport PreProc
97102
HiLink jsFlowModule PreProc
98103
HiLink jsFlowInterface PreProc
99104
HiLink jsFlowNoise Noise
@@ -104,6 +109,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
104109
HiLink jsFlowWildcardReturn PreProc
105110
HiLink jsFlowImportType PreProc
106111
HiLink jsFlowTypeValue PreProc
112+
HiLink jsFlowReturnKeyword PreProc
107113
HiLink jsFlowObjectFuncName jsObjectFuncName
108114
delcommand HiLink
109115
endif

syntax/javascript.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ syntax match jsOperator /?\.\ze\_D/
161161
syntax match jsOperator /??/ skipwhite skipempty nextgroup=@jsExpression
162162

163163
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs,jsFlowFunctionGroup
164-
syntax match jsFuncName contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup
164+
syntax match jsFuncName contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGeneric
165165
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
166166
syntax match jsFuncArgCommas contained ','
167167
syntax keyword jsArguments contained arguments
@@ -195,7 +195,7 @@ syntax match jsDestructuringProperty contained /\k\+\ze\s*=/ skipwhit
195195
syntax match jsDestructuringAssignment contained /\k\+\ze\s*:/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment
196196
syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend
197197
syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend
198-
syntax match jsDestructuringNoise contained /[,[\]]/
198+
syntax match jsDestructuringNoise contained /[,]/
199199
syntax region jsDestructuringPropertyComputed contained matchgroup=jsDestructuringBraces start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringValueAssignment,jsDestructuringNoise extend fold
200200

201201
" Comments

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy