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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
if !polyglot#util#IsEnabled('typescript', expand('<sfile>:p'))
finish
endif
"Syntax coloring for Node.js shebang line
syntax match shellbang "^#!.*node\>"
syntax match shellbang "^#!.*iojs\>"
"JavaScript comments
syntax keyword typescriptCommentTodo TODO FIXME XXX TBD
syntax match typescriptMagicComment "@ts-\%(ignore\|expect-error\)\>"
syntax match typescriptLineComment "//.*"
\ contains=@Spell,typescriptCommentTodo,typescriptRef,typescriptMagicComment
syntax region typescriptComment
\ start="/\*" end="\*/"
\ contains=@Spell,typescriptCommentTodo extend
syntax cluster typescriptComments
\ contains=typescriptDocComment,typescriptComment,typescriptLineComment
syntax match typescriptRef +///\s*<reference\s\+.*\/>$+
\ contains=typescriptString
syntax match typescriptRef +///\s*<amd-dependency\s\+.*\/>$+
\ contains=typescriptString
syntax match typescriptRef +///\s*<amd-module\s\+.*\/>$+
\ contains=typescriptString
"JSDoc
syntax case ignore
syntax region typescriptDocComment matchgroup=typescriptComment
\ start="/\*\*" end="\*/"
\ contains=typescriptDocNotation,typescriptCommentTodo,@Spell
\ fold keepend
syntax match typescriptDocNotation contained /@/ nextgroup=typescriptDocTags
syntax keyword typescriptDocTags contained constant constructor constructs function ignore inner private public readonly static
syntax keyword typescriptDocTags contained const dict expose inheritDoc interface nosideeffects override protected struct internal
syntax keyword typescriptDocTags contained example global
syntax keyword typescriptDocTags contained alpha beta defaultValue eventProperty experimental label
syntax keyword typescriptDocTags contained packageDocumentation privateRemarks remarks sealed typeParam
" syntax keyword typescriptDocTags contained ngdoc nextgroup=typescriptDocNGDirective
syntax keyword typescriptDocTags contained ngdoc scope priority animations
syntax keyword typescriptDocTags contained ngdoc restrict methodOf propertyOf eventOf eventType nextgroup=typescriptDocParam skipwhite
syntax keyword typescriptDocNGDirective contained overview service object function method property event directive filter inputType error
syntax keyword typescriptDocTags contained abstract virtual access augments
syntax keyword typescriptDocTags contained arguments callback lends memberOf name type kind link mixes mixin tutorial nextgroup=typescriptDocParam skipwhite
syntax keyword typescriptDocTags contained variation nextgroup=typescriptDocNumParam skipwhite
syntax keyword typescriptDocTags contained author class classdesc copyright default defaultvalue nextgroup=typescriptDocDesc skipwhite
syntax keyword typescriptDocTags contained deprecated description external host nextgroup=typescriptDocDesc skipwhite
syntax keyword typescriptDocTags contained file fileOverview overview namespace requires since version nextgroup=typescriptDocDesc skipwhite
syntax keyword typescriptDocTags contained summary todo license preserve nextgroup=typescriptDocDesc skipwhite
syntax keyword typescriptDocTags contained borrows exports nextgroup=typescriptDocA skipwhite
syntax keyword typescriptDocTags contained param arg argument property prop module nextgroup=typescriptDocNamedParamType,typescriptDocParamName skipwhite
syntax keyword typescriptDocTags contained define enum extends implements this typedef nextgroup=typescriptDocParamType skipwhite
syntax keyword typescriptDocTags contained return returns throws exception nextgroup=typescriptDocParamType,typescriptDocParamName skipwhite
syntax keyword typescriptDocTags contained see nextgroup=typescriptDocRef skipwhite
syntax keyword typescriptDocTags contained function func method nextgroup=typescriptDocName skipwhite
syntax match typescriptDocName contained /\h\w*/
syntax keyword typescriptDocTags contained fires event nextgroup=typescriptDocEventRef skipwhite
syntax match typescriptDocEventRef contained /\h\w*#\(\h\w*\:\)\?\h\w*/
syntax match typescriptDocNamedParamType contained /{.\+}/ nextgroup=typescriptDocParamName skipwhite
syntax match typescriptDocParamName contained /\[\?0-9a-zA-Z_\.]\+\]\?/ nextgroup=typescriptDocDesc skipwhite
syntax match typescriptDocParamType contained /{.\+}/ nextgroup=typescriptDocDesc skipwhite
syntax match typescriptDocA contained /\%(#\|\w\|\.\|:\|\/\)\+/ nextgroup=typescriptDocAs skipwhite
syntax match typescriptDocAs contained /\s*as\s*/ nextgroup=typescriptDocB skipwhite
syntax match typescriptDocB contained /\%(#\|\w\|\.\|:\|\/\)\+/
syntax match typescriptDocParam contained /\%(#\|\w\|\.\|:\|\/\|-\)\+/
syntax match typescriptDocNumParam contained /\d\+/
syntax match typescriptDocRef contained /\%(#\|\w\|\.\|:\|\/\)\+/
syntax region typescriptDocLinkTag contained matchgroup=typescriptDocLinkTag start=/{/ end=/}/ contains=typescriptDocTags
syntax cluster typescriptDocs contains=typescriptDocParamType,typescriptDocNamedParamType,typescriptDocParam
if exists("main_syntax") && main_syntax == "typescript"
syntax sync clear
syntax sync ccomment typescriptComment minlines=200
endif
syntax case match
|