annotate vendor/vim-syntax/typescript.vim @ 637:758ced52ee62

[vim] Fix typescript syntax
author nanaya <me@nanaya.pro>
date Tue, 14 Jan 2020 11:10:49 +0900
parents ced2ee9efd9f
children 5bd223d5a97f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
620
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
1 " Vim syntax file
634
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
2 " Language: TypeScript
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
3 " Maintainer: Bram Moolenaar, Herrington Darkholme
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
4 " Last Change: 2019 Nov 30
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
5 " Based On: Herrington Darkholme's yats.vim
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
6 " Changes: Go to https:github.com/HerringtonDarkholme/yats.vim for recent changes.
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
7 " Origin: https://github.com/othree/yajs
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
8 " Credits: Kao Wei-Ko(othree), Jose Elera Campana, Zhao Yi, Claudio Fleiner, Scott Shattuck
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
9 " (This file is based on their hard work), gumnos (From the #vim
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
10 " IRC Channel in Freenode)
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
11
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
12 " This is the same syntax that is in yats.vim, but:
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
13 " - flattened into one file
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
14 " - HiLink commands changed to "hi def link"
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
15 " - Setting 'cpo' to the Vim value
620
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
16
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
17 if !exists("main_syntax")
634
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
18 if exists("b:current_syntax")
620
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
19 finish
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
20 endif
634
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
21 let main_syntax = 'typescript'
620
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
22 endif
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
23
634
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
24 let s:cpo_save = &cpo
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
25 set cpo&vim
620
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
26
634
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
27 " this region is NOT used in TypeScriptReact
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
28 " nextgroup doesn't contain objectLiteral, let outer region contains it
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
29 syntax region typescriptTypeCast matchgroup=typescriptTypeBrackets
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
30 \ start=/< \@!/ end=/>/
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
31 \ contains=@typescriptType
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
32 \ nextgroup=@typescriptExpression
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
33 \ contained skipwhite oneline
620
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
34
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
35
634
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
36 """""""""""""""""""""""""""""""""""""""""""""""""""
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
37 " Source the part common with typescriptreact.vim
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
38 source <sfile>:h/typescriptcommon.vim
620
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
39
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
40
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
41 let b:current_syntax = "typescript"
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
42 if main_syntax == 'typescript'
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
43 unlet main_syntax
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
44 endif
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents:
diff changeset
45
634
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
46 let &cpo = s:cpo_save
ced2ee9efd9f Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents: 625
diff changeset
47 unlet s:cpo_save