summaryrefslogtreecommitdiffstats
path: root/syntax/basic/cluster.vim
blob: f5eb59d18a4ba86676a4c27e688553631a403c31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
let files = filter(globpath(&rtp, 'syntax/basic/cluster.vim', 1, 1), { _, v -> v !~ "vim-polyglot" && v !~ $VIMRUNTIME && v !~ "after" })
if len(files) > 0
  exec 'source ' . files[0]
  finish
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1

"Block VariableStatement EmptyStatement ExpressionStatement IfStatement IterationStatement ContinueStatement BreakStatement ReturnStatement WithStatement LabelledStatement SwitchStatement ThrowStatement TryStatement DebuggerStatement
syntax cluster typescriptStatement
  \ contains=typescriptBlock,typescriptVariable,
  \ @typescriptTopExpression,typescriptAssign,
  \ typescriptConditional,typescriptRepeat,typescriptBranch,
  \ typescriptLabel,typescriptStatementKeyword,
  \ typescriptFuncKeyword,
  \ typescriptTry,typescriptExceptions,typescriptDebugger,
  \ typescriptExport,typescriptInterfaceKeyword,typescriptEnum,
  \ typescriptModule,typescriptAliasKeyword,typescriptImport

syntax cluster typescriptPrimitive  contains=typescriptString,typescriptTemplate,typescriptRegexpString,typescriptNumber,typescriptBoolean,typescriptNull,typescriptArray

syntax cluster typescriptEventTypes            contains=typescriptEventString,typescriptTemplate,typescriptNumber,typescriptBoolean,typescriptNull

" top level expression: no arrow func
" also no func keyword. funcKeyword is contained in statement
" funcKeyword allows overloading (func without body)
" funcImpl requires body
syntax cluster typescriptTopExpression
  \ contains=@typescriptPrimitive,
  \ typescriptIdentifier,typescriptIdentifierName,
  \ typescriptOperator,typescriptUnaryOp,
  \ typescriptParenExp,typescriptRegexpString,
  \ typescriptGlobal,typescriptAsyncFuncKeyword,
  \ typescriptClassKeyword,typescriptTypeCast

" no object literal, used in type cast and arrow func
" TODO: change func keyword to funcImpl
syntax cluster typescriptExpression
  \ contains=@typescriptTopExpression,
  \ typescriptArrowFuncDef,
  \ typescriptFuncImpl

syntax cluster typescriptValue
  \ contains=@typescriptExpression,typescriptObjectLiteral

syntax cluster typescriptEventExpression       contains=typescriptArrowFuncDef,typescriptParenExp,@typescriptValue,typescriptRegexpString,@typescriptEventTypes,typescriptOperator,typescriptGlobal,jsxRegion

endif