summaryrefslogtreecommitdiffstats
path: root/syntax/basic/object.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-09-06 14:32:07 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2019-09-06 14:32:07 +0200
commit84ec4eedcdd2892249b5369f91a6dd1d12fef2fc (patch)
tree6c9806851123656af2b71f6c6f5d89649442909c /syntax/basic/object.vim
parent66b769328c4511b2273f01c70de971c41f6964dd (diff)
downloadvim-polyglot-84ec4eedcdd2892249b5369f91a6dd1d12fef2fc.tar.gz
vim-polyglot-84ec4eedcdd2892249b5369f91a6dd1d12fef2fc.zip
Switch typescript provider, closes #428v4.0.0
Diffstat (limited to '')
-rw-r--r--syntax/basic/object.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/syntax/basic/object.vim b/syntax/basic/object.vim
new file mode 100644
index 00000000..533201c3
--- /dev/null
+++ b/syntax/basic/object.vim
@@ -0,0 +1,32 @@
+if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1
+ finish
+endif
+
+syntax region typescriptObjectLiteral matchgroup=typescriptBraces
+ \ start=/{/ end=/}/
+ \ contains=@typescriptComments,typescriptObjectLabel,typescriptStringProperty,typescriptComputedPropertyName
+ \ fold contained
+
+syntax match typescriptObjectLabel contained /\k\+\_s*/
+ \ nextgroup=typescriptObjectColon,@typescriptCallImpl
+ \ skipwhite skipempty
+
+syntax region typescriptStringProperty contained
+ \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1/
+ \ nextgroup=typescriptObjectColon,@typescriptCallImpl
+ \ skipwhite skipempty
+
+" syntax region typescriptPropertyName contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1(/me=e-1 nextgroup=@typescriptCallSignature skipwhite skipempty oneline
+syntax region typescriptComputedPropertyName contained matchgroup=typescriptBraces
+ \ start=/\[/rs=s+1 end=/]/
+ \ contains=@typescriptValue
+ \ nextgroup=typescriptObjectColon,@typescriptCallImpl
+ \ skipwhite skipempty
+
+" syntax region typescriptComputedPropertyName contained matchgroup=typescriptPropertyName start=/\[/rs=s+1 end=/]\_s*:/he=e-1 contains=@typescriptValue nextgroup=@typescriptValue skipwhite skipempty
+" syntax region typescriptComputedPropertyName contained matchgroup=typescriptPropertyName start=/\[/rs=s+1 end=/]\_s*(/me=e-1 contains=@typescriptValue nextgroup=@typescriptCallSignature skipwhite skipempty
+" Value for object, statement for label statement
+syntax match typescriptRestOrSpread /\.\.\./ contained
+syntax match typescriptObjectSpread /\.\.\./ contained containedin=typescriptObjectLiteral,typescriptArray nextgroup=@typescriptValue
+
+syntax match typescriptObjectColon contained /:/ nextgroup=@typescriptValue skipwhite skipempty