summaryrefslogtreecommitdiffstats
path: root/syntax/basic/identifiers.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-08-06 13:22:17 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-08-06 13:22:17 +0200
commit1e533e5982a9c80f262b09fbe94e1ac4555ad915 (patch)
treeed573a3e399a95c2c3baeb6a1371d4753357cecc /syntax/basic/identifiers.vim
parent56121b4e27cb48efb17be55a969b2f0d725266f8 (diff)
downloadvim-polyglot-1e533e5982a9c80f262b09fbe94e1ac4555ad915.tar.gz
vim-polyglot-1e533e5982a9c80f262b09fbe94e1ac4555ad915.zip
Update
Diffstat (limited to 'syntax/basic/identifiers.vim')
-rw-r--r--syntax/basic/identifiers.vim50
1 files changed, 50 insertions, 0 deletions
diff --git a/syntax/basic/identifiers.vim b/syntax/basic/identifiers.vim
index 4ec713b7..6a7ba4b0 100644
--- a/syntax/basic/identifiers.vim
+++ b/syntax/basic/identifiers.vim
@@ -30,4 +30,54 @@ syntax region typescriptFuncCallArg contained matchgroup=typescriptPa
syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression
syntax region typescriptEventString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ contains=typescriptASCII,@events
+syntax region typescriptDestructureString
+ \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/
+ \ contains=typescriptASCII
+ \ nextgroup=typescriptDestructureAs
+ \ contained skipwhite skipempty
+
+syntax cluster typescriptVariableDeclarations
+ \ contains=typescriptVariableDeclaration,@typescriptDestructures
+
+syntax match typescriptVariableDeclaration /[A-Za-z_$]\k*/
+ \ nextgroup=typescriptTypeAnnotation,typescriptAssign
+ \ contained skipwhite skipempty
+
+syntax cluster typescriptDestructureVariables contains=
+ \ typescriptRestOrSpread,
+ \ typescriptDestructureComma,
+ \ typescriptDestructureLabel,
+ \ typescriptDestructureVariable,
+ \ @typescriptDestructures
+
+syntax match typescriptDestructureVariable /[A-Za-z_$]\k*/ contained
+ \ nextgroup=typescriptDefaultParam
+ \ contained skipwhite skipempty
+
+syntax match typescriptDestructureLabel /[A-Za-z_$]\k*\ze\_s*:/
+ \ nextgroup=typescriptDestructureAs
+ \ contained skipwhite skipempty
+
+syntax match typescriptDestructureAs /:/
+ \ nextgroup=typescriptDestructureVariable,@typescriptDestructures
+ \ contained skipwhite skipempty
+
+syntax match typescriptDestructureComma /,/ contained
+
+syntax cluster typescriptDestructures contains=
+ \ typescriptArrayDestructure,
+ \ typescriptObjectDestructure
+
+syntax region typescriptArrayDestructure matchgroup=typescriptBraces
+ \ start=/\[/ end=/]/
+ \ contains=@typescriptDestructureVariables,@typescriptComments
+ \ nextgroup=typescriptTypeAnnotation,typescriptAssign
+ \ transparent contained skipwhite skipempty fold
+
+syntax region typescriptObjectDestructure matchgroup=typescriptBraces
+ \ start=/{/ end=/}/
+ \ contains=typescriptDestructureString,@typescriptDestructureVariables,@typescriptComments
+ \ nextgroup=typescriptTypeAnnotation,typescriptAssign
+ \ transparent contained skipwhite skipempty fold
+
endif