diff --git a/README.md b/README.md index f6c8aa55f..8606e4bae 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ If you need full functionality of any plugin, please use it directly with your p - [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin) - [tptp](https://github.com/c-cube/vim-tptp) (syntax) - [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin) -- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin) +- [typescript](https://github.com/HerringtonDarkholme/yats.vim) (syntax, indent, compiler, ftplugin) - [vala](https://github.com/arrufat/vala.vim) (syntax, indent) - [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax) - [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax) diff --git a/build b/build index c416af269..81e2d94cd 100755 --- a/build +++ b/build @@ -292,7 +292,7 @@ PACKS=" toml:cespare/vim-toml tptp:c-cube/vim-tptp twig:lumiliet/vim-twig - typescript:leafgarland/typescript-vim + typescript:HerringtonDarkholme/yats.vim vala:arrufat/vala.vim vbnet:vim-scripts/vbnet.vim vcl:smerrill/vcl-vim-plugin diff --git a/compiler/typescript.vim b/compiler/typescript.vim index 10f6823e8..48c60ab3a 100644 --- a/compiler/typescript.vim +++ b/compiler/typescript.vim @@ -2,33 +2,24 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != finish endif -if exists("current_compiler") +if exists('current_compiler') finish endif -let current_compiler = "typescript" -if !exists("g:typescript_compiler_binary") - let g:typescript_compiler_binary = "tsc" -endif +let current_compiler='typescript' -if !exists("g:typescript_compiler_options") - let g:typescript_compiler_options = "" +if !exists('g:typescript_compiler_binary') + let g:typescript_compiler_binary = 'tsc' endif -if exists(":CompilerSet") != 2 - command! -nargs=* CompilerSet setlocal +if !exists('g:typescript_compiler_options') + if exists('g:syntastic_typescript_tsc_args') + let g:typescript_compiler_options = g:syntastic_typescript_tsc_args + else + let g:typescript_compiler_options = '' + endif endif -let s:cpo_save = &cpo -set cpo-=C - -execute 'CompilerSet makeprg=' - \ . escape(g:typescript_compiler_binary, ' ') - \ . '\ ' - \ . escape(g:typescript_compiler_options, ' ') - \ . '\ $*\ %' +let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %' CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m - -let &cpo = s:cpo_save -unlet s:cpo_save diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 7e3dc45fc..6e00b8d33 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -1425,11 +1425,15 @@ endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1 augroup filetypedetect - " typescript, from typescript.vim in leafgarland/typescript-vim -" use `set filetype` to override default filetype=xml for *.ts files -autocmd BufNewFile,BufRead *.ts set filetype=typescript -" use `setfiletype` to not override any other plugins like ianks/vim-tsx -autocmd BufNewFile,BufRead *.tsx setfiletype typescript + " typescript, from tsx.vim in HerringtonDarkholme/yats.vim +autocmd BufNewFile,BufRead *.tsx setlocal filetype=typescript.tsx + augroup end +endif + +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1 + augroup filetypedetect + " typescript, from typescript.vim in HerringtonDarkholme/yats.vim +autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript augroup end endif diff --git a/ftplugin/tsx.vim b/ftplugin/tsx.vim new file mode 100644 index 000000000..b6c764813 --- /dev/null +++ b/ftplugin/tsx.vim @@ -0,0 +1,15 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +" modified from mxw/vim-jsx from html.vim +if exists("loaded_matchit") && !exists('b:tsx_match_words') + let b:match_ignorecase = 0 + let b:tsx_match_words = '(:),\[:\],{:},<:>,' . + \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@\|$\):<\@<=/\1>' + let b:match_words = exists('b:match_words') + \ ? b:match_words . ',' . b:tsx_match_words + \ : b:tsx_match_words +endif + +set suffixesadd+=.tsx diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index 705cb7cd6..b3d4c9c44 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -2,6 +2,8 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != finish endif +" set Vi-incompatible, compiler and commentstring + if exists("b:did_ftplugin") finish endif @@ -17,9 +19,68 @@ setlocal commentstring=//\ %s " " and insert the comment leader when hitting or using "o". setlocal formatoptions-=t formatoptions+=croql -setlocal suffixesadd+=.ts,.tsx - -let b:undo_ftplugin = "setl fo< ofu< com< cms<" +" setlocal foldmethod=syntax let &cpo = s:cpo_save unlet s:cpo_save + +function! TsIncludeExpr(file) + if (filereadable(a:file)) + return l:file + else + let l:file2=substitute(a:file,'$','/index.ts','g') + return l:file2 + endif +endfunction + +set path+=./node_modules/**,node_modules/** +set include=import\_s.\\zs[^'\"]*\\ze +set includeexpr=TsIncludeExpr(v:fname) +set suffixesadd=.ts + +" +" TagBar +" +let g:tagbar_type_typescript = { + \ 'ctagstype' : 'typescript', + \ 'kinds' : [ + \ 'c:classes', + \ 'a:abstract classes', + \ 't:types', + \ 'n:modules', + \ 'f:functions', + \ 'v:variables', + \ 'l:varlambdas', + \ 'm:members', + \ 'i:interfaces', + \ 'e:enums' + \ ], + \ 'sro' : '.', + \ 'kind2scope' : { + \ 'c' : 'classes', + \ 'a' : 'abstract classes', + \ 't' : 'types', + \ 'f' : 'functions', + \ 'v' : 'variables', + \ 'l' : 'varlambdas', + \ 'm' : 'members', + \ 'i' : 'interfaces', + \ 'e' : 'enums' + \ }, + \ 'scope2kind' : { + \ 'classes' : 'c', + \ 'abstract classes' : 'a', + \ 'types' : 't', + \ 'functions' : 'f', + \ 'variables' : 'v', + \ 'varlambdas' : 'l', + \ 'members' : 'm', + \ 'interfaces' : 'i', + \ 'enums' : 'e' + \ } +\ } + +" In case you've updated/customized your ~/.ctags and prefer to use it. +if get(g:, 'typescript_use_builtin_tagbar_defs', 1) + let g:tagbar_type_typescript.deffile = expand(':p:h:h') . '/ctags/typescript.ctags' +endif diff --git a/indent/tsx.vim b/indent/tsx.vim new file mode 100644 index 000000000..906ee222c --- /dev/null +++ b/indent/tsx.vim @@ -0,0 +1,114 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +" Save the current JavaScript indentexpr. +let b:tsx_ts_indentexpr = &indentexpr + +" Prologue; load in XML indentation. +if exists('b:did_indent') + let s:did_indent=b:did_indent + unlet b:did_indent +endif +exe 'runtime! indent/xml.vim' +if exists('s:did_indent') + let b:did_indent=s:did_indent +endif + +setlocal indentexpr=GetTsxIndent() + +" JS indentkeys +setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e +" XML indentkeys +setlocal indentkeys+=*,<>>,<<>,/ + +" Multiline end tag regex (line beginning with '>' or '/>') +let s:endtag = '^\s*\/\?>\s*;\=' +let s:startexp = '[\{\(]\s*$' + +" Get all syntax types at the beginning of a given line. +fu! SynSOL(lnum) + return map(synstack(a:lnum, 1), 'synIDattr(v:val, "name")') +endfu + +" Get all syntax types at the end of a given line. +fu! SynEOL(lnum) + let lnum = prevnonblank(a:lnum) + let col = strlen(getline(lnum)) + return map(synstack(lnum, col), 'synIDattr(v:val, "name")') +endfu + +" Check if a syntax attribute is XMLish. +fu! SynAttrXMLish(synattr) + return a:synattr =~ "^xml" || a:synattr =~ "^tsx" +endfu + +" Check if a synstack is XMLish (i.e., has an XMLish last attribute). +fu! SynXMLish(syns) + return SynAttrXMLish(get(a:syns, -1)) +endfu + +" Check if a synstack denotes the end of a TSX block. +fu! SynTSXBlockEnd(syns) + return get(a:syns, -1) =~ '\%(ts\|typescript\)Braces' && + \ SynAttrXMLish(get(a:syns, -2)) +endfu + +" Determine how many tsxRegions deep a synstack is. +fu! SynTSXDepth(syns) + return len(filter(copy(a:syns), 'v:val ==# "tsxRegion"')) +endfu + +" Check whether `cursyn' continues the same tsxRegion as `prevsyn'. +fu! SynTSXContinues(cursyn, prevsyn) + let curdepth = SynTSXDepth(a:cursyn) + let prevdepth = SynTSXDepth(a:prevsyn) + + " In most places, we expect the nesting depths to be the same between any + " two consecutive positions within a tsxRegion (e.g., between a parent and + " child node, between two TSX attributes, etc.). The exception is between + " sibling nodes, where after a completed element (with depth N), we return + " to the parent's nesting (depth N - 1). This case is easily detected, + " since it is the only time when the top syntax element in the synstack is + " tsxRegion---specifically, the tsxRegion corresponding to the parent. + return prevdepth == curdepth || + \ (prevdepth == curdepth + 1 && get(a:cursyn, -1) ==# 'tsxRegion') +endfu + +" Cleverly mix JS and XML indentation. +fu! GetTsxIndent() + let cursyn = SynSOL(v:lnum) + let prevsyn = SynEOL(v:lnum - 1) + + " Use XML indenting iff: + " - the syntax at the end of the previous line was either TSX or was the + " closing brace of a jsBlock whose parent syntax was TSX; and + " - the current line continues the same tsxRegion as the previous line. + if (SynXMLish(prevsyn) || SynTSXBlockEnd(prevsyn)) && + \ SynTSXContinues(cursyn, prevsyn) + let ind = XmlIndentGet(v:lnum, 0) + let l:line = getline(v:lnum) + let l:pline = getline(v:lnum - 1) + + " Align '/>' and '>' with '<' for multiline tags. + " Align end of expression ')' or '}'. + if l:line =~? s:endtag + let ind = ind - shiftwidth() + endif + + " Then correct the indentation of any TSX following '/>' or '>'. + " Align start of expression '(' or '{' + if l:pline =~? s:endtag || l:pline =~? s:startexp + let ind = ind + shiftwidth() + endif + else + if len(b:tsx_ts_indentexpr) + " Invoke the base TS package's custom indenter + let ind = eval(b:tsx_ts_indentexpr) + else + let ind = cindent(v:lnum) + endif + endif + + return ind +endfu diff --git a/indent/typescript.vim b/indent/typescript.vim index 04f7e8769..deb4f18c8 100644 --- a/indent/typescript.vim +++ b/indent/typescript.vim @@ -3,361 +3,503 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != endif " Vim indent file -" Language: Typescript -" Acknowledgement: Almost direct copy from https://github.com/pangloss/vim-javascript +" Language: TypeScript +" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org + +" 0. Initialization {{{1 +" ================= " Only load this indent file when no other was loaded. -if exists('b:did_indent') || get(g:, 'typescript_indent_disable', 0) +if exists("b:did_indent") finish endif let b:did_indent = 1 +setlocal nosmartindent + " Now, set up our indentation expression and keys that trigger it. setlocal indentexpr=GetTypescriptIndent() -setlocal autoindent nolisp nosmartindent -setlocal indentkeys+=0],0) - -let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<' +setlocal formatexpr=Fixedgq(v:lnum,v:count) +setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e " Only define the function once. -if exists('*GetTypescriptIndent') +if exists("*GetTypescriptIndent") finish endif let s:cpo_save = &cpo set cpo&vim -" Get shiftwidth value -if exists('*shiftwidth') - function s:sw() - return shiftwidth() - endfunction -else - function s:sw() - return &sw - endfunction -endif +" 1. Variables {{{1 +" ============ -" searchpair() wrapper -if has('reltime') - function s:GetPair(start,end,flags,skip,time,...) - return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 2000,0] + a:000),a:time) - endfunction -else - function s:GetPair(start,end,flags,skip,...) - return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 1000,get(a:000,1)])) - endfunction -endif +let s:js_keywords = '^\s*\(break\|case\|catch\|continue\|debugger\|default\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)' " Regex of syntax group names that are or delimit string or are comments. -let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!' -let s:syng_str = 'string\|template\|special' -let s:syng_com = 'comment\|doc' +let s:syng_strcom = 'string\|regex\|comment\c' + +" Regex of syntax group names that are strings. +let s:syng_string = 'regex\c' + +" Regex of syntax group names that are strings or documentation. +let s:syng_multiline = 'comment\c' + +" Regex of syntax group names that are line comment. +let s:syng_linecom = 'linecomment\c' + " Expression used to check whether we should skip a match with searchpair(). -let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'" +let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'" -function s:skip_func() - if !s:free || search('\m`\|\${\|\*\/','nW',s:looksyn) - let s:free = !eval(s:skip_expr) - let s:looksyn = line('.') - return !s:free - endif - let s:looksyn = line('.') - return getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$' && - \ eval(s:skip_expr) -endfunction +let s:line_term = '\s*\%(\%(\/\/\).*\)\=$' -function s:alternatePair(stop) - let pos = getpos('.')[1:2] - while search('\m[][(){}]','bW',a:stop) - if !s:skip_func() - let idx = stridx('])}',s:looking_at()) - if idx + 1 - if s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,a:stop) <= 0 - break - endif - else - return - endif - endif - endwhile - call call('cursor',pos) -endfunction +" Regex that defines continuation lines, not including (, {, or [. +let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@[^{;]*' . s:line_term + +" Regex that defines blocks. +let s:block_regex = '\%([{[]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term -function s:save_pos(f,...) - let l:pos = getpos('.')[1:2] - let ret = call(a:f,a:000) - call call('cursor',l:pos) - return ret +let s:var_stmt = '^\s*var' + +let s:comma_first = '^\s*,' +let s:comma_last = ',\s*$' + +let s:ternary = '^\s\+[?|:]' +let s:ternary_q = '^\s\+?' + +" 2. Auxiliary Functions {{{1 +" ====================== + +" Check if the character at lnum:col is inside a string, comment, or is ascii. +function s:IsInStringOrComment(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom endfunction -function s:syn_at(l,c) - return synIDattr(synID(a:l,a:c,0),'name') +" Check if the character at lnum:col is inside a string. +function s:IsInString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string endfunction -function s:looking_at() - return getline('.')[col('.')-1] +" Check if the character at lnum:col is inside a multi-line comment. +function s:IsInMultilineComment(lnum, col) + return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline endfunction -function s:token() - return s:looking_at() =~ '\k' ? expand('') : s:looking_at() +" Check if the character at lnum:col is a line comment. +function s:IsLineComment(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom endfunction -function s:previous_token() - let l:n = line('.') - if (s:looking_at() !~ '\k' || search('\m\<','cbW')) && search('\m\S','bW') - if (getline('.')[col('.')-2:col('.')-1] == '*/' || line('.') != l:n && - \ getline('.') =~ '\%<'.col('.').'c\/\/') && s:syn_at(line('.'),col('.')) =~? s:syng_com - while search('\m\/\ze[/*]','cbW') - if !search('\m\S','bW') - break - elseif s:syn_at(line('.'),col('.')) !~? s:syng_com - return s:token() - endif - endwhile - else - return s:token() - endif - endif - return '' +" Find line above 'lnum' that isn't empty, in a comment, or in a string. +function s:PrevNonBlankNonString(lnum) + let in_block = 0 + let lnum = prevnonblank(a:lnum) + while lnum > 0 + " Go in and out of blocks comments as necessary. + " If the line isn't empty (with opt. comment) or in a string, end search. + let line = getline(lnum) + if line =~ '/\*' + if in_block + let in_block = 0 + else + break + endif + elseif !in_block && line =~ '\*/' + let in_block = 1 + elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line))) + break + endif + let lnum = prevnonblank(lnum - 1) + endwhile + return lnum endfunction -function s:others(p) - return "((line2byte(line('.')) + col('.')) <= ".(line2byte(a:p[0]) + a:p[1]).") || ".s:skip_expr +" Find line above 'lnum' that started the continuation 'lnum' may be part of. +function s:GetMSL(lnum, in_one_line_scope) + " Start on the line we're at and use its indent. + let msl = a:lnum + let lnum = s:PrevNonBlankNonString(a:lnum - 1) + while lnum > 0 + " If we have a continuation line, or we're in a string, use line as MSL. + " Otherwise, terminate search as we have found our MSL already. + let line = getline(lnum) + let col = match(line, s:msl_regex) + 1 + if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line)) + let msl = lnum + else + " Don't use lines that are part of a one line scope as msl unless the + " flag in_one_line_scope is set to 1 + " + if a:in_one_line_scope + break + end + let msl_one_line = s:Match(lnum, s:one_line_scope_regex) + if msl_one_line == 0 + break + endif + endif + let lnum = s:PrevNonBlankNonString(lnum - 1) + endwhile + return msl endfunction -function s:tern_skip(p) - return s:GetPair('{','}','nbW',s:others(a:p),200,a:p[0]) > 0 +function s:RemoveTrailingComments(content) + let single = '\/\/\(.*\)\s*$' + let multi = '\/\*\(.*\)\*\/\s*$' + return substitute(substitute(a:content, single, '', ''), multi, '', '') endfunction -function s:tern_col(p) - return s:GetPair('?',':\@ 0 +" Find if the string is inside var statement (but not the first string) +function s:InMultiVarStatement(lnum) + let lnum = s:PrevNonBlankNonString(a:lnum - 1) + +" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name') + + " loop through previous expressions to find a var statement + while lnum > 0 + let line = getline(lnum) + + " if the line is a js keyword + if (line =~ s:js_keywords) + " check if the line is a var stmt + " if the line has a comma first or comma last then we can assume that we + " are in a multiple var statement + if (line =~ s:var_stmt) + return lnum + endif + + " other js keywords, not a var + return 0 + endif + + let lnum = s:PrevNonBlankNonString(lnum - 1) + endwhile + + " beginning of program, not a var + return 0 endfunction -function s:label_col() - let pos = getpos('.')[1:2] - let [s:looksyn,s:free] = pos - call s:alternatePair(0) - if s:save_pos('s:IsBlock') - let poss = getpos('.')[1:2] - return call('cursor',pos) || !s:tern_col(poss) - elseif s:looking_at() == ':' - return !s:tern_col([0,0]) +" Find line above with beginning of the var statement or returns 0 if it's not +" this statement +function s:GetVarIndent(lnum) + let lvar = s:InMultiVarStatement(a:lnum) + let prev_lnum = s:PrevNonBlankNonString(a:lnum - 1) + + if lvar + let line = s:RemoveTrailingComments(getline(prev_lnum)) + + " if the previous line doesn't end in a comma, return to regular indent + if (line !~ s:comma_last) + return indent(prev_lnum) - shiftwidth() + else + return indent(lvar) + shiftwidth() + endif endif -endfunction -" configurable regexes that define continuation lines, not including (, {, or [. -let s:opfirst = '^' . get(g:,'typescript_opfirst', - \ '\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)') -let s:continuation = get(g:,'typescript_continuation', - \ '\%([-+<>=,.~!?/*^%|&:]\|\<\%(typeof\|delete\|void\|in\|instanceof\)\)') . '$' - -function s:continues(ln,con) - return !cursor(a:ln, match(' '.a:con,s:continuation)) && - \ eval( (['s:syn_at(line("."),col(".")) !~? "regex"'] + - \ repeat(['getline(".")[col(".")-2] != tr(s:looking_at(),">","=")'],3) + - \ repeat(['s:previous_token() != "."'],5) + [1])[ - \ index(split('/ > - + typeof in instanceof void delete'),s:token())]) + return -1 endfunction -" get the line of code stripped of comments and move cursor to the last -" non-comment char. -function s:Trim(ln) - call cursor(a:ln+1,1) - call s:previous_token() - return strpart(getline('.'),0,col('.')) -endfunction -" Find line above 'lnum' that isn't empty or in a comment -function s:PrevCodeLine(lnum) - let l:n = prevnonblank(a:lnum) - while l:n - if getline(l:n) =~ '^\s*\/[/*]' - if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') && - \ s:syn_at(l:n,1) =~? s:syng_str - return l:n - endif - let l:n = prevnonblank(l:n-1) - elseif getline(l:n) =~ '\([/*]\)\1\@![/*]' && s:syn_at(l:n,1) =~? s:syng_com - let l:n = s:save_pos('eval', - \ 'cursor('.l:n.',1) + search(''\m\/\*'',"bW")') - else - return l:n - endif +" Check if line 'lnum' has more opening brackets than closing ones. +function s:LineHasOpeningBrackets(lnum) + let open_0 = 0 + let open_2 = 0 + let open_4 = 0 + let line = getline(a:lnum) + let pos = match(line, '[][(){}]', 0) + while pos != -1 + if !s:IsInStringOrComment(a:lnum, pos + 1) + let idx = stridx('(){}[]', line[pos]) + if idx % 2 == 0 + let open_{idx} = open_{idx} + 1 + else + let open_{idx - 1} = open_{idx - 1} - 1 + endif + endif + let pos = match(line, '[][(){}]', pos + 1) endwhile + return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) endfunction -" Check if line 'lnum' has a balanced amount of parentheses. -function s:Balanced(lnum) - let l:open = 0 - let l:line = getline(a:lnum) - let pos = match(l:line, '[][(){}]', 0) - while pos != -1 - if s:syn_at(a:lnum,pos + 1) !~? s:syng_strcom - let l:open += match(' ' . l:line[pos],'[[({]') - if l:open < 0 - return - endif - endif - let pos = match(l:line, '[][(){}]', pos + 1) - endwhile - return !l:open +function s:Match(lnum, regex) + let col = match(getline(a:lnum), a:regex) + 1 + return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 endfunction -function s:OneScope(lnum) - let pline = s:Trim(a:lnum) - let kw = 'else do' - if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 - call s:previous_token() - let kw = 'for if let while with' - if index(split('await each'),s:token()) + 1 - call s:previous_token() - let kw = 'for' - endif +function s:IndentWithContinuation(lnum, ind, width) + " Set up variables to use and search for MSL to the previous line. + let p_lnum = a:lnum + let lnum = s:GetMSL(a:lnum, 1) + let line = getline(lnum) + + " If the previous line wasn't a MSL and is continuation return its indent. + " TODO: the || s:IsInString() thing worries me a bit. + if p_lnum != lnum + if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line)) + return a:ind + endif + endif + + " Set up more variables now that we know we aren't continuation bound. + let msl_ind = indent(lnum) + + " If the previous line ended with [*+/.-=], start a continuation that + " indents an extra level. + if s:Match(lnum, s:continuation_regex) + if lnum == p_lnum + return msl_ind + a:width + else + return msl_ind + endif endif - return pline[-2:] == '=>' || index(split(kw),s:token()) + 1 && - \ s:save_pos('s:previous_token') != '.' + + return a:ind endfunction -" returns braceless levels started by 'i' and above lines * &sw. 'num' is the -" lineNr which encloses the entire context, 'cont' if whether line 'i' + 1 is -" a continued expression, which could have started in a braceless context -function s:iscontOne(i,num,cont) - let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0] - let pind = a:num ? indent(l:num) + s:W : 0 - let ind = indent(l:i) + (a:cont ? 0 : s:W) - while l:i >= l:num && (ind > pind || l:i == l:num) - if indent(l:i) < ind && s:OneScope(l:i) - let bL += s:W - let l:i = line('.') - elseif !a:cont || bL || ind < indent(a:i) - break - endif - let ind = min([ind, indent(l:i)]) - let l:i = s:PrevCodeLine(l:i - 1) - endwhile - return bL +function s:InOneLineScope(lnum) + let msl = s:GetMSL(a:lnum, 1) + if msl > 0 && s:Match(msl, s:one_line_scope_regex) + return msl + endif + return 0 endfunction -" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader -function s:IsBlock() - if s:looking_at() == '{' - let l:n = line('.') - let char = s:previous_token() - if match(s:stack,'xml\|jsx') + 1 && s:syn_at(line('.'),col('.')-1) =~? 'xml\|jsx' - return char != '{' - elseif char =~ '\k' - return index(split('return const let import export yield default delete var await void typeof throw case new in instanceof') - \ ,char) < (line('.') != l:n) || s:previous_token() == '.' - elseif char == '>' - return getline('.')[col('.')-2] == '=' || s:syn_at(line('.'),col('.')) =~? '^jsflow' - elseif char == ':' - return getline('.')[col('.')-2] != ':' && s:label_col() - elseif char == '/' - return s:syn_at(line('.'),col('.')) =~? 'regex' - endif - return char !~ '[=~!<*,?^%|&([]' && - \ (char !~ '[-+]' || l:n != line('.') && getline('.')[col('.')-2] == char) +function s:ExitingOneLineScope(lnum) + let msl = s:GetMSL(a:lnum, 1) + if msl > 0 + " if the current line is in a one line scope .. + if s:Match(msl, s:one_line_scope_regex) + return 0 + else + let prev_msl = s:GetMSL(msl - 1, 1) + if s:Match(prev_msl, s:one_line_scope_regex) + return prev_msl + endif + endif endif + return 0 endfunction +" 3. GetTypescriptIndent Function {{{1 +" ========================= + function GetTypescriptIndent() - let b:js_cache = get(b:,'js_cache',[0,0,0]) + " 3.1. Setup {{{2 + " ---------- + + " Set up variables for restoring position in file. Could use v:lnum here. + let vcol = col('.') + + " 3.2. Work on the current line {{{2 + " ----------------------------- + + let ind = -1 " Get the current line. - call cursor(v:lnum,1) - let l:line = getline('.') - " use synstack as it validates syn state and works in an empty line - let s:stack = synstack(v:lnum,1) - let syns = synIDattr(get(s:stack,-1),'name') - - " start with strings,comments,etc. - if syns =~? s:syng_com - if l:line =~ '^\s*\*' - return cindent(v:lnum) - elseif l:line !~ '^\s*\/[/*]' - return -1 - endif - elseif syns =~? s:syng_str && l:line !~ '^[''"]' - if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1) - let b:js_cache[0] = v:lnum - endif - return -1 + let line = getline(v:lnum) + " previous nonblank line number + let prevline = prevnonblank(v:lnum - 1) + + " If we got a closing bracket on an empty line, find its match and indent + " according to it. For parentheses we indent to its column - 1, for the + " others we indent to the containing line's MSL's level. Return -1 if fail. + let col = matchend(line, '^\s*[],})]') + if col > 0 && !s:IsInStringOrComment(v:lnum, col) + call cursor(v:lnum, col) + + let lvar = s:InMultiVarStatement(v:lnum) + if lvar + let prevline_contents = s:RemoveTrailingComments(getline(prevline)) + + " check for comma first + if (line[col - 1] =~ ',') + " if the previous line ends in comma or semicolon don't indent + if (prevline_contents =~ '[;,]\s*$') + return indent(s:GetMSL(line('.'), 0)) + " get previous line indent, if it's comma first return prevline indent + elseif (prevline_contents =~ s:comma_first) + return indent(prevline) + " otherwise we indent 1 level + else + return indent(lvar) + shiftwidth() + endif + endif + endif + + + let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) + if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 + if line[col-1]==')' && col('.') != col('$') - 1 + let ind = virtcol('.')-1 + else + let ind = indent(s:GetMSL(line('.'), 0)) + endif + endif + return ind endif - let l:lnum = s:PrevCodeLine(v:lnum - 1) - if !l:lnum - return + + " If the line is comma first, dedent 1 level + if (getline(prevline) =~ s:comma_first) + return indent(prevline) - shiftwidth() endif - let l:line = substitute(l:line,'^\s*','','') - if l:line[:1] == '/*' - let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','') + if (line =~ s:ternary) + if (getline(prevline) =~ s:ternary_q) + return indent(prevline) + else + return indent(prevline) + shiftwidth() + endif endif - if l:line =~ '^\/[/*]' - let l:line = '' + + " If we are in a multi-line comment, cindent does the right thing. + if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1) + return cindent(v:lnum) endif - " the containing paren, bracket, or curly. Many hacks for performance - let idx = index([']',')','}'],l:line[0]) - if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && - \ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum)) - call call('cursor',b:js_cache[1:]) - else - let [s:looksyn, s:free, top] = [v:lnum - 1, 1, (!indent(l:lnum) && - \ s:syn_at(l:lnum,1) !~? s:syng_str) * l:lnum] - if idx + 1 - call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:skip_func()',2000,top) - elseif getline(v:lnum) !~ '^\S' && syns =~? 'block' - call s:GetPair('{','}','bW','s:skip_func()',2000,top) - else - call s:alternatePair(top) - endif + " Check for multiple var assignments +" let var_indent = s:GetVarIndent(v:lnum) +" if var_indent >= 0 +" return var_indent +" endif + + " 3.3. Work on the previous line. {{{2 + " ------------------------------- + + " If the line is empty and the previous nonblank line was a multi-line + " comment, use that comment's indent. Deduct one char to account for the + " space in ' */'. + if line =~ '^\s*$' && s:IsInMultilineComment(prevline, 1) + return indent(prevline) - 1 + endif + + " Find a non-blank, non-multi-line string line above the current line. + let lnum = s:PrevNonBlankNonString(v:lnum - 1) + + " If the line is empty and inside a string, use the previous line. + if line =~ '^\s*$' && lnum != prevline + return indent(prevnonblank(v:lnum)) endif - let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [0,0] : getpos('.')[1:2]) - let num = b:js_cache[1] - - let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0] - if !num || s:IsBlock() - let ilnum = line('.') - let pline = s:save_pos('s:Trim',l:lnum) - if num && s:looking_at() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 - let num = ilnum == num ? line('.') : num - if idx < 0 && s:previous_token() ==# 'switch' && s:previous_token() != '.' - if &cino !~ ':' - let switch_offset = s:W - else - let cinc = matchlist(&cino,'.*:\zs\(-\)\=\(\d*\)\(\.\d\+\)\=\(s\)\=\C') - let switch_offset = max([cinc[0] is '' ? 0 : (cinc[1].1) * - \ ((strlen(cinc[2].cinc[3]) ? str2nr(cinc[2].str2nr(cinc[3][1])) : 10) * - \ (cinc[4] is '' ? 1 : s:W)) / 10, -indent(num)]) - endif - if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>' - return indent(num) + switch_offset - endif - endif - endif - if idx < 0 && pline !~ '[{;]$' - if pline =~# ':\@ 0 + if col('.') + 1 == col('$') + return ind + shiftwidth() + else + return virtcol('.') + endif + elseif counts[1] == '1' || counts[2] == '1' + return ind + shiftwidth() + else + call cursor(v:lnum, vcol) + end endif - return bL + isOp + + " 3.4. Work on the MSL line. {{{2 + " -------------------------- + + let ind_con = ind + let ind = s:IndentWithContinuation(lnum, ind_con, shiftwidth()) + + " }}}2 + " + " + let ols = s:InOneLineScope(lnum) + if ols > 0 + let ind = ind + shiftwidth() + else + let ols = s:ExitingOneLineScope(lnum) + while ols > 0 && ind > 0 + let ind = ind - shiftwidth() + let ols = s:InOneLineScope(ols - 1) + endwhile + endif + + return ind endfunction +" }}}1 + let &cpo = s:cpo_save unlet s:cpo_save +function! Fixedgq(lnum, count) + let l:tw = &tw ? &tw : 80; + + let l:count = a:count + let l:first_char = indent(a:lnum) + 1 + + if mode() == 'i' " gq was not pressed, but tw was set + return 1 + endif + + " This gq is only meant to do code with strings, not comments + if s:IsLineComment(a:lnum, l:first_char) || s:IsInMultilineComment(a:lnum, l:first_char) + return 1 + endif + + if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq + return 1 + endif + + " Put all the lines on one line and do normal spliting after that + if l:count > 1 + while l:count > 1 + let l:count -= 1 + normal! J + endwhile + endif + + let l:winview = winsaveview() + + call cursor(a:lnum, l:tw + 1) + let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum) + call cursor(a:lnum, l:tw + 1) + let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum) + + " No need for special treatment, normal gq handles edgecases better + if breakpoint[1] == orig_breakpoint[1] + call winrestview(l:winview) + return 1 + endif + + " Try breaking after string + if breakpoint[1] <= indent(a:lnum) + call cursor(a:lnum, l:tw + 1) + let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum) + endif + + + if breakpoint[1] != 0 + call feedkeys("r\") + else + let l:count = l:count - 1 + endif + + " run gq on new lines + if l:count == 1 + call feedkeys("gqq") + endif + + return 0 +endfunction diff --git a/syntax/basic/class.vim b/syntax/basic/class.vim new file mode 100644 index 000000000..ab8343902 --- /dev/null +++ b/syntax/basic/class.vim @@ -0,0 +1,69 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +"don't add typescriptMembers to nextgroup, let outer scope match it +" so we won't match abstract method outside abstract class +syntax keyword typescriptAbstract abstract + \ nextgroup=typescriptClassKeyword + \ skipwhite skipnl +syntax keyword typescriptClassKeyword class + \ nextgroup=typescriptClassName,typescriptClassExtends,typescriptClassBlock + \ skipwhite + +syntax match typescriptClassName contained /\K\k*/ + \ nextgroup=typescriptClassBlock,typescriptClassExtends,typescriptClassTypeParameter + \ skipwhite skipnl + +syntax region typescriptClassTypeParameter + \ start=// + \ contains=typescriptTypeParameter + \ nextgroup=typescriptClassBlock,typescriptClassExtends + \ contained skipwhite skipnl + +syntax keyword typescriptClassExtends contained extends implements nextgroup=typescriptClassHeritage skipwhite skipnl + +syntax match typescriptClassHeritage contained /\v(\k|\.|\(|\))+/ + \ nextgroup=typescriptClassBlock,typescriptClassExtends,typescriptMixinComma,typescriptClassTypeArguments + \ contains=@typescriptValue + \ skipwhite skipnl + \ contained + +syntax region typescriptClassTypeArguments matchgroup=typescriptTypeBrackets + \ start=// + \ contains=@typescriptType + \ nextgroup=typescriptClassExtends,typescriptClassBlock,typescriptMixinComma + \ contained skipwhite skipnl + +syntax match typescriptMixinComma /,/ contained nextgroup=typescriptClassHeritage skipwhite skipnl + +" we need add arrowFunc to class block for high order arrow func +" see test case +syntax region typescriptClassBlock matchgroup=typescriptBraces start=/{/ end=/}/ + \ contains=@typescriptPropertyMemberDeclaration,typescriptAbstract,@typescriptComments,typescriptBlock,typescriptAssign,typescriptDecorator,typescriptAsyncFuncKeyword,typescriptArrowFunc + \ contained fold + +syntax keyword typescriptInterfaceKeyword interface nextgroup=typescriptInterfaceName skipwhite +syntax match typescriptInterfaceName contained /\k\+/ + \ nextgroup=typescriptObjectType,typescriptInterfaceExtends,typescriptInterfaceTypeParameter + \ skipwhite skipnl +syntax region typescriptInterfaceTypeParameter + \ start=// + \ contains=typescriptTypeParameter + \ nextgroup=typescriptObjectType,typescriptInterfaceExtends + \ contained + \ skipwhite skipnl + +syntax keyword typescriptInterfaceExtends contained extends nextgroup=typescriptInterfaceHeritage skipwhite skipnl + +syntax match typescriptInterfaceHeritage contained /\v(\k|\.)+/ + \ nextgroup=typescriptObjectType,typescriptInterfaceComma,typescriptInterfaceTypeArguments + \ skipwhite + +syntax region typescriptInterfaceTypeArguments matchgroup=typescriptTypeBrackets + \ start=// skip=/\s*,\s*/ + \ contains=@typescriptType + \ nextgroup=typescriptObjectType,typescriptInterfaceComma + \ contained skipwhite + +syntax match typescriptInterfaceComma /,/ contained nextgroup=typescriptInterfaceHeritage skipwhite skipnl diff --git a/syntax/basic/cluster.vim b/syntax/basic/cluster.vim new file mode 100644 index 000000000..0188aa987 --- /dev/null +++ b/syntax/basic/cluster.vim @@ -0,0 +1,42 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +"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 diff --git a/syntax/basic/decorator.vim b/syntax/basic/decorator.vim new file mode 100644 index 000000000..c27b9b7ec --- /dev/null +++ b/syntax/basic/decorator.vim @@ -0,0 +1,7 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/ + \ nextgroup=typescriptArgumentList,typescriptTypeArguments + \ contains=@_semantic,typescriptDotNotation diff --git a/syntax/basic/doc.vim b/syntax/basic/doc.vim new file mode 100644 index 000000000..d5e43e343 --- /dev/null +++ b/syntax/basic/doc.vim @@ -0,0 +1,87 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + 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 typescriptLineComment "//.*" + \ contains=@Spell,typescriptCommentTodo,typescriptRef +syntax region typescriptComment + \ start="/\*" end="\*/" + \ contains=@Spell,typescriptCommentTodo extend +syntax cluster typescriptComments + \ contains=typescriptDocComment,typescriptComment,typescriptLineComment + +syntax match typescriptRef +///\s*$+ + \ contains=typescriptString +syntax match typescriptRef +///\s*$+ + \ contains=typescriptString +syntax match typescriptRef +///\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 main_syntax == "typescript" + syntax sync clear + syntax sync ccomment typescriptComment minlines=200 +endif + +syntax case match diff --git a/syntax/basic/function.vim b/syntax/basic/function.vim new file mode 100644 index 000000000..db93b368b --- /dev/null +++ b/syntax/basic/function.vim @@ -0,0 +1,71 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptAsyncFuncKeyword async + \ nextgroup=typescriptFuncKeyword,typescriptArrowFuncDef + \ skipwhite + +syntax keyword typescriptAsyncFuncKeyword await + \ nextgroup=@typescriptValue + \ skipwhite + +syntax keyword typescriptFuncKeyword function + \ nextgroup=typescriptAsyncFunc,typescriptFuncName,@typescriptCallSignature + \ skipwhite skipempty + +syntax match typescriptAsyncFunc contained /*/ + \ nextgroup=typescriptFuncName,@typescriptCallSignature + \ skipwhite skipempty + +syntax match typescriptFuncName contained /\K\k*/ + \ nextgroup=@typescriptCallSignature + \ skipwhite + +" destructuring ({ a: ee }) => +syntax match typescriptArrowFuncDef contained /({\_[^}]*}\(:\_[^)]\)\?)\s*=>/ + \ contains=typescriptArrowFuncArg,typescriptArrowFunc + \ nextgroup=@typescriptExpression,typescriptBlock + \ skipwhite skipempty + +" matches `(a) =>` or `([a]) =>` or +" `( +" a) =>` +syntax match typescriptArrowFuncDef contained /(\(\_s*[a-zA-Z\$_\[.]\_[^)]*\)*)\s*=>/ + \ contains=typescriptArrowFuncArg,typescriptArrowFunc + \ nextgroup=@typescriptExpression,typescriptBlock + \ skipwhite skipempty + +syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/ + \ contains=typescriptArrowFuncArg,typescriptArrowFunc + \ nextgroup=@typescriptExpression,typescriptBlock + \ skipwhite skipempty + +" TODO: optimize this pattern +syntax region typescriptArrowFuncDef contained start=/(\_[^)]*):/ end=/=>/ + \ contains=typescriptArrowFuncArg,typescriptArrowFunc,typescriptTypeAnnotation + \ nextgroup=@typescriptExpression,typescriptBlock + \ skipwhite skipempty keepend + +syntax match typescriptArrowFunc /=>/ +syntax match typescriptArrowFuncArg contained /\K\k*/ +syntax region typescriptArrowFuncArg contained start=/<\|(/ end=/\ze=>/ contains=@typescriptCallSignature + +syntax region typescriptReturnAnnotation contained start=/:/ end=/{/me=e-1 contains=@typescriptType nextgroup=typescriptBlock + + +syntax region typescriptFuncImpl contained start=/function/ end=/{/me=e-1 + \ contains=typescriptFuncKeyword + \ nextgroup=typescriptBlock + +syntax cluster typescriptCallImpl contains=typescriptGenericImpl,typescriptParamImpl +syntax region typescriptGenericImpl matchgroup=typescriptTypeBrackets + \ start=// skip=/\s*,\s*/ + \ contains=typescriptTypeParameter + \ nextgroup=typescriptParamImpl + \ contained skipwhite +syntax region typescriptParamImpl matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=typescriptDecorator,@typescriptParameterList,@typescriptComments + \ nextgroup=typescriptReturnAnnotation,typescriptBlock + \ contained skipwhite skipnl diff --git a/syntax/basic/identifiers.vim b/syntax/basic/identifiers.vim new file mode 100644 index 000000000..2a88102c3 --- /dev/null +++ b/syntax/basic/identifiers.vim @@ -0,0 +1,33 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax cluster afterIdentifier contains= + \ typescriptDotNotation, + \ typescriptFuncCallArg, + \ typescriptTemplate, + \ typescriptIndexExpr, + \ @typescriptSymbols, + \ typescriptTypeArguments + +syntax match typescriptIdentifierName /\<\K\k*/ + \ nextgroup=@afterIdentifier + \ transparent + \ contains=@_semantic + \ skipnl skipwhite + +syntax match typescriptProp contained /\K\k*!\?/ + \ transparent + \ contains=@props + \ nextgroup=@afterIdentifier + \ skipwhite skipempty + +syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty + +syntax match typescriptDotNotation /\./ nextgroup=typescriptProp skipnl +syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent +" syntax match typescriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg +syntax region typescriptParenExp matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty +syntax region typescriptFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl +syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression +syntax region typescriptEventString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ contains=typescriptASCII,@events diff --git a/syntax/basic/keyword.vim b/syntax/basic/keyword.vim new file mode 100644 index 000000000..999dca076 --- /dev/null +++ b/syntax/basic/keyword.vim @@ -0,0 +1,95 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +"Import +syntax keyword typescriptImport from as import +syntax keyword typescriptExport export +syntax keyword typescriptModule namespace module + +"this + +"JavaScript Prototype +syntax keyword typescriptPrototype prototype + \ nextgroup=@afterIdentifier + +syntax keyword typescriptCastKeyword as + \ nextgroup=@typescriptType + \ skipwhite + +"Program Keywords +syntax keyword typescriptIdentifier arguments this super + \ nextgroup=@afterIdentifier + +syntax keyword typescriptVariable let var + \ nextgroup=typescriptVariableDeclaration + \ skipwhite skipempty skipnl + +syntax keyword typescriptVariable const + \ nextgroup=typescriptEnum,typescriptVariableDeclaration + \ skipwhite + +syntax match typescriptVariableDeclaration /[A-Za-z_$]\k*/ + \ nextgroup=typescriptTypeAnnotation,typescriptAssign + \ contained skipwhite skipempty skipnl + +syntax region typescriptEnum matchgroup=typescriptEnumKeyword start=/enum / end=/\ze{/ + \ nextgroup=typescriptBlock + \ skipwhite + +syntax keyword typescriptKeywordOp + \ contained in instanceof nextgroup=@typescriptValue +syntax keyword typescriptOperator delete new typeof void + \ nextgroup=@typescriptValue + \ skipwhite skipempty + +syntax keyword typescriptForOperator contained in of +syntax keyword typescriptBoolean true false nextgroup=@typescriptSymbols skipwhite skipempty +syntax keyword typescriptNull null undefined nextgroup=@typescriptSymbols skipwhite skipempty +syntax keyword typescriptMessage alert confirm prompt status + \ nextgroup=typescriptDotNotation,typescriptFuncCallArg +syntax keyword typescriptGlobal self top parent + \ nextgroup=@afterIdentifier + +"Statement Keywords +syntax keyword typescriptConditional if else switch + \ nextgroup=typescriptConditionalParen + \ skipwhite skipempty skipnl +syntax keyword typescriptConditionalElse else +syntax keyword typescriptRepeat do while for nextgroup=typescriptLoopParen skipwhite skipempty +syntax keyword typescriptRepeat for nextgroup=typescriptLoopParen,typescriptAsyncFor skipwhite skipempty +syntax keyword typescriptBranch break continue containedin=typescriptBlock +syntax keyword typescriptCase case nextgroup=@typescriptPrimitive skipwhite containedin=typescriptBlock +syntax keyword typescriptDefault default containedin=typescriptBlock nextgroup=@typescriptValue,typescriptClassKeyword,typescriptInterfaceKeyword skipwhite oneline +syntax keyword typescriptStatementKeyword with +syntax keyword typescriptStatementKeyword yield skipwhite nextgroup=@typescriptValue containedin=typescriptBlock +syntax keyword typescriptStatementKeyword return skipwhite contained nextgroup=@typescriptValue containedin=typescriptBlock + +syntax keyword typescriptTry try +syntax keyword typescriptExceptions catch throw finally +syntax keyword typescriptDebugger debugger + +syntax keyword typescriptAsyncFor await nextgroup=typescriptLoopParen skipwhite skipempty contained + +syntax region typescriptLoopParen contained matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=typescriptVariable,typescriptForOperator,typescriptEndColons,@typescriptValue,@typescriptComments + \ nextgroup=typescriptBlock + \ skipwhite skipempty +syntax region typescriptConditionalParen contained matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=@typescriptValue,@typescriptComments + \ nextgroup=typescriptBlock + \ skipwhite skipempty +syntax match typescriptEndColons /[;,]/ contained + +syntax keyword typescriptAmbientDeclaration declare nextgroup=@typescriptAmbients + \ skipwhite skipempty + +syntax cluster typescriptAmbients contains= + \ typescriptVariable, + \ typescriptFuncKeyword, + \ typescriptClassKeyword, + \ typescriptAbstract, + \ typescriptEnumKeyword,typescriptEnum, + \ typescriptModule diff --git a/syntax/basic/literal.vim b/syntax/basic/literal.vim new file mode 100644 index 000000000..315d61233 --- /dev/null +++ b/syntax/basic/literal.vim @@ -0,0 +1,47 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +"Syntax in the JavaScript code + +" String +syntax match typescriptASCII contained /\\\d\d\d/ + +syntax region typescriptTemplateSubstitution matchgroup=typescriptTemplateSB + \ start=/\${/ end=/}/ + \ contains=@typescriptValue + \ contained + + +syntax region typescriptString + \ start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ + \ contains=typescriptSpecial,@Spell + \ extend + +syntax match typescriptSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{4,5}})|c\u|.)" + +" From vim runtime +" +syntax region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimuy]\{0,5\}\s*$+ end=+/[gimuy]\{0,5\}\s*[;.,)\]}]+me=e-1 nextgroup=typescriptDotNotation oneline + +syntax region typescriptTemplate + \ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/ + \ contains=typescriptTemplateSubstitution + \ nextgroup=@typescriptSymbols + \ skipwhite skipempty + +"Array +syntax region typescriptArray matchgroup=typescriptBraces + \ start=/\[/ end=/]/ + \ contains=@typescriptValue,@typescriptComments + \ nextgroup=@typescriptSymbols,typescriptDotNotation + \ skipwhite skipempty fold + +" Number +syntax match typescriptNumber /\<0[bB][01][01_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty +syntax match typescriptNumber /\<0[oO][0-7][0-7_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty +syntax match typescriptNumber /\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty +syntax match typescriptNumber /\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\|\.\d[0-9]*/ + \ nextgroup=typescriptExponent,@typescriptSymbols skipwhite skipempty +syntax match typescriptExponent /[eE][+-]\=\d[0-9]*\>/ + \ nextgroup=@typescriptSymbols skipwhite skipempty contained diff --git a/syntax/basic/members.vim b/syntax/basic/members.vim new file mode 100644 index 000000000..45fafbcc8 --- /dev/null +++ b/syntax/basic/members.vim @@ -0,0 +1,50 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptConstructor contained constructor + \ nextgroup=@typescriptCallSignature + \ skipwhite skipempty + + +syntax cluster memberNextGroup contains=typescriptMemberOptionality,typescriptTypeAnnotation,@typescriptCallSignature + +syntax match typescriptMember /\K\k*/ + \ nextgroup=@memberNextGroup + \ contained skipwhite + +syntax match typescriptMethodAccessor contained /\v(get|set)\s\K/me=e-1 + \ nextgroup=@typescriptMembers + +syntax cluster typescriptPropertyMemberDeclaration contains= + \ typescriptClassStatic, + \ typescriptAccessibilityModifier, + \ typescriptReadonlyModifier, + \ typescriptMethodAccessor, + \ @typescriptMembers + " \ typescriptMemberVariableDeclaration + +syntax match typescriptMemberOptionality /?\|!/ contained + \ nextgroup=typescriptTypeAnnotation,@typescriptCallSignature + \ skipwhite skipempty + +syntax cluster typescriptMembers contains=typescriptMember,typescriptStringMember,typescriptComputedMember + +syntax keyword typescriptClassStatic static + \ nextgroup=@typescriptMembers,typescriptAsyncFuncKeyword,typescriptReadonlyModifier + \ skipwhite contained + +syntax keyword typescriptAccessibilityModifier public private protected contained + +syntax keyword typescriptReadonlyModifier readonly contained + +syntax region typescriptStringMember contained + \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1/ + \ nextgroup=@memberNextGroup + \ skipwhite skipempty + +syntax region typescriptComputedMember contained matchgroup=typescriptProperty + \ start=/\[/rs=s+1 end=/]/ + \ contains=@typescriptValue,typescriptMember,typescriptMappedIn + \ nextgroup=@memberNextGroup + \ skipwhite skipempty diff --git a/syntax/basic/object.vim b/syntax/basic/object.vim new file mode 100644 index 000000000..533201c31 --- /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 diff --git a/syntax/basic/patch.vim b/syntax/basic/patch.vim new file mode 100644 index 000000000..ea4adfa29 --- /dev/null +++ b/syntax/basic/patch.vim @@ -0,0 +1,9 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +" patch for generated code +syntax keyword typescriptGlobal Promise + \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline +syntax keyword typescriptGlobal Map WeakMap + \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline diff --git a/syntax/basic/reserved.vim b/syntax/basic/reserved.vim new file mode 100644 index 000000000..cf6467c26 --- /dev/null +++ b/syntax/basic/reserved.vim @@ -0,0 +1,35 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax cluster typescriptStrings contains=typescriptProp,typescriptString,typescriptTemplate,@typescriptComments,typescriptDocComment,typescriptRegexpString,typescriptPropertyName + +syntax cluster typescriptNoReserved contains= + \ @typescriptStrings, + \ @typescriptDocs, + \ @typescriptComments, + \ shellbang, + \ typescriptObjectLiteral, + \ typescriptObjectLabel, + \ typescriptClassBlock, + \ @typescriptType, + \ typescriptCall + +"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved break case catch const continue +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved debugger delete do else export +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved extends finally for if +"import,typescriptRegexpString,typescriptPropertyName +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved in instanceof let new return super +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved static switch throw try typeof +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved void while with yield + +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved implements package protected +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved interface private public readonly abstract +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved byte char double final float goto int +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved long native short synchronized transient +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved volatile + +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved class +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved var +syntax keyword typescriptReserved containedin=ALLBUT,@typescriptNoReserved function diff --git a/syntax/basic/symbols.vim b/syntax/basic/symbols.vim new file mode 100644 index 000000000..978694e18 --- /dev/null +++ b/syntax/basic/symbols.vim @@ -0,0 +1,42 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +" + - ^ ~ +syntax match typescriptUnaryOp /[+\-~!]/ + \ nextgroup=@typescriptValue + \ skipwhite + +syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty + +syntax match typescriptAssign /=/ nextgroup=@typescriptValue + \ skipwhite skipempty + +" 2: ==, === +syntax match typescriptBinaryOp contained /===\?/ nextgroup=@typescriptValue skipwhite skipempty +" 6: >>>=, >>>, >>=, >>, >=, > +syntax match typescriptBinaryOp contained />\(>>=\|>>\|>=\|>\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 4: <<=, <<, <=, < +syntax match typescriptBinaryOp contained /<\(<=\|<\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 3: ||, |=, | +syntax match typescriptBinaryOp contained /|\(|\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 3: &&, &=, & +syntax match typescriptBinaryOp contained /&\(&\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 2: *=, * +syntax match typescriptBinaryOp contained /\*=\?/ nextgroup=@typescriptValue skipwhite skipempty +" 2: %=, % +syntax match typescriptBinaryOp contained /%=\?/ nextgroup=@typescriptValue skipwhite skipempty +" 2: /=, / +syntax match typescriptBinaryOp contained +/\(=\|[^\*/]\@=\)+ nextgroup=@typescriptValue skipwhite skipempty +syntax match typescriptBinaryOp contained /!==\?/ nextgroup=@typescriptValue skipwhite skipempty +" 2: !=, !== +syntax match typescriptBinaryOp contained /+\(+\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 3: +, ++, += +syntax match typescriptBinaryOp contained /-\(-\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 3: -, --, -= + +" exponentiation operator +" 2: **, **= +syntax match typescriptBinaryOp contained /\*\*=\?/ nextgroup=@typescriptValue + +syntax cluster typescriptSymbols contains=typescriptBinaryOp,typescriptKeywordOp,typescriptTernary,typescriptAssign,typescriptCastKeyword diff --git a/syntax/basic/type.vim b/syntax/basic/type.vim new file mode 100644 index 000000000..6f9097b0a --- /dev/null +++ b/syntax/basic/type.vim @@ -0,0 +1,191 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +" Types +syntax match typescriptOptionalMark /?/ contained + +syntax region typescriptTypeParameters matchgroup=typescriptTypeBrackets + \ start=// + \ contains=typescriptTypeParameter + \ contained + +syntax match typescriptTypeParameter /\K\k*/ + \ nextgroup=typescriptConstraint,typescriptGenericDefault + \ contained skipwhite skipnl + +syntax keyword typescriptConstraint extends + \ nextgroup=@typescriptType + \ contained skipwhite skipnl + +syntax match typescriptGenericDefault /=/ + \ nextgroup=@typescriptType + \ contained skipwhite + +">< +" class A extend B {} // ClassBlock +" func() // FuncCallArg +syntax region typescriptTypeArguments matchgroup=typescriptTypeBrackets + \ start=/\>/ + \ contains=@typescriptType + \ nextgroup=typescriptFuncCallArg,@typescriptTypeOperator + \ contained skipwhite + + +syntax cluster typescriptType contains= + \ @typescriptPrimaryType, + \ typescriptUnion, + \ @typescriptFunctionType, + \ typescriptConstructorType + +" array type: A[] +" type indexing A['key'] +syntax region typescriptTypeBracket contained + \ start=/\[/ end=/\]/ + \ contains=typescriptString,typescriptNumber + \ nextgroup=@typescriptTypeOperator + \ skipwhite skipempty + +syntax cluster typescriptPrimaryType contains= + \ typescriptParenthesizedType, + \ typescriptPredefinedType, + \ typescriptTypeReference, + \ typescriptObjectType, + \ typescriptTupleType, + \ typescriptTypeQuery, + \ typescriptStringLiteralType, + \ typescriptReadonlyArrayKeyword + +syntax region typescriptStringLiteralType contained + \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ + \ nextgroup=typescriptUnion + \ skipwhite skipempty + +syntax region typescriptParenthesizedType matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=@typescriptType + \ nextgroup=@typescriptTypeOperator + \ contained skipwhite skipempty fold + +syntax match typescriptTypeReference /\K\k*\(\.\K\k*\)*/ + \ nextgroup=typescriptTypeArguments,@typescriptTypeOperator,typescriptUserDefinedType + \ skipwhite contained skipempty + +syntax keyword typescriptPredefinedType any number boolean string void never undefined null object unknown + \ nextgroup=@typescriptTypeOperator + \ contained skipwhite skipempty + +syntax match typescriptPredefinedType /unique symbol/ + \ nextgroup=@typescriptTypeOperator + \ contained skipwhite skipempty + +syntax region typescriptObjectType matchgroup=typescriptBraces + \ start=/{/ end=/}/ + \ contains=@typescriptTypeMember,typescriptEndColons,@typescriptComments,typescriptAccessibilityModifier,typescriptReadonlyModifier + \ nextgroup=@typescriptTypeOperator + \ contained skipwhite fold + +syntax cluster typescriptTypeMember contains= + \ @typescriptCallSignature, + \ typescriptConstructSignature, + \ typescriptIndexSignature, + \ @typescriptMembers + +syntax region typescriptTupleType matchgroup=typescriptBraces + \ start=/\[/ end=/\]/ + \ contains=@typescriptType + \ contained skipwhite oneline + +syntax cluster typescriptTypeOperator + \ contains=typescriptUnion,typescriptTypeBracket + +syntax match typescriptUnion /|\|&/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty + +syntax cluster typescriptFunctionType contains=typescriptGenericFunc,typescriptFuncType +syntax region typescriptGenericFunc matchgroup=typescriptTypeBrackets + \ start=// + \ contains=typescriptTypeParameter + \ nextgroup=typescriptFuncType + \ containedin=typescriptFunctionType + \ contained skipwhite skipnl + +syntax region typescriptFuncType matchgroup=typescriptParens + \ start=/(/ end=/)\s*=>/me=e-2 + \ contains=@typescriptParameterList + \ nextgroup=typescriptFuncTypeArrow + \ contained skipwhite skipnl oneline + +syntax match typescriptFuncTypeArrow /=>/ + \ nextgroup=@typescriptType + \ containedin=typescriptFuncType + \ contained skipwhite skipnl + + +syntax keyword typescriptConstructorType new + \ nextgroup=@typescriptFunctionType + \ contained skipwhite skipnl + +syntax keyword typescriptUserDefinedType is + \ contained nextgroup=@typescriptType skipwhite skipempty + +syntax keyword typescriptTypeQuery typeof keyof + \ nextgroup=typescriptTypeReference + \ contained skipwhite skipnl + +syntax cluster typescriptCallSignature contains=typescriptGenericCall,typescriptCall +syntax region typescriptGenericCall matchgroup=typescriptTypeBrackets + \ start=// + \ contains=typescriptTypeParameter + \ nextgroup=typescriptCall + \ contained skipwhite skipnl +syntax region typescriptCall matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=typescriptDecorator,@typescriptParameterList,@typescriptComments + \ nextgroup=typescriptTypeAnnotation,typescriptBlock + \ contained skipwhite skipnl + +syntax match typescriptTypeAnnotation /:/ + \ nextgroup=@typescriptType + \ contained skipwhite skipnl + +syntax cluster typescriptParameterList contains= + \ typescriptTypeAnnotation, + \ typescriptAccessibilityModifier, + \ typescriptOptionalMark, + \ typescriptRestOrSpread, + \ typescriptFuncComma, + \ typescriptDefaultParam + +syntax match typescriptFuncComma /,/ contained + +syntax match typescriptDefaultParam /=/ + \ nextgroup=@typescriptValue + \ contained skipwhite + +syntax keyword typescriptConstructSignature new + \ nextgroup=@typescriptCallSignature + \ contained skipwhite + +syntax region typescriptIndexSignature matchgroup=typescriptBraces + \ start=/\[/ end=/\]/ + \ contains=typescriptPredefinedType,typescriptMappedIn,typescriptString + \ nextgroup=typescriptTypeAnnotation + \ contained skipwhite oneline + +syntax keyword typescriptMappedIn in + \ nextgroup=@typescriptType + \ contained skipwhite skipnl skipempty + +syntax keyword typescriptAliasKeyword type + \ nextgroup=typescriptAliasDeclaration + \ skipwhite skipnl skipempty + +syntax region typescriptAliasDeclaration matchgroup=typescriptUnion + \ start=/ / end=/=/ + \ nextgroup=@typescriptType + \ contains=typescriptConstraint,typescriptTypeParameters + \ contained skipwhite skipempty + +syntax keyword typescriptReadonlyArrayKeyword readonly + \ nextgroup=@typescriptPrimaryType + \ skipwhite diff --git a/syntax/common.vim b/syntax/common.vim new file mode 100644 index 000000000..b639206b0 --- /dev/null +++ b/syntax/common.vim @@ -0,0 +1,165 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +" Define the default highlighting. +" For version 5.8 and later: only when an item doesn't have highlighting yet +let did_typescript_hilink = 1 + +syntax sync fromstart +command -nargs=+ HiLink hi def link + +"Dollar sign is permitted anywhere in an identifier +setlocal iskeyword-=$ +if main_syntax == 'typescript' || main_syntax == 'typescript.tsx' + setlocal iskeyword+=$ + " syntax cluster htmlJavaScript contains=TOP +endif + +" lowest priority on least used feature +syntax match typescriptLabel /[a-zA-Z_$]\k*:/he=e-1 contains=typescriptReserved nextgroup=@typescriptStatement skipwhite skipempty + +" other keywords like return,case,yield uses containedin +syntax region typescriptBlock matchgroup=typescriptBraces start=/{/ end=/}/ contains=@typescriptStatement,@typescriptComments fold + + +runtime syntax/basic/identifiers.vim +runtime syntax/basic/literal.vim +runtime syntax/basic/object.vim + +runtime syntax/basic/symbols.vim +" runtime syntax/basic/reserved.vim +runtime syntax/basic/keyword.vim +runtime syntax/basic/doc.vim +runtime syntax/basic/type.vim + +" extension +if get(g:, 'yats_host_keyword', 1) + runtime syntax/yats.vim +endif + +" patch +runtime syntax/basic/patch.vim +runtime syntax/basic/members.vim +runtime syntax/basic/class.vim +runtime syntax/basic/cluster.vim +runtime syntax/basic/function.vim +runtime syntax/basic/decorator.vim + +if exists("did_typescript_hilink") + HiLink typescriptReserved Error + + HiLink typescriptEndColons Exception + HiLink typescriptSymbols Normal + HiLink typescriptBraces Function + HiLink typescriptParens Normal + HiLink typescriptComment Comment + HiLink typescriptLineComment Comment + HiLink typescriptDocComment Comment + HiLink typescriptCommentTodo Todo + HiLink typescriptRef Include + HiLink typescriptDocNotation SpecialComment + HiLink typescriptDocTags SpecialComment + HiLink typescriptDocNGParam typescriptDocParam + HiLink typescriptDocParam Function + HiLink typescriptDocNumParam Function + HiLink typescriptDocEventRef Function + HiLink typescriptDocNamedParamType Type + HiLink typescriptDocParamName Type + HiLink typescriptDocParamType Type + HiLink typescriptString String + HiLink typescriptSpecial Special + HiLink typescriptStringLiteralType String + HiLink typescriptStringMember String + HiLink typescriptTemplate String + HiLink typescriptEventString String + HiLink typescriptASCII Special + HiLink typescriptTemplateSB Label + HiLink typescriptRegexpString String + HiLink typescriptGlobal Constant + HiLink typescriptTestGlobal Function + HiLink typescriptPrototype Type + HiLink typescriptConditional Conditional + HiLink typescriptConditionalElse Conditional + HiLink typescriptCase Conditional + HiLink typescriptDefault typescriptCase + HiLink typescriptBranch Conditional + HiLink typescriptIdentifier Structure + HiLink typescriptVariable Identifier + HiLink typescriptEnumKeyword Identifier + HiLink typescriptRepeat Repeat + HiLink typescriptForOperator Repeat + HiLink typescriptStatementKeyword Statement + HiLink typescriptMessage Keyword + HiLink typescriptOperator Identifier + HiLink typescriptKeywordOp Identifier + HiLink typescriptCastKeyword Special + HiLink typescriptType Type + HiLink typescriptNull Boolean + HiLink typescriptNumber Number + HiLink typescriptExponent Number + HiLink typescriptBoolean Boolean + HiLink typescriptObjectLabel typescriptLabel + HiLink typescriptLabel Label + HiLink typescriptStringProperty String + HiLink typescriptImport Special + HiLink typescriptAmbientDeclaration Special + HiLink typescriptExport Special + HiLink typescriptModule Special + HiLink typescriptTry Special + HiLink typescriptExceptions Special + + HiLink typescriptMember Function + HiLink typescriptMethodAccessor Operator + + HiLink typescriptAsyncFuncKeyword Keyword + HiLink typescriptAsyncFor Keyword + HiLink typescriptFuncKeyword Keyword + HiLink typescriptAsyncFunc Keyword + HiLink typescriptArrowFunc Type + HiLink typescriptFuncName Function + HiLink typescriptFuncArg PreProc + HiLink typescriptArrowFuncArg PreProc + HiLink typescriptFuncComma Operator + + HiLink typescriptClassKeyword Keyword + HiLink typescriptClassExtends Keyword + " HiLink typescriptClassName Function + HiLink typescriptAbstract Special + " HiLink typescriptClassHeritage Function + " HiLink typescriptInterfaceHeritage Function + HiLink typescriptClassStatic StorageClass + HiLink typescriptReadonlyModifier Keyword + HiLink typescriptInterfaceKeyword Keyword + HiLink typescriptInterfaceExtends Keyword + HiLink typescriptInterfaceName Function + + HiLink shellbang Comment + + HiLink typescriptTypeParameter Identifier + HiLink typescriptConstraint Keyword + HiLink typescriptPredefinedType Type + HiLink typescriptReadonlyArrayKeyword Keyword + HiLink typescriptUnion Operator + HiLink typescriptFuncTypeArrow Function + HiLink typescriptConstructorType Function + HiLink typescriptTypeQuery Keyword + HiLink typescriptAccessibilityModifier Keyword + HiLink typescriptOptionalMark PreProc + HiLink typescriptFuncType Special + HiLink typescriptMappedIn Special + HiLink typescriptCall PreProc + HiLink typescriptParamImpl PreProc + HiLink typescriptConstructSignature Identifier + HiLink typescriptAliasDeclaration Identifier + HiLink typescriptAliasKeyword Keyword + HiLink typescriptUserDefinedType Keyword + HiLink typescriptTypeReference Identifier + HiLink typescriptConstructor Keyword + HiLink typescriptDecorator Special + + highlight link typeScript NONE + + delcommand HiLink + unlet did_typescript_hilink +endif diff --git a/syntax/smhl.vim b/syntax/smhl.vim new file mode 100644 index 000000000..eb7726993 --- /dev/null +++ b/syntax/smhl.vim @@ -0,0 +1,6 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax cluster _semantic contains=_semantic1,_semantic2,_semantic3,_semantic4,_semantic5,_semantic6,_semantic7,_semantic8,_semantic9,_semantic10,_semantic11,_semantic12,_semantic13,_semantic14,_semantic15,_semantic16,_semantic17,_semantic18,_semantic19,_semantic20,_semantic21,_semantic22,_semantic23,_semantic24,_semantic25 + diff --git a/syntax/tsx.vim b/syntax/tsx.vim new file mode 100644 index 000000000..c73e1bfc4 --- /dev/null +++ b/syntax/tsx.vim @@ -0,0 +1,144 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +if !exists("main_syntax") + if exists("b:current_syntax") && b:current_syntax != 'typescript' + finish + endif + let main_syntax = 'typescript.tsx' +endif + +syntax region tsxTag + \ start=+<\([^/!?<>="':]\+\)\@=+ + \ skip=+"']\+>+ + \ end=+/\@+ + \ end=+\(/>\)\@=+ + \ contained + \ contains=tsxTagName,tsxIntrinsicTagName,tsxAttrib,tsxEscJs, + \tsxCloseString,@tsxComment + +syntax match tsxTag /<>/ contained + + +" +" s~~~~~~~~~e +" and self close tag +" +" s~~~~e +" A big start regexp borrowed from https://git.io/vDyxc +syntax region tsxRegion + \ start=+<\_s*\z([a-zA-Z1-9\$_-]\+\(\.\k\+\)*\)+ + \ skip=++ + \ end=++ + \ matchgroup=tsxCloseString end=+/>+ + \ fold + \ contains=tsxRegion,tsxCloseString,tsxCloseTag,tsxTag,tsxCommentInvalid,tsxFragment,tsxEscJs,@Spell + \ keepend + \ extend + +" <> +" s~~~~~~e +" A big start regexp borrowed from https://git.io/vDyxc +syntax region tsxFragment + \ start=+\(\((\|{\|}\|\[\|,\|&&\|||\|?\|:\|=\|=>\|\Wreturn\|^return\|\Wdefault\|^\|>\)\_s*\)\@<=<>+ + \ skip=++ + \ end=++ + \ fold + \ contains=tsxRegion,tsxCloseString,tsxCloseTag,tsxTag,tsxCommentInvalid,tsxFragment,tsxEscJs,@Spell + \ keepend + \ extend + +" +" ~~~~~~ +syntax match tsxCloseTag + \ +"']\+>+ + \ contained + \ contains=tsxTagName,tsxIntrinsicTagName + +syntax match tsxCloseTag ++ contained + +syntax match tsxCloseString + \ +/>+ + \ contained + +" +" ~~~~~~~~ +syntax match tsxCommentInvalid // display + +syntax region tsxBlockComment + \ contained + \ start="/\*" + \ end="\*/" + +syntax match tsxLineComment + \ "//.*$" + \ contained + \ display + +syntax cluster tsxComment contains=tsxBlockComment,tsxLineComment + +syntax match tsxEntity "&[^; \t]*;" contains=tsxEntityPunct +syntax match tsxEntityPunct contained "[&.;]" + +" +" ~~~ +syntax match tsxTagName + \ +["'* ]\++hs=s+1 + \ contained + \ nextgroup=tsxAttrib + \ skipwhite + \ display +syntax match tsxIntrinsicTagName + \ +[ +" ~~~ +syntax match tsxAttrib + \ +[a-zA-Z_][-0-9a-zA-Z_]*+ + \ nextgroup=tsxEqual skipwhite + \ contained + \ display + +" +" ~ +syntax match tsxEqual +=+ display contained + \ nextgroup=tsxString skipwhite + +" +" s~~~~~~e +syntax region tsxString contained start=+"+ end=+"+ contains=tsxEntity,@Spell display + +" +" s~~~~~~~~~~~~~~e +syntax region tsxEscJs + \ contained + \ contains=@typescriptValue,@tsxComment + \ matchgroup=typescriptBraces + \ start=+{+ + \ end=+}+ + \ extend + +syntax cluster typescriptExpression add=tsxRegion,tsxFragment + +highlight def link tsxTag htmlTag +highlight def link tsxTagName Function +highlight def link tsxIntrinsicTagName htmlTagName +highlight def link tsxString String +highlight def link tsxNameSpace Function +highlight def link tsxCommentInvalid Error +highlight def link tsxBlockComment Comment +highlight def link tsxLineComment Comment +highlight def link tsxAttrib Type +highlight def link tsxEscJs tsxEscapeJs +highlight def link tsxCloseTag htmlTag +highlight def link tsxCloseString Identifier + +let b:current_syntax = "typescript.tsx" +if main_syntax == 'typescript.tsx' + unlet main_syntax +endif diff --git a/syntax/typescript.vim b/syntax/typescript.vim index 08f42383a..11c6b1ec9 100644 --- a/syntax/typescript.vim +++ b/syntax/typescript.vim @@ -3,341 +3,34 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != endif " Vim syntax file -" Language: typescript -" Author: MicroSoft Open Technologies Inc. -" Version: 0.1 -" Credits: Zhao Yi, Claudio Fleiner, Scott Shattuck, Jose Elera Campana +" Language: TypeScript +" Maintainer: Herrington Darkholme +" Last Change: 2016-04-05 +" Version: 1.0 +" Changes: Go to https:github.com/HerringtonDarkholme/yats.vim for recent changes. +" Origin: https://github.com/othree/yajs +" Credits: Kao Wei-Ko(othree), Jose Elera Campana, Zhao Yi, Claudio Fleiner, Scott Shattuck +" (This file is based on their hard work), gumnos (From the #vim +" IRC Channel in Freenode) + if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") + if exists("b:current_syntax") finish endif - let main_syntax = "typescript" -endif - -" Drop fold if it set but vim doesn't support it. -if version < 600 && exists("typescript_fold") - unlet typescript_fold -endif - -"" dollar sign is permitted anywhere in an identifier -setlocal iskeyword+=$ - -syntax sync fromstart - -"" syntax coloring for Node.js shebang line -syn match shebang "^#!.*/bin/env\s\+node\>" -hi link shebang Comment - -"" typescript comments"{{{ -syn keyword typescriptCommentTodo TODO FIXME XXX TBD contained -syn match typescriptLineComment "\/\/.*" contains=@Spell,typescriptCommentTodo,typescriptRef -syn match typescriptRefComment /\/\/\/<\(reference\|amd-\(dependency\|module\)\)\s\+.*\/>$/ contains=typescriptRefD,typescriptRefS -syn region typescriptRefD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ -syn region typescriptRefS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ - -syn match typescriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)" -syn region typescriptComment start="/\*" end="\*/" contains=@Spell,typescriptCommentTodo extend -"}}} -"" JSDoc support start"{{{ -if !exists("typescript_ignore_typescriptdoc") - syntax case ignore - -" syntax coloring for JSDoc comments (HTML) -"unlet b:current_syntax - - syntax region typescriptDocComment start="/\*\*\s*$" end="\*/" contains=typescriptDocTags,typescriptCommentTodo,typescriptCvsTag,@typescriptHtml,@Spell fold extend - syntax match typescriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\|returns\=\)\>" nextgroup=typescriptDocParam,typescriptDocSeeTag skipwhite - syntax match typescriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>" - syntax match typescriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+" - syntax region typescriptDocSeeTag contained matchgroup=typescriptDocSeeTag start="{" end="}" contains=typescriptDocTags - - syntax case match -endif "" JSDoc end -"}}} -syntax case match - -"" Syntax in the typescript code"{{{ -syn match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}" contained containedin=typescriptStringD,typescriptStringS,typescriptStringB display -syn region typescriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=typescriptSpecial,@htmlPreproc extend -syn region typescriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=typescriptSpecial,@htmlPreproc extend -syn region typescriptStringB start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=typescriptInterpolation,typescriptSpecial,@htmlPreproc extend - -syn region typescriptInterpolation matchgroup=typescriptInterpolationDelimiter - \ start=/${/ end=/}/ contained - \ contains=@typescriptExpression - -syn match typescriptNumber "-\=\<\d[0-9_]*L\=\>" display -syn match typescriptNumber "-\=\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>" display -syn match typescriptNumber "-\=\<0[bB][01][01_]*\>" display -syn match typescriptNumber "-\=\<0[oO]\o[0-7_]*\>" display -syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline -" syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\." -" syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc -" syntax region typescriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=typescriptSpecial,@htmlPreproc -" syntax region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline -" syntax match typescriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/ -syntax match typescriptFloat /\<-\=\%(\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\.\|\.\d[0-9]*\)\%([eE][+-]\=\d[0-9_]*\)\=\>/ -" syntax match typescriptLabel /\(?\s*\)\@/ -"}}} -"" typescript Prototype"{{{ -syntax keyword typescriptPrototype contained prototype -"}}} -" DOM, Browser and Ajax Support {{{ -"""""""""""""""""""""""" -if get(g:, 'typescript_ignore_browserwords', 0) - syntax keyword typescriptBrowserObjects window navigator screen history location - - syntax keyword typescriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea - syntax keyword typescriptDOMMethods contained createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode - syntax keyword typescriptDOMProperties contained nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName - - syntax keyword typescriptAjaxObjects XMLHttpRequest - syntax keyword typescriptAjaxProperties contained readyState responseText responseXML statusText - syntax keyword typescriptAjaxMethods contained onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader - - syntax keyword typescriptPropietaryObjects ActiveXObject - syntax keyword typescriptPropietaryMethods contained attachEvent detachEvent cancelBubble returnValue - - syntax keyword typescriptHtmlElemProperties contained className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title - - syntax keyword typescriptEventListenerKeywords contained blur click focus mouseover mouseout load item - - syntax keyword typescriptEventListenerMethods contained scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation -endif -" }}} -"" Programm Keywords"{{{ -syntax keyword typescriptSource import export from as -syntax keyword typescriptIdentifier arguments this void -syntax keyword typescriptStorageClass let var const -syntax keyword typescriptOperator delete new instanceof typeof -syntax keyword typescriptBoolean true false -syntax keyword typescriptNull null undefined -syntax keyword typescriptMessage alert confirm prompt status -syntax keyword typescriptGlobal self top parent -syntax keyword typescriptDeprecated escape unescape all applets alinkColor bgColor fgColor linkColor vlinkColor xmlEncoding -"}}} -"" Statement Keywords"{{{ -syntax keyword typescriptConditional if else switch -syntax keyword typescriptRepeat do while for in of -syntax keyword typescriptBranch break continue yield await -syntax keyword typescriptLabel case default async readonly -syntax keyword typescriptStatement return with - -syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity JSON Math Number NaN Object Packages RegExp String Symbol netscape - -syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError - -syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws goto private transient debugger implements protected volatile double import public type namespace from get set keyof -"}}} -"" typescript/DOM/HTML/CSS specified things"{{{ - -" typescript Objects"{{{ - syn match typescriptFunction "(super\s*|constructor\s*)" contained nextgroup=typescriptVars - syn region typescriptVars start="(" end=")" contained contains=typescriptParameters transparent keepend - syn match typescriptParameters "([a-zA-Z0-9_?.$][\w?.$]*)\s*:\s*([a-zA-Z0-9_?.$][\w?.$]*)" contained skipwhite -"}}} -" DOM2 Objects"{{{ - syntax keyword typescriptType DOMImplementation DocumentFragment Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction void any string boolean number symbol never object unknown - syntax keyword typescriptExceptions DOMException -"}}} -" DOM2 CONSTANT"{{{ - syntax keyword typescriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR - syntax keyword typescriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE -"}}} -" HTML events and internal variables"{{{ - syntax case ignore - syntax keyword typescriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize onload onsubmit - syntax case match -"}}} - -" Follow stuff should be highligh within a special context -" While it can't be handled with context depended with Regex based highlight -" So, turn it off by default -if exists("typescript_enable_domhtmlcss") - -" DOM2 things"{{{ - syntax match typescriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/ - syntax match typescriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=typescriptParen skipwhite -"}}} -" HTML things"{{{ - syntax match typescriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/ - syntax match typescriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=typescriptParen skipwhite -"}}} -" CSS Styles in typescript"{{{ - syntax keyword typescriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition - syntax keyword typescriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition - syntax keyword typescriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode - syntax keyword typescriptCssStyles contained bottom height left position right top width zIndex - syntax keyword typescriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout - syntax keyword typescriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop - syntax keyword typescriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType - syntax keyword typescriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage backgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat - syntax keyword typescriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType - syntax keyword typescriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText - syntax keyword typescriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor -"}}} -endif "DOM/HTML/CSS - -" Highlight ways"{{{ -syntax match typescriptDotNotation "\." nextgroup=typescriptPrototype,typescriptDomElemAttrs,typescriptDomElemFuncs,typescriptDOMMethods,typescriptDOMProperties,typescriptHtmlElemAttrs,typescriptHtmlElemFuncs,typescriptHtmlElemProperties,typescriptAjaxProperties,typescriptAjaxMethods,typescriptPropietaryMethods,typescriptEventListenerMethods skipwhite skipnl -syntax match typescriptDotNotation "\.style\." nextgroup=typescriptCssStyles -"}}} - -"" end DOM/HTML/CSS specified things""}}} - - -"" Code blocks -syntax cluster typescriptAll contains=typescriptComment,typescriptLineComment,typescriptDocComment,typescriptStringD,typescriptStringS,typescriptStringB,typescriptRegexpString,typescriptNumber,typescriptFloat,typescriptDecorators,typescriptLabel,typescriptSource,typescriptType,typescriptOperator,typescriptBoolean,typescriptNull,typescriptFuncKeyword,typescriptConditional,typescriptGlobal,typescriptRepeat,typescriptBranch,typescriptStatement,typescriptGlobalObjects,typescriptMessage,typescriptIdentifier,typescriptStorageClass,typescriptExceptions,typescriptReserved,typescriptDeprecated,typescriptDomErrNo,typescriptDomNodeConsts,typescriptHtmlEvents,typescriptDotNotation,typescriptBrowserObjects,typescriptDOMObjects,typescriptAjaxObjects,typescriptPropietaryObjects,typescriptDOMMethods,typescriptHtmlElemProperties,typescriptDOMProperties,typescriptEventListenerKeywords,typescriptEventListenerMethods,typescriptAjaxProperties,typescriptAjaxMethods,typescriptFuncArg - -if main_syntax == "typescript" - syntax sync clear - syntax sync ccomment typescriptComment minlines=200 -" syntax sync match typescriptHighlight grouphere typescriptBlock /{/ + let main_syntax = 'typescript' endif -syntax keyword typescriptFuncKeyword function -"syntax region typescriptFuncDef start="function" end="\(.*\)" contains=typescriptFuncKeyword,typescriptFuncArg keepend -"syntax match typescriptFuncArg "\(([^()]*)\)" contains=typescriptParens,typescriptFuncComma contained -"syntax match typescriptFuncComma /,/ contained -" syntax region typescriptFuncBlock contained matchgroup=typescriptFuncBlock start="{" end="}" contains=@typescriptAll,typescriptParensErrA,typescriptParensErrB,typescriptParen,typescriptBracket,typescriptBlock fold - -syn match typescriptBraces "[{}\[\]]" -syn match typescriptParens "[()]" -syn match typescriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-=" -syn match typescriptEndColons "[;,]" -syn match typescriptLogicSymbols "\(&&\)\|\(||\)\|\(!\)" - -" typescriptFold Function {{{ - -" function! typescriptFold() - -" skip curly braces inside RegEx's and comments -syn region foldBraces start=/{/ skip=/\(\/\/.*\)\|\(\/.*\/\)/ end=/}/ transparent fold keepend extend - -" setl foldtext=FoldText() -" endfunction - -" au FileType typescript call typescriptFold() - -" }}} - -" Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_typescript_syn_inits") - if version < 508 - let did_typescript_syn_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - - "typescript highlighting - HiLink typescriptParameters Operator - HiLink typescriptSuperBlock Operator - - HiLink typescriptEndColons Exception - HiLink typescriptOpSymbols Operator - HiLink typescriptLogicSymbols Boolean - HiLink typescriptBraces Function - HiLink typescriptParens Operator - HiLink typescriptComment Comment - HiLink typescriptLineComment Comment - HiLink typescriptRefComment Include - HiLink typescriptRefS String - HiLink typescriptRefD String - HiLink typescriptDocComment Comment - HiLink typescriptCommentTodo Todo - HiLink typescriptCvsTag Function - HiLink typescriptDocTags Special - HiLink typescriptDocSeeTag Function - HiLink typescriptDocParam Function - HiLink typescriptStringS String - HiLink typescriptStringD String - HiLink typescriptStringB String - HiLink typescriptInterpolationDelimiter Delimiter - HiLink typescriptRegexpString String - HiLink typescriptGlobal Constant - HiLink typescriptCharacter Character - HiLink typescriptPrototype Type - HiLink typescriptConditional Conditional - HiLink typescriptBranch Conditional - HiLink typescriptIdentifier Identifier - HiLink typescriptStorageClass StorageClass - HiLink typescriptRepeat Repeat - HiLink typescriptStatement Statement - HiLink typescriptFuncKeyword Function - HiLink typescriptMessage Keyword - HiLink typescriptDeprecated Exception - HiLink typescriptError Error - HiLink typescriptParensError Error - HiLink typescriptParensErrA Error - HiLink typescriptParensErrB Error - HiLink typescriptParensErrC Error - HiLink typescriptReserved Keyword - HiLink typescriptOperator Operator - HiLink typescriptType Type - HiLink typescriptNull Type - HiLink typescriptNumber Number - HiLink typescriptFloat Number - HiLink typescriptDecorators Special - HiLink typescriptBoolean Boolean - HiLink typescriptLabel Label - HiLink typescriptSpecial Special - HiLink typescriptSource Special - HiLink typescriptGlobalObjects Special - HiLink typescriptExceptions Special +" nextgroup doesn't contain objectLiteral, let outer region contains it +syntax region typescriptTypeCast matchgroup=typescriptTypeBrackets + \ start=/< \@!/ end=/>/ + \ contains=@typescriptType + \ nextgroup=@typescriptExpression + \ contained skipwhite oneline - HiLink typescriptDomErrNo Constant - HiLink typescriptDomNodeConsts Constant - HiLink typescriptDomElemAttrs Label - HiLink typescriptDomElemFuncs PreProc - - HiLink typescriptHtmlElemAttrs Label - HiLink typescriptHtmlElemFuncs PreProc - - HiLink typescriptCssStyles Label - - " Ajax Highlighting - HiLink typescriptBrowserObjects Constant - - HiLink typescriptDOMObjects Constant - HiLink typescriptDOMMethods Function - HiLink typescriptDOMProperties Special - - HiLink typescriptAjaxObjects Constant - HiLink typescriptAjaxMethods Function - HiLink typescriptAjaxProperties Special - - HiLink typescriptFuncDef Title - HiLink typescriptFuncArg Special - HiLink typescriptFuncComma Operator - - HiLink typescriptHtmlEvents Special - HiLink typescriptHtmlElemProperties Special - - HiLink typescriptEventListenerKeywords Keyword - - HiLink typescriptNumber Number - HiLink typescriptPropietaryObjects Constant - - delcommand HiLink -endif - -" Define the htmltypescript for HTML syntax html.vim -"syntax clear htmltypescript -"syntax clear typescriptExpression -syntax cluster htmltypescript contains=@typescriptAll,typescriptBracket,typescriptParen,typescriptBlock,typescriptParenError -syntax cluster typescriptExpression contains=@typescriptAll,typescriptBracket,typescriptParen,typescriptBlock,typescriptParenError,@htmlPreproc +runtime syntax/common.vim let b:current_syntax = "typescript" if main_syntax == 'typescript' unlet main_syntax endif - -" vim: ts=4 diff --git a/syntax/yats.vim b/syntax/yats.vim new file mode 100644 index 000000000..1865eb68a --- /dev/null +++ b/syntax/yats.vim @@ -0,0 +1,50 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +runtime syntax/yats/typescript.vim +runtime syntax/yats/es6-number.vim +runtime syntax/yats/es6-string.vim +runtime syntax/yats/es6-array.vim +runtime syntax/yats/es6-object.vim +runtime syntax/yats/es6-symbol.vim +runtime syntax/yats/es6-function.vim +runtime syntax/yats/es6-math.vim +runtime syntax/yats/es6-date.vim +runtime syntax/yats/es6-json.vim +runtime syntax/yats/es6-regexp.vim +runtime syntax/yats/es6-map.vim +runtime syntax/yats/es6-set.vim +runtime syntax/yats/es6-proxy.vim +runtime syntax/yats/es6-promise.vim +runtime syntax/yats/es6-reflect.vim +runtime syntax/yats/ecma-402.vim +runtime syntax/yats/node.vim +runtime syntax/yats/test.vim +runtime syntax/yats/web.vim +runtime syntax/yats/web-window.vim +runtime syntax/yats/web-navigator.vim +runtime syntax/yats/web-location.vim +runtime syntax/yats/web-history.vim +runtime syntax/yats/web-console.vim +runtime syntax/yats/web-xhr.vim +runtime syntax/yats/web-blob.vim +runtime syntax/yats/web-crypto.vim +runtime syntax/yats/web-fetch.vim +runtime syntax/yats/web-service-worker.vim +runtime syntax/yats/web-encoding.vim +runtime syntax/yats/web-geo.vim +runtime syntax/yats/web-network.vim +runtime syntax/yats/web-payment.vim +runtime syntax/yats/dom-node.vim +runtime syntax/yats/dom-elem.vim +runtime syntax/yats/dom-document.vim +runtime syntax/yats/dom-event.vim +runtime syntax/yats/dom-storage.vim +runtime syntax/yats/dom-form.vim +runtime syntax/yats/css.vim + + +let typescript_props = 1 + +runtime syntax/yats/event.vim diff --git a/syntax/yats/css.vim b/syntax/yats/css.vim new file mode 100644 index 000000000..b1df41ef9 --- /dev/null +++ b/syntax/yats/css.vim @@ -0,0 +1,75 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptDOMStyle contained alignContent alignItems alignSelf animation +syntax keyword typescriptDOMStyle contained animationDelay animationDirection animationDuration +syntax keyword typescriptDOMStyle contained animationFillMode animationIterationCount +syntax keyword typescriptDOMStyle contained animationName animationPlayState animationTimingFunction +syntax keyword typescriptDOMStyle contained appearance backfaceVisibility background +syntax keyword typescriptDOMStyle contained backgroundAttachment backgroundBlendMode +syntax keyword typescriptDOMStyle contained backgroundClip backgroundColor backgroundImage +syntax keyword typescriptDOMStyle contained backgroundOrigin backgroundPosition backgroundRepeat +syntax keyword typescriptDOMStyle contained backgroundSize border borderBottom borderBottomColor +syntax keyword typescriptDOMStyle contained borderBottomLeftRadius borderBottomRightRadius +syntax keyword typescriptDOMStyle contained borderBottomStyle borderBottomWidth borderCollapse +syntax keyword typescriptDOMStyle contained borderColor borderImage borderImageOutset +syntax keyword typescriptDOMStyle contained borderImageRepeat borderImageSlice borderImageSource +syntax keyword typescriptDOMStyle contained borderImageWidth borderLeft borderLeftColor +syntax keyword typescriptDOMStyle contained borderLeftStyle borderLeftWidth borderRadius +syntax keyword typescriptDOMStyle contained borderRight borderRightColor borderRightStyle +syntax keyword typescriptDOMStyle contained borderRightWidth borderSpacing borderStyle +syntax keyword typescriptDOMStyle contained borderTop borderTopColor borderTopLeftRadius +syntax keyword typescriptDOMStyle contained borderTopRightRadius borderTopStyle borderTopWidth +syntax keyword typescriptDOMStyle contained borderWidth bottom boxDecorationBreak +syntax keyword typescriptDOMStyle contained boxShadow boxSizing breakAfter breakBefore +syntax keyword typescriptDOMStyle contained breakInside captionSide caretColor caretShape +syntax keyword typescriptDOMStyle contained caret clear clip clipPath color columns +syntax keyword typescriptDOMStyle contained columnCount columnFill columnGap columnRule +syntax keyword typescriptDOMStyle contained columnRuleColor columnRuleStyle columnRuleWidth +syntax keyword typescriptDOMStyle contained columnSpan columnWidth content counterIncrement +syntax keyword typescriptDOMStyle contained counterReset cursor direction display +syntax keyword typescriptDOMStyle contained emptyCells flex flexBasis flexDirection +syntax keyword typescriptDOMStyle contained flexFlow flexGrow flexShrink flexWrap +syntax keyword typescriptDOMStyle contained float font fontFamily fontFeatureSettings +syntax keyword typescriptDOMStyle contained fontKerning fontLanguageOverride fontSize +syntax keyword typescriptDOMStyle contained fontSizeAdjust fontStretch fontStyle fontSynthesis +syntax keyword typescriptDOMStyle contained fontVariant fontVariantAlternates fontVariantCaps +syntax keyword typescriptDOMStyle contained fontVariantEastAsian fontVariantLigatures +syntax keyword typescriptDOMStyle contained fontVariantNumeric fontVariantPosition +syntax keyword typescriptDOMStyle contained fontWeight grad grid gridArea gridAutoColumns +syntax keyword typescriptDOMStyle contained gridAutoFlow gridAutoPosition gridAutoRows +syntax keyword typescriptDOMStyle contained gridColumn gridColumnStart gridColumnEnd +syntax keyword typescriptDOMStyle contained gridRow gridRowStart gridRowEnd gridTemplate +syntax keyword typescriptDOMStyle contained gridTemplateAreas gridTemplateRows gridTemplateColumns +syntax keyword typescriptDOMStyle contained height hyphens imageRendering imageResolution +syntax keyword typescriptDOMStyle contained imageOrientation imeMode inherit justifyContent +syntax keyword typescriptDOMStyle contained left letterSpacing lineBreak lineHeight +syntax keyword typescriptDOMStyle contained listStyle listStyleImage listStylePosition +syntax keyword typescriptDOMStyle contained listStyleType margin marginBottom marginLeft +syntax keyword typescriptDOMStyle contained marginRight marginTop marks mask maskType +syntax keyword typescriptDOMStyle contained maxHeight maxWidth minHeight minWidth +syntax keyword typescriptDOMStyle contained mixBlendMode objectFit objectPosition +syntax keyword typescriptDOMStyle contained opacity order orphans outline outlineColor +syntax keyword typescriptDOMStyle contained outlineOffset outlineStyle outlineWidth +syntax keyword typescriptDOMStyle contained overflow overflowWrap overflowX overflowY +syntax keyword typescriptDOMStyle contained overflowClipBox padding paddingBottom +syntax keyword typescriptDOMStyle contained paddingLeft paddingRight paddingTop pageBreakAfter +syntax keyword typescriptDOMStyle contained pageBreakBefore pageBreakInside perspective +syntax keyword typescriptDOMStyle contained perspectiveOrigin pointerEvents position +syntax keyword typescriptDOMStyle contained quotes resize right shapeImageThreshold +syntax keyword typescriptDOMStyle contained shapeMargin shapeOutside tableLayout tabSize +syntax keyword typescriptDOMStyle contained textAlign textAlignLast textCombineHorizontal +syntax keyword typescriptDOMStyle contained textDecoration textDecorationColor textDecorationLine +syntax keyword typescriptDOMStyle contained textDecorationStyle textIndent textOrientation +syntax keyword typescriptDOMStyle contained textOverflow textRendering textShadow +syntax keyword typescriptDOMStyle contained textTransform textUnderlinePosition top +syntax keyword typescriptDOMStyle contained touchAction transform transformOrigin +syntax keyword typescriptDOMStyle contained transformStyle transition transitionDelay +syntax keyword typescriptDOMStyle contained transitionDuration transitionProperty +syntax keyword typescriptDOMStyle contained transitionTimingFunction unicodeBidi unicodeRange +syntax keyword typescriptDOMStyle contained userSelect userZoom verticalAlign visibility +syntax keyword typescriptDOMStyle contained whiteSpace width willChange wordBreak +syntax keyword typescriptDOMStyle contained wordSpacing wordWrap writingMode zIndex +if exists("did_typescript_hilink") | HiLink typescriptDOMStyle Keyword +endif diff --git a/syntax/yats/dom-document.vim b/syntax/yats/dom-document.vim new file mode 100644 index 000000000..dfe4f5bae --- /dev/null +++ b/syntax/yats/dom-document.vim @@ -0,0 +1,36 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptDOMDocProp contained activeElement body cookie defaultView +syntax keyword typescriptDOMDocProp contained designMode dir domain embeds forms head +syntax keyword typescriptDOMDocProp contained images lastModified links location plugins +syntax keyword typescriptDOMDocProp contained postMessage readyState referrer registerElement +syntax keyword typescriptDOMDocProp contained scripts styleSheets title vlinkColor +syntax keyword typescriptDOMDocProp contained xmlEncoding characterSet compatMode +syntax keyword typescriptDOMDocProp contained contentType currentScript doctype documentElement +syntax keyword typescriptDOMDocProp contained documentURI documentURIObject firstChild +syntax keyword typescriptDOMDocProp contained implementation lastStyleSheetSet namespaceURI +syntax keyword typescriptDOMDocProp contained nodePrincipal ononline pointerLockElement +syntax keyword typescriptDOMDocProp contained popupNode preferredStyleSheetSet selectedStyleSheetSet +syntax keyword typescriptDOMDocProp contained styleSheetSets textContent tooltipNode +syntax cluster props add=typescriptDOMDocProp +if exists("did_typescript_hilink") | HiLink typescriptDOMDocProp Keyword +endif +syntax keyword typescriptDOMDocMethod contained caretPositionFromPoint close createNodeIterator nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained createRange createTreeWalker elementFromPoint nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained getElementsByName adoptNode createAttribute nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained createCDATASection createComment createDocumentFragment nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained createElement createElementNS createEvent nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained createExpression createNSResolver nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained createProcessingInstruction createTextNode nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained enableStyleSheetsForSet evaluate execCommand nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained exitPointerLock getBoxObjectFor getElementById nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained getElementsByClassName getElementsByTagName nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained getElementsByTagNameNS getSelection nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained hasFocus importNode loadOverlay open nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained queryCommandSupported querySelector nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMDocMethod contained querySelectorAll write writeln nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptDOMDocMethod +if exists("did_typescript_hilink") | HiLink typescriptDOMDocMethod Keyword +endif diff --git a/syntax/yats/dom-elem.vim b/syntax/yats/dom-elem.vim new file mode 100644 index 000000000..b9629bac3 --- /dev/null +++ b/syntax/yats/dom-elem.vim @@ -0,0 +1,27 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptDOMElemAttrs contained accessKey clientHeight clientLeft +syntax keyword typescriptDOMElemAttrs contained clientTop clientWidth id innerHTML +syntax keyword typescriptDOMElemAttrs contained length onafterscriptexecute onbeforescriptexecute +syntax keyword typescriptDOMElemAttrs contained oncopy oncut onpaste onwheel scrollHeight +syntax keyword typescriptDOMElemAttrs contained scrollLeft scrollTop scrollWidth tagName +syntax keyword typescriptDOMElemAttrs contained classList className name outerHTML +syntax keyword typescriptDOMElemAttrs contained style +if exists("did_typescript_hilink") | HiLink typescriptDOMElemAttrs Keyword +endif +syntax keyword typescriptDOMElemFuncs contained getAttributeNS getAttributeNode getAttributeNodeNS +syntax keyword typescriptDOMElemFuncs contained getBoundingClientRect getClientRects +syntax keyword typescriptDOMElemFuncs contained getElementsByClassName getElementsByTagName +syntax keyword typescriptDOMElemFuncs contained getElementsByTagNameNS hasAttribute +syntax keyword typescriptDOMElemFuncs contained hasAttributeNS insertAdjacentHTML +syntax keyword typescriptDOMElemFuncs contained matches querySelector querySelectorAll +syntax keyword typescriptDOMElemFuncs contained removeAttribute removeAttributeNS +syntax keyword typescriptDOMElemFuncs contained removeAttributeNode requestFullscreen +syntax keyword typescriptDOMElemFuncs contained requestPointerLock scrollIntoView +syntax keyword typescriptDOMElemFuncs contained setAttribute setAttributeNS setAttributeNode +syntax keyword typescriptDOMElemFuncs contained setAttributeNodeNS setCapture supports +syntax keyword typescriptDOMElemFuncs contained getAttribute +if exists("did_typescript_hilink") | HiLink typescriptDOMElemFuncs Keyword +endif diff --git a/syntax/yats/dom-event.vim b/syntax/yats/dom-event.vim new file mode 100644 index 000000000..e33547fcc --- /dev/null +++ b/syntax/yats/dom-event.vim @@ -0,0 +1,67 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptDOMEventTargetMethod contained addEventListener removeEventListener nextgroup=typescriptEventFuncCallArg +syntax keyword typescriptDOMEventTargetMethod contained dispatchEvent waitUntil nextgroup=typescriptEventFuncCallArg +syntax cluster props add=typescriptDOMEventTargetMethod +if exists("did_typescript_hilink") | HiLink typescriptDOMEventTargetMethod Keyword +endif +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName AnimationEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName AudioProcessingEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BeforeInputEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BeforeUnloadEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BlobEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ClipboardEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CloseEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CompositionEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CSSFontFaceLoadEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CustomEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceLightEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceMotionEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceOrientationEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceProximityEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DOMTransactionEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DragEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName EditingBeforeInputEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ErrorEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName FocusEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName GamepadEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName HashChangeEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName IDBVersionChangeEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName KeyboardEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MediaStreamEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MessageEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MouseEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MutationEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName OfflineAudioCompletionEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PageTransitionEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PointerEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PopStateEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ProgressEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName RelatedEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName RTCPeerConnectionIceEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SensorEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName StorageEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SVGEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SVGZoomEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TimeEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TouchEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TrackEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TransitionEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName UIEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName UserProximityEvent +syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName WheelEvent +if exists("did_typescript_hilink") | HiLink typescriptDOMEventCons Structure +endif +syntax keyword typescriptDOMEventProp contained bubbles cancelable currentTarget defaultPrevented +syntax keyword typescriptDOMEventProp contained eventPhase target timeStamp type isTrusted +syntax keyword typescriptDOMEventProp contained isReload +syntax cluster props add=typescriptDOMEventProp +if exists("did_typescript_hilink") | HiLink typescriptDOMEventProp Keyword +endif +syntax keyword typescriptDOMEventMethod contained initEvent preventDefault stopImmediatePropagation nextgroup=typescriptEventFuncCallArg +syntax keyword typescriptDOMEventMethod contained stopPropagation respondWith default nextgroup=typescriptEventFuncCallArg +syntax cluster props add=typescriptDOMEventMethod +if exists("did_typescript_hilink") | HiLink typescriptDOMEventMethod Keyword +endif diff --git a/syntax/yats/dom-form.vim b/syntax/yats/dom-form.vim new file mode 100644 index 000000000..d5ca56afa --- /dev/null +++ b/syntax/yats/dom-form.vim @@ -0,0 +1,13 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptDOMFormProp contained acceptCharset action elements encoding +syntax keyword typescriptDOMFormProp contained enctype length method name target +syntax cluster props add=typescriptDOMFormProp +if exists("did_typescript_hilink") | HiLink typescriptDOMFormProp Keyword +endif +syntax keyword typescriptDOMFormMethod contained reportValidity reset submit nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptDOMFormMethod +if exists("did_typescript_hilink") | HiLink typescriptDOMFormMethod Keyword +endif diff --git a/syntax/yats/dom-node.vim b/syntax/yats/dom-node.vim new file mode 100644 index 000000000..b9f615c82 --- /dev/null +++ b/syntax/yats/dom-node.vim @@ -0,0 +1,29 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptDOMNodeProp contained attributes baseURI baseURIObject childNodes +syntax keyword typescriptDOMNodeProp contained firstChild lastChild localName namespaceURI +syntax keyword typescriptDOMNodeProp contained nextSibling nodeName nodePrincipal +syntax keyword typescriptDOMNodeProp contained nodeType nodeValue ownerDocument parentElement +syntax keyword typescriptDOMNodeProp contained parentNode prefix previousSibling textContent +syntax cluster props add=typescriptDOMNodeProp +if exists("did_typescript_hilink") | HiLink typescriptDOMNodeProp Keyword +endif +syntax keyword typescriptDOMNodeMethod contained appendChild cloneNode compareDocumentPosition nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMNodeMethod contained getUserData hasAttributes hasChildNodes nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMNodeMethod contained insertBefore isDefaultNamespace isEqualNode nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMNodeMethod contained isSameNode isSupported lookupNamespaceURI nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMNodeMethod contained lookupPrefix normalize removeChild nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMNodeMethod contained replaceChild setUserData nextgroup=typescriptFuncCallArg +syntax match typescriptDOMNodeMethod contained /contains/ +syntax cluster props add=typescriptDOMNodeMethod +if exists("did_typescript_hilink") | HiLink typescriptDOMNodeMethod Keyword +endif +syntax keyword typescriptDOMNodeType contained ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE +syntax keyword typescriptDOMNodeType contained CDATA_SECTION_NODEN_NODE ENTITY_REFERENCE_NODE +syntax keyword typescriptDOMNodeType contained ENTITY_NODE PROCESSING_INSTRUCTION_NODEN_NODE +syntax keyword typescriptDOMNodeType contained COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE +syntax keyword typescriptDOMNodeType contained DOCUMENT_FRAGMENT_NODE NOTATION_NODE +if exists("did_typescript_hilink") | HiLink typescriptDOMNodeType Keyword +endif diff --git a/syntax/yats/dom-storage.vim b/syntax/yats/dom-storage.vim new file mode 100644 index 000000000..3664d1cb3 --- /dev/null +++ b/syntax/yats/dom-storage.vim @@ -0,0 +1,16 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptDOMStorage contained sessionStorage localStorage +if exists("did_typescript_hilink") | HiLink typescriptDOMStorage Keyword +endif +syntax keyword typescriptDOMStorageProp contained length +syntax cluster props add=typescriptDOMStorageProp +if exists("did_typescript_hilink") | HiLink typescriptDOMStorageProp Keyword +endif +syntax keyword typescriptDOMStorageMethod contained getItem key setItem removeItem nextgroup=typescriptFuncCallArg +syntax keyword typescriptDOMStorageMethod contained clear nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptDOMStorageMethod +if exists("did_typescript_hilink") | HiLink typescriptDOMStorageMethod Keyword +endif diff --git a/syntax/yats/ecma-402.vim b/syntax/yats/ecma-402.vim new file mode 100644 index 000000000..ae5a806e8 --- /dev/null +++ b/syntax/yats/ecma-402.vim @@ -0,0 +1,10 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Intl +syntax keyword typescriptIntlMethod contained Collator DateTimeFormat NumberFormat nextgroup=typescriptFuncCallArg +syntax keyword typescriptIntlMethod contained PluralRules nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptIntlMethod +if exists("did_typescript_hilink") | HiLink typescriptIntlMethod Keyword +endif diff --git a/syntax/yats/es6-array.vim b/syntax/yats/es6-array.vim new file mode 100644 index 000000000..36890b13d --- /dev/null +++ b/syntax/yats/es6-array.vim @@ -0,0 +1,18 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Array nextgroup=typescriptGlobalArrayDot,typescriptFuncCallArg +syntax match typescriptGlobalArrayDot /\./ contained nextgroup=typescriptArrayStaticMethod,typescriptProp +syntax keyword typescriptArrayStaticMethod contained from isArray of nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptArrayStaticMethod Keyword +endif +syntax keyword typescriptArrayMethod contained concat copyWithin entries every fill nextgroup=typescriptFuncCallArg +syntax keyword typescriptArrayMethod contained filter find findIndex forEach indexOf nextgroup=typescriptFuncCallArg +syntax keyword typescriptArrayMethod contained includes join keys lastIndexOf map nextgroup=typescriptFuncCallArg +syntax keyword typescriptArrayMethod contained pop push reduce reduceRight reverse nextgroup=typescriptFuncCallArg +syntax keyword typescriptArrayMethod contained shift slice some sort splice toLocaleString nextgroup=typescriptFuncCallArg +syntax keyword typescriptArrayMethod contained toSource toString unshift nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptArrayMethod +if exists("did_typescript_hilink") | HiLink typescriptArrayMethod Keyword +endif diff --git a/syntax/yats/es6-date.vim b/syntax/yats/es6-date.vim new file mode 100644 index 000000000..1aa586ffe --- /dev/null +++ b/syntax/yats/es6-date.vim @@ -0,0 +1,26 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Date nextgroup=typescriptGlobalDateDot,typescriptFuncCallArg +syntax match typescriptGlobalDateDot /\./ contained nextgroup=typescriptDateStaticMethod,typescriptProp +syntax keyword typescriptDateStaticMethod contained UTC now parse nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptDateStaticMethod Keyword +endif +syntax keyword typescriptDateMethod contained getDate getDay getFullYear getHours nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained getMilliseconds getMinutes getMonth nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained getSeconds getTime getTimezoneOffset nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained getUTCDate getUTCDay getUTCFullYear nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained getUTCHours getUTCMilliseconds getUTCMinutes nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained getUTCMonth getUTCSeconds setDate setFullYear nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained setHours setMilliseconds setMinutes nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained setMonth setSeconds setTime setUTCDate nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained setUTCFullYear setUTCHours setUTCMilliseconds nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained setUTCMinutes setUTCMonth setUTCSeconds nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained toDateString toISOString toJSON toLocaleDateString nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained toLocaleFormat toLocaleString toLocaleTimeString nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained toSource toString toTimeString toUTCString nextgroup=typescriptFuncCallArg +syntax keyword typescriptDateMethod contained valueOf nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptDateMethod +if exists("did_typescript_hilink") | HiLink typescriptDateMethod Keyword +endif diff --git a/syntax/yats/es6-function.vim b/syntax/yats/es6-function.vim new file mode 100644 index 000000000..842e8cde5 --- /dev/null +++ b/syntax/yats/es6-function.vim @@ -0,0 +1,9 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function +syntax keyword typescriptFunctionMethod contained apply bind call nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptFunctionMethod +if exists("did_typescript_hilink") | HiLink typescriptFunctionMethod Keyword +endif diff --git a/syntax/yats/es6-json.vim b/syntax/yats/es6-json.vim new file mode 100644 index 000000000..40ddf2d2d --- /dev/null +++ b/syntax/yats/es6-json.vim @@ -0,0 +1,9 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName JSON nextgroup=typescriptGlobalJSONDot,typescriptFuncCallArg +syntax match typescriptGlobalJSONDot /\./ contained nextgroup=typescriptJSONStaticMethod,typescriptProp +syntax keyword typescriptJSONStaticMethod contained parse stringify nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptJSONStaticMethod Keyword +endif diff --git a/syntax/yats/es6-map.vim b/syntax/yats/es6-map.vim new file mode 100644 index 000000000..b9f2d47a6 --- /dev/null +++ b/syntax/yats/es6-map.vim @@ -0,0 +1,14 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Map WeakMap +syntax keyword typescriptES6MapProp contained size +syntax cluster props add=typescriptES6MapProp +if exists("did_typescript_hilink") | HiLink typescriptES6MapProp Keyword +endif +syntax keyword typescriptES6MapMethod contained clear delete entries forEach get has nextgroup=typescriptFuncCallArg +syntax keyword typescriptES6MapMethod contained keys set values nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptES6MapMethod +if exists("did_typescript_hilink") | HiLink typescriptES6MapMethod Keyword +endif diff --git a/syntax/yats/es6-math.vim b/syntax/yats/es6-math.vim new file mode 100644 index 000000000..20444a5a3 --- /dev/null +++ b/syntax/yats/es6-math.vim @@ -0,0 +1,18 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Math nextgroup=typescriptGlobalMathDot,typescriptFuncCallArg +syntax match typescriptGlobalMathDot /\./ contained nextgroup=typescriptMathStaticProp,typescriptMathStaticMethod,typescriptProp +syntax keyword typescriptMathStaticProp contained E LN10 LN2 LOG10E LOG2E PI SQRT1_2 +syntax keyword typescriptMathStaticProp contained SQRT2 +if exists("did_typescript_hilink") | HiLink typescriptMathStaticProp Keyword +endif +syntax keyword typescriptMathStaticMethod contained abs acos acosh asin asinh atan nextgroup=typescriptFuncCallArg +syntax keyword typescriptMathStaticMethod contained atan2 atanh cbrt ceil clz32 cos nextgroup=typescriptFuncCallArg +syntax keyword typescriptMathStaticMethod contained cosh exp expm1 floor fround hypot nextgroup=typescriptFuncCallArg +syntax keyword typescriptMathStaticMethod contained imul log log10 log1p log2 max nextgroup=typescriptFuncCallArg +syntax keyword typescriptMathStaticMethod contained min pow random round sign sin nextgroup=typescriptFuncCallArg +syntax keyword typescriptMathStaticMethod contained sinh sqrt tan tanh trunc nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptMathStaticMethod Keyword +endif diff --git a/syntax/yats/es6-number.vim b/syntax/yats/es6-number.vim new file mode 100644 index 000000000..21c94cb80 --- /dev/null +++ b/syntax/yats/es6-number.vim @@ -0,0 +1,20 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Number nextgroup=typescriptGlobalNumberDot,typescriptFuncCallArg +syntax match typescriptGlobalNumberDot /\./ contained nextgroup=typescriptNumberStaticProp,typescriptNumberStaticMethod,typescriptProp +syntax keyword typescriptNumberStaticProp contained EPSILON MAX_SAFE_INTEGER MAX_VALUE +syntax keyword typescriptNumberStaticProp contained MIN_SAFE_INTEGER MIN_VALUE NEGATIVE_INFINITY +syntax keyword typescriptNumberStaticProp contained NaN POSITIVE_INFINITY +if exists("did_typescript_hilink") | HiLink typescriptNumberStaticProp Keyword +endif +syntax keyword typescriptNumberStaticMethod contained isFinite isInteger isNaN isSafeInteger nextgroup=typescriptFuncCallArg +syntax keyword typescriptNumberStaticMethod contained parseFloat parseInt nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptNumberStaticMethod Keyword +endif +syntax keyword typescriptNumberMethod contained toExponential toFixed toLocaleString nextgroup=typescriptFuncCallArg +syntax keyword typescriptNumberMethod contained toPrecision toSource toString valueOf nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptNumberMethod +if exists("did_typescript_hilink") | HiLink typescriptNumberMethod Keyword +endif diff --git a/syntax/yats/es6-object.vim b/syntax/yats/es6-object.vim new file mode 100644 index 000000000..84d639d8c --- /dev/null +++ b/syntax/yats/es6-object.vim @@ -0,0 +1,21 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Object nextgroup=typescriptGlobalObjectDot,typescriptFuncCallArg +syntax match typescriptGlobalObjectDot /\./ contained nextgroup=typescriptObjectStaticMethod,typescriptProp +syntax keyword typescriptObjectStaticMethod contained create defineProperties defineProperty nextgroup=typescriptFuncCallArg +syntax keyword typescriptObjectStaticMethod contained entries freeze getOwnPropertyDescriptors nextgroup=typescriptFuncCallArg +syntax keyword typescriptObjectStaticMethod contained getOwnPropertyDescriptor getOwnPropertyNames nextgroup=typescriptFuncCallArg +syntax keyword typescriptObjectStaticMethod contained getOwnPropertySymbols getPrototypeOf nextgroup=typescriptFuncCallArg +syntax keyword typescriptObjectStaticMethod contained is isExtensible isFrozen isSealed nextgroup=typescriptFuncCallArg +syntax keyword typescriptObjectStaticMethod contained keys preventExtensions values nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptObjectStaticMethod Keyword +endif +syntax keyword typescriptObjectMethod contained getOwnPropertyDescriptors hasOwnProperty nextgroup=typescriptFuncCallArg +syntax keyword typescriptObjectMethod contained isPrototypeOf propertyIsEnumerable nextgroup=typescriptFuncCallArg +syntax keyword typescriptObjectMethod contained toLocaleString toString valueOf seal nextgroup=typescriptFuncCallArg +syntax keyword typescriptObjectMethod contained setPrototypeOf nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptObjectMethod +if exists("did_typescript_hilink") | HiLink typescriptObjectMethod Keyword +endif diff --git a/syntax/yats/es6-promise.vim b/syntax/yats/es6-promise.vim new file mode 100644 index 000000000..619b538b3 --- /dev/null +++ b/syntax/yats/es6-promise.vim @@ -0,0 +1,13 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Promise nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg +syntax match typescriptGlobalPromiseDot /\./ contained nextgroup=typescriptPromiseStaticMethod,typescriptProp +syntax keyword typescriptPromiseStaticMethod contained resolve reject all race nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptPromiseStaticMethod Keyword +endif +syntax keyword typescriptPromiseMethod contained then catch finally nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptPromiseMethod +if exists("did_typescript_hilink") | HiLink typescriptPromiseMethod Keyword +endif diff --git a/syntax/yats/es6-proxy.vim b/syntax/yats/es6-proxy.vim new file mode 100644 index 000000000..e82556823 --- /dev/null +++ b/syntax/yats/es6-proxy.vim @@ -0,0 +1,11 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Proxy +syntax keyword typescriptProxyAPI contained getOwnPropertyDescriptor getOwnPropertyNames +syntax keyword typescriptProxyAPI contained defineProperty deleteProperty freeze seal +syntax keyword typescriptProxyAPI contained preventExtensions has hasOwn get set enumerate +syntax keyword typescriptProxyAPI contained iterate ownKeys apply construct +if exists("did_typescript_hilink") | HiLink typescriptProxyAPI Keyword +endif diff --git a/syntax/yats/es6-reflect.vim b/syntax/yats/es6-reflect.vim new file mode 100644 index 000000000..d417e8958 --- /dev/null +++ b/syntax/yats/es6-reflect.vim @@ -0,0 +1,12 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Reflect +syntax keyword typescriptReflectMethod contained apply construct defineProperty deleteProperty nextgroup=typescriptFuncCallArg +syntax keyword typescriptReflectMethod contained enumerate get getOwnPropertyDescriptor nextgroup=typescriptFuncCallArg +syntax keyword typescriptReflectMethod contained getPrototypeOf has isExtensible ownKeys nextgroup=typescriptFuncCallArg +syntax keyword typescriptReflectMethod contained preventExtensions set setPrototypeOf nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptReflectMethod +if exists("did_typescript_hilink") | HiLink typescriptReflectMethod Keyword +endif diff --git a/syntax/yats/es6-regexp.vim b/syntax/yats/es6-regexp.vim new file mode 100644 index 000000000..aa2e960e6 --- /dev/null +++ b/syntax/yats/es6-regexp.vim @@ -0,0 +1,17 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName RegExp nextgroup=typescriptGlobalRegExpDot,typescriptFuncCallArg +syntax match typescriptGlobalRegExpDot /\./ contained nextgroup=typescriptRegExpStaticProp,typescriptProp +syntax keyword typescriptRegExpStaticProp contained lastIndex +if exists("did_typescript_hilink") | HiLink typescriptRegExpStaticProp Keyword +endif +syntax keyword typescriptRegExpProp contained global ignoreCase multiline source sticky +syntax cluster props add=typescriptRegExpProp +if exists("did_typescript_hilink") | HiLink typescriptRegExpProp Keyword +endif +syntax keyword typescriptRegExpMethod contained exec test nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptRegExpMethod +if exists("did_typescript_hilink") | HiLink typescriptRegExpMethod Keyword +endif diff --git a/syntax/yats/es6-set.vim b/syntax/yats/es6-set.vim new file mode 100644 index 000000000..f77695f50 --- /dev/null +++ b/syntax/yats/es6-set.vim @@ -0,0 +1,14 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Set WeakSet +syntax keyword typescriptES6SetProp contained size +syntax cluster props add=typescriptES6SetProp +if exists("did_typescript_hilink") | HiLink typescriptES6SetProp Keyword +endif +syntax keyword typescriptES6SetMethod contained add clear delete entries forEach has nextgroup=typescriptFuncCallArg +syntax keyword typescriptES6SetMethod contained values nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptES6SetMethod +if exists("did_typescript_hilink") | HiLink typescriptES6SetMethod Keyword +endif diff --git a/syntax/yats/es6-string.vim b/syntax/yats/es6-string.vim new file mode 100644 index 000000000..99749bfde --- /dev/null +++ b/syntax/yats/es6-string.vim @@ -0,0 +1,20 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName String nextgroup=typescriptGlobalStringDot,typescriptFuncCallArg +syntax match typescriptGlobalStringDot /\./ contained nextgroup=typescriptStringStaticMethod,typescriptProp +syntax keyword typescriptStringStaticMethod contained fromCharCode fromCodePoint raw nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptStringStaticMethod Keyword +endif +syntax keyword typescriptStringMethod contained anchor charAt charCodeAt codePointAt nextgroup=typescriptFuncCallArg +syntax keyword typescriptStringMethod contained concat endsWith includes indexOf lastIndexOf nextgroup=typescriptFuncCallArg +syntax keyword typescriptStringMethod contained link localeCompare match normalize nextgroup=typescriptFuncCallArg +syntax keyword typescriptStringMethod contained padStart padEnd repeat replace search nextgroup=typescriptFuncCallArg +syntax keyword typescriptStringMethod contained slice split startsWith substr substring nextgroup=typescriptFuncCallArg +syntax keyword typescriptStringMethod contained toLocaleLowerCase toLocaleUpperCase nextgroup=typescriptFuncCallArg +syntax keyword typescriptStringMethod contained toLowerCase toString toUpperCase trim nextgroup=typescriptFuncCallArg +syntax keyword typescriptStringMethod contained valueOf nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptStringMethod +if exists("did_typescript_hilink") | HiLink typescriptStringMethod Keyword +endif diff --git a/syntax/yats/es6-symbol.vim b/syntax/yats/es6-symbol.vim new file mode 100644 index 000000000..97fd60fd2 --- /dev/null +++ b/syntax/yats/es6-symbol.vim @@ -0,0 +1,15 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Symbol nextgroup=typescriptGlobalSymbolDot,typescriptFuncCallArg +syntax match typescriptGlobalSymbolDot /\./ contained nextgroup=typescriptSymbolStaticProp,typescriptSymbolStaticMethod,typescriptProp +syntax keyword typescriptSymbolStaticProp contained length iterator match replace +syntax keyword typescriptSymbolStaticProp contained search split hasInstance isConcatSpreadable +syntax keyword typescriptSymbolStaticProp contained unscopables species toPrimitive +syntax keyword typescriptSymbolStaticProp contained toStringTag +if exists("did_typescript_hilink") | HiLink typescriptSymbolStaticProp Keyword +endif +syntax keyword typescriptSymbolStaticMethod contained for keyFor nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptSymbolStaticMethod Keyword +endif diff --git a/syntax/yats/event.vim b/syntax/yats/event.vim new file mode 100644 index 000000000..f86b4b18b --- /dev/null +++ b/syntax/yats/event.vim @@ -0,0 +1,163 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptAnimationEvent contained animationend animationiteration +syntax keyword typescriptAnimationEvent contained animationstart beginEvent endEvent +syntax keyword typescriptAnimationEvent contained repeatEvent +syntax cluster events add=typescriptAnimationEvent +if exists("did_typescript_hilink") | HiLink typescriptAnimationEvent Title +endif +syntax keyword typescriptCSSEvent contained CssRuleViewRefreshed CssRuleViewChanged +syntax keyword typescriptCSSEvent contained CssRuleViewCSSLinkClicked transitionend +syntax cluster events add=typescriptCSSEvent +if exists("did_typescript_hilink") | HiLink typescriptCSSEvent Title +endif +syntax keyword typescriptDatabaseEvent contained blocked complete error success upgradeneeded +syntax keyword typescriptDatabaseEvent contained versionchange +syntax cluster events add=typescriptDatabaseEvent +if exists("did_typescript_hilink") | HiLink typescriptDatabaseEvent Title +endif +syntax keyword typescriptDocumentEvent contained DOMLinkAdded DOMLinkRemoved DOMMetaAdded +syntax keyword typescriptDocumentEvent contained DOMMetaRemoved DOMWillOpenModalDialog +syntax keyword typescriptDocumentEvent contained DOMModalDialogClosed unload +syntax cluster events add=typescriptDocumentEvent +if exists("did_typescript_hilink") | HiLink typescriptDocumentEvent Title +endif +syntax keyword typescriptDOMMutationEvent contained DOMAttributeNameChanged DOMAttrModified +syntax keyword typescriptDOMMutationEvent contained DOMCharacterDataModified DOMContentLoaded +syntax keyword typescriptDOMMutationEvent contained DOMElementNameChanged DOMNodeInserted +syntax keyword typescriptDOMMutationEvent contained DOMNodeInsertedIntoDocument DOMNodeRemoved +syntax keyword typescriptDOMMutationEvent contained DOMNodeRemovedFromDocument DOMSubtreeModified +syntax cluster events add=typescriptDOMMutationEvent +if exists("did_typescript_hilink") | HiLink typescriptDOMMutationEvent Title +endif +syntax keyword typescriptDragEvent contained drag dragdrop dragend dragenter dragexit +syntax keyword typescriptDragEvent contained draggesture dragleave dragover dragstart +syntax keyword typescriptDragEvent contained drop +syntax cluster events add=typescriptDragEvent +if exists("did_typescript_hilink") | HiLink typescriptDragEvent Title +endif +syntax keyword typescriptElementEvent contained invalid overflow underflow DOMAutoComplete +syntax keyword typescriptElementEvent contained command commandupdate +syntax cluster events add=typescriptElementEvent +if exists("did_typescript_hilink") | HiLink typescriptElementEvent Title +endif +syntax keyword typescriptFocusEvent contained blur change DOMFocusIn DOMFocusOut focus +syntax keyword typescriptFocusEvent contained focusin focusout +syntax cluster events add=typescriptFocusEvent +if exists("did_typescript_hilink") | HiLink typescriptFocusEvent Title +endif +syntax keyword typescriptFormEvent contained reset submit +syntax cluster events add=typescriptFormEvent +if exists("did_typescript_hilink") | HiLink typescriptFormEvent Title +endif +syntax keyword typescriptFrameEvent contained DOMFrameContentLoaded +syntax cluster events add=typescriptFrameEvent +if exists("did_typescript_hilink") | HiLink typescriptFrameEvent Title +endif +syntax keyword typescriptInputDeviceEvent contained click contextmenu DOMMouseScroll +syntax keyword typescriptInputDeviceEvent contained dblclick gamepadconnected gamepaddisconnected +syntax keyword typescriptInputDeviceEvent contained keydown keypress keyup MozGamepadButtonDown +syntax keyword typescriptInputDeviceEvent contained MozGamepadButtonUp mousedown mouseenter +syntax keyword typescriptInputDeviceEvent contained mouseleave mousemove mouseout +syntax keyword typescriptInputDeviceEvent contained mouseover mouseup mousewheel MozMousePixelScroll +syntax keyword typescriptInputDeviceEvent contained pointerlockchange pointerlockerror +syntax keyword typescriptInputDeviceEvent contained wheel +syntax cluster events add=typescriptInputDeviceEvent +if exists("did_typescript_hilink") | HiLink typescriptInputDeviceEvent Title +endif +syntax keyword typescriptMediaEvent contained audioprocess canplay canplaythrough +syntax keyword typescriptMediaEvent contained durationchange emptied ended ended loadeddata +syntax keyword typescriptMediaEvent contained loadedmetadata MozAudioAvailable pause +syntax keyword typescriptMediaEvent contained play playing ratechange seeked seeking +syntax keyword typescriptMediaEvent contained stalled suspend timeupdate volumechange +syntax keyword typescriptMediaEvent contained waiting complete +syntax cluster events add=typescriptMediaEvent +if exists("did_typescript_hilink") | HiLink typescriptMediaEvent Title +endif +syntax keyword typescriptMenuEvent contained DOMMenuItemActive DOMMenuItemInactive +syntax cluster events add=typescriptMenuEvent +if exists("did_typescript_hilink") | HiLink typescriptMenuEvent Title +endif +syntax keyword typescriptNetworkEvent contained datachange dataerror disabled enabled +syntax keyword typescriptNetworkEvent contained offline online statuschange connectionInfoUpdate +syntax cluster events add=typescriptNetworkEvent +if exists("did_typescript_hilink") | HiLink typescriptNetworkEvent Title +endif +syntax keyword typescriptProgressEvent contained abort error load loadend loadstart +syntax keyword typescriptProgressEvent contained progress timeout uploadprogress +syntax cluster events add=typescriptProgressEvent +if exists("did_typescript_hilink") | HiLink typescriptProgressEvent Title +endif +syntax keyword typescriptResourceEvent contained cached error load +syntax cluster events add=typescriptResourceEvent +if exists("did_typescript_hilink") | HiLink typescriptResourceEvent Title +endif +syntax keyword typescriptScriptEvent contained afterscriptexecute beforescriptexecute +syntax cluster events add=typescriptScriptEvent +if exists("did_typescript_hilink") | HiLink typescriptScriptEvent Title +endif +syntax keyword typescriptSensorEvent contained compassneedscalibration devicelight +syntax keyword typescriptSensorEvent contained devicemotion deviceorientation deviceproximity +syntax keyword typescriptSensorEvent contained orientationchange userproximity +syntax cluster events add=typescriptSensorEvent +if exists("did_typescript_hilink") | HiLink typescriptSensorEvent Title +endif +syntax keyword typescriptSessionHistoryEvent contained pagehide pageshow popstate +syntax cluster events add=typescriptSessionHistoryEvent +if exists("did_typescript_hilink") | HiLink typescriptSessionHistoryEvent Title +endif +syntax keyword typescriptStorageEvent contained change storage +syntax cluster events add=typescriptStorageEvent +if exists("did_typescript_hilink") | HiLink typescriptStorageEvent Title +endif +syntax keyword typescriptSVGEvent contained SVGAbort SVGError SVGLoad SVGResize SVGScroll +syntax keyword typescriptSVGEvent contained SVGUnload SVGZoom +syntax cluster events add=typescriptSVGEvent +if exists("did_typescript_hilink") | HiLink typescriptSVGEvent Title +endif +syntax keyword typescriptTabEvent contained visibilitychange +syntax cluster events add=typescriptTabEvent +if exists("did_typescript_hilink") | HiLink typescriptTabEvent Title +endif +syntax keyword typescriptTextEvent contained compositionend compositionstart compositionupdate +syntax keyword typescriptTextEvent contained copy cut paste select text +syntax cluster events add=typescriptTextEvent +if exists("did_typescript_hilink") | HiLink typescriptTextEvent Title +endif +syntax keyword typescriptTouchEvent contained touchcancel touchend touchenter touchleave +syntax keyword typescriptTouchEvent contained touchmove touchstart +syntax cluster events add=typescriptTouchEvent +if exists("did_typescript_hilink") | HiLink typescriptTouchEvent Title +endif +syntax keyword typescriptUpdateEvent contained checking downloading error noupdate +syntax keyword typescriptUpdateEvent contained obsolete updateready +syntax cluster events add=typescriptUpdateEvent +if exists("did_typescript_hilink") | HiLink typescriptUpdateEvent Title +endif +syntax keyword typescriptValueChangeEvent contained hashchange input readystatechange +syntax cluster events add=typescriptValueChangeEvent +if exists("did_typescript_hilink") | HiLink typescriptValueChangeEvent Title +endif +syntax keyword typescriptViewEvent contained fullscreen fullscreenchange fullscreenerror +syntax keyword typescriptViewEvent contained resize scroll +syntax cluster events add=typescriptViewEvent +if exists("did_typescript_hilink") | HiLink typescriptViewEvent Title +endif +syntax keyword typescriptWebsocketEvent contained close error message open +syntax cluster events add=typescriptWebsocketEvent +if exists("did_typescript_hilink") | HiLink typescriptWebsocketEvent Title +endif +syntax keyword typescriptWindowEvent contained DOMWindowCreated DOMWindowClose DOMTitleChanged +syntax cluster events add=typescriptWindowEvent +if exists("did_typescript_hilink") | HiLink typescriptWindowEvent Title +endif +syntax keyword typescriptUncategorizedEvent contained beforeunload message open show +syntax cluster events add=typescriptUncategorizedEvent +if exists("did_typescript_hilink") | HiLink typescriptUncategorizedEvent Title +endif +syntax keyword typescriptServiceWorkerEvent contained install activate fetch +syntax cluster events add=typescriptServiceWorkerEvent +if exists("did_typescript_hilink") | HiLink typescriptServiceWorkerEvent Title +endif diff --git a/syntax/yats/node.vim b/syntax/yats/node.vim new file mode 100644 index 000000000..312c5fb8e --- /dev/null +++ b/syntax/yats/node.vim @@ -0,0 +1,13 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName global process +syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName console Buffer +syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName module exports +syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName setTimeout +syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearTimeout +syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName setInterval +syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearInterval +if exists("did_typescript_hilink") | HiLink typescriptNodeGlobal Structure +endif diff --git a/syntax/yats/test.vim b/syntax/yats/test.vim new file mode 100644 index 000000000..9354645a1 --- /dev/null +++ b/syntax/yats/test.vim @@ -0,0 +1,11 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName describe +syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName it test before +syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName after beforeEach +syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName afterEach +syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName beforeAll +syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName afterAll +syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName expect assert diff --git a/syntax/yats/typescript.vim b/syntax/yats/typescript.vim new file mode 100644 index 000000000..3177a1a07 --- /dev/null +++ b/syntax/yats/typescript.vim @@ -0,0 +1,35 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function Boolean +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Error EvalError +syntax keyword typescriptGlobal containedin=typescriptIdentifierName InternalError +syntax keyword typescriptGlobal containedin=typescriptIdentifierName RangeError ReferenceError +syntax keyword typescriptGlobal containedin=typescriptIdentifierName StopIteration +syntax keyword typescriptGlobal containedin=typescriptIdentifierName SyntaxError TypeError +syntax keyword typescriptGlobal containedin=typescriptIdentifierName URIError Date +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float32Array +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float64Array +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int16Array Int32Array +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int8Array Uint16Array +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint32Array Uint8Array +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint8ClampedArray +syntax keyword typescriptGlobal containedin=typescriptIdentifierName ParallelArray +syntax keyword typescriptGlobal containedin=typescriptIdentifierName ArrayBuffer DataView +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Iterator Generator +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Reflect Proxy +syntax keyword typescriptGlobal containedin=typescriptIdentifierName arguments +if exists("did_typescript_hilink") | HiLink typescriptGlobal Structure +endif +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName eval uneval nextgroup=typescriptFuncCallArg +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName isFinite nextgroup=typescriptFuncCallArg +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName isNaN parseFloat nextgroup=typescriptFuncCallArg +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName parseInt nextgroup=typescriptFuncCallArg +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName decodeURI nextgroup=typescriptFuncCallArg +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName decodeURIComponent nextgroup=typescriptFuncCallArg +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName encodeURI nextgroup=typescriptFuncCallArg +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName encodeURIComponent nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptGlobalMethod +if exists("did_typescript_hilink") | HiLink typescriptGlobalMethod Structure +endif diff --git a/syntax/yats/web-blob.vim b/syntax/yats/web-blob.vim new file mode 100644 index 000000000..9b920a05d --- /dev/null +++ b/syntax/yats/web-blob.vim @@ -0,0 +1,41 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Blob BlobBuilder +syntax keyword typescriptGlobal containedin=typescriptIdentifierName File FileReader +syntax keyword typescriptGlobal containedin=typescriptIdentifierName FileReaderSync +syntax keyword typescriptGlobal containedin=typescriptIdentifierName URL nextgroup=typescriptGlobalURLDot,typescriptFuncCallArg +syntax match typescriptGlobalURLDot /\./ contained nextgroup=typescriptURLStaticMethod,typescriptProp +syntax keyword typescriptGlobal containedin=typescriptIdentifierName URLUtils +syntax keyword typescriptFileMethod contained readAsArrayBuffer readAsBinaryString nextgroup=typescriptFuncCallArg +syntax keyword typescriptFileMethod contained readAsDataURL readAsText nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptFileMethod +if exists("did_typescript_hilink") | HiLink typescriptFileMethod Keyword +endif +syntax keyword typescriptFileReaderProp contained error readyState result +syntax cluster props add=typescriptFileReaderProp +if exists("did_typescript_hilink") | HiLink typescriptFileReaderProp Keyword +endif +syntax keyword typescriptFileReaderMethod contained abort readAsArrayBuffer readAsBinaryString nextgroup=typescriptFuncCallArg +syntax keyword typescriptFileReaderMethod contained readAsDataURL readAsText nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptFileReaderMethod +if exists("did_typescript_hilink") | HiLink typescriptFileReaderMethod Keyword +endif +syntax keyword typescriptFileListMethod contained item nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptFileListMethod +if exists("did_typescript_hilink") | HiLink typescriptFileListMethod Keyword +endif +syntax keyword typescriptBlobMethod contained append getBlob getFile nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptBlobMethod +if exists("did_typescript_hilink") | HiLink typescriptBlobMethod Keyword +endif +syntax keyword typescriptURLUtilsProp contained hash host hostname href origin password +syntax keyword typescriptURLUtilsProp contained pathname port protocol search searchParams +syntax keyword typescriptURLUtilsProp contained username +syntax cluster props add=typescriptURLUtilsProp +if exists("did_typescript_hilink") | HiLink typescriptURLUtilsProp Keyword +endif +syntax keyword typescriptURLStaticMethod contained createObjectURL revokeObjectURL nextgroup=typescriptFuncCallArg +if exists("did_typescript_hilink") | HiLink typescriptURLStaticMethod Keyword +endif diff --git a/syntax/yats/web-console.vim b/syntax/yats/web-console.vim new file mode 100644 index 000000000..5b4375c8c --- /dev/null +++ b/syntax/yats/web-console.vim @@ -0,0 +1,11 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName console +syntax keyword typescriptConsoleMethod contained count dir error group groupCollapsed nextgroup=typescriptFuncCallArg +syntax keyword typescriptConsoleMethod contained groupEnd info log time timeEnd trace nextgroup=typescriptFuncCallArg +syntax keyword typescriptConsoleMethod contained warn nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptConsoleMethod +if exists("did_typescript_hilink") | HiLink typescriptConsoleMethod Keyword +endif diff --git a/syntax/yats/web-crypto.vim b/syntax/yats/web-crypto.vim new file mode 100644 index 000000000..b410ba566 --- /dev/null +++ b/syntax/yats/web-crypto.vim @@ -0,0 +1,20 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptCryptoGlobal containedin=typescriptIdentifierName crypto +if exists("did_typescript_hilink") | HiLink typescriptCryptoGlobal Structure +endif +syntax keyword typescriptSubtleCryptoMethod contained encrypt decrypt sign verify nextgroup=typescriptFuncCallArg +syntax keyword typescriptSubtleCryptoMethod contained digest nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptSubtleCryptoMethod +if exists("did_typescript_hilink") | HiLink typescriptSubtleCryptoMethod Keyword +endif +syntax keyword typescriptCryptoProp contained subtle +syntax cluster props add=typescriptCryptoProp +if exists("did_typescript_hilink") | HiLink typescriptCryptoProp Keyword +endif +syntax keyword typescriptCryptoMethod contained getRandomValues nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptCryptoMethod +if exists("did_typescript_hilink") | HiLink typescriptCryptoMethod Keyword +endif diff --git a/syntax/yats/web-encoding.vim b/syntax/yats/web-encoding.vim new file mode 100644 index 000000000..f4d8d3102 --- /dev/null +++ b/syntax/yats/web-encoding.vim @@ -0,0 +1,16 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextEncoder +syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextDecoder +if exists("did_typescript_hilink") | HiLink typescriptEncodingGlobal Structure +endif +syntax keyword typescriptEncodingProp contained encoding fatal ignoreBOM +syntax cluster props add=typescriptEncodingProp +if exists("did_typescript_hilink") | HiLink typescriptEncodingProp Keyword +endif +syntax keyword typescriptEncodingMethod contained encode decode nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptEncodingMethod +if exists("did_typescript_hilink") | HiLink typescriptEncodingMethod Keyword +endif diff --git a/syntax/yats/web-fetch.vim b/syntax/yats/web-fetch.vim new file mode 100644 index 000000000..2330b2722 --- /dev/null +++ b/syntax/yats/web-fetch.vim @@ -0,0 +1,32 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Headers Request +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Response +syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName fetch nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptGlobalMethod +if exists("did_typescript_hilink") | HiLink typescriptGlobalMethod Structure +endif +syntax keyword typescriptHeadersMethod contained append delete get getAll has set nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptHeadersMethod +if exists("did_typescript_hilink") | HiLink typescriptHeadersMethod Keyword +endif +syntax keyword typescriptRequestProp contained method url headers context referrer +syntax keyword typescriptRequestProp contained mode credentials cache +syntax cluster props add=typescriptRequestProp +if exists("did_typescript_hilink") | HiLink typescriptRequestProp Keyword +endif +syntax keyword typescriptRequestMethod contained clone nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptRequestMethod +if exists("did_typescript_hilink") | HiLink typescriptRequestMethod Keyword +endif +syntax keyword typescriptResponseProp contained type url status statusText headers +syntax keyword typescriptResponseProp contained redirected +syntax cluster props add=typescriptResponseProp +if exists("did_typescript_hilink") | HiLink typescriptResponseProp Keyword +endif +syntax keyword typescriptResponseMethod contained clone nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptResponseMethod +if exists("did_typescript_hilink") | HiLink typescriptResponseMethod Keyword +endif diff --git a/syntax/yats/web-geo.vim b/syntax/yats/web-geo.vim new file mode 100644 index 000000000..6dd53a54b --- /dev/null +++ b/syntax/yats/web-geo.vim @@ -0,0 +1,10 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Geolocation +syntax keyword typescriptGeolocationMethod contained getCurrentPosition watchPosition nextgroup=typescriptFuncCallArg +syntax keyword typescriptGeolocationMethod contained clearWatch nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptGeolocationMethod +if exists("did_typescript_hilink") | HiLink typescriptGeolocationMethod Keyword +endif diff --git a/syntax/yats/web-history.vim b/syntax/yats/web-history.vim new file mode 100644 index 000000000..809930673 --- /dev/null +++ b/syntax/yats/web-history.vim @@ -0,0 +1,13 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptBOMHistoryProp contained length current next previous state +syntax keyword typescriptBOMHistoryProp contained scrollRestoration +syntax cluster props add=typescriptBOMHistoryProp +if exists("did_typescript_hilink") | HiLink typescriptBOMHistoryProp Keyword +endif +syntax keyword typescriptBOMHistoryMethod contained back forward go pushState replaceState nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptBOMHistoryMethod +if exists("did_typescript_hilink") | HiLink typescriptBOMHistoryMethod Keyword +endif diff --git a/syntax/yats/web-location.vim b/syntax/yats/web-location.vim new file mode 100644 index 000000000..3cd08f7f5 --- /dev/null +++ b/syntax/yats/web-location.vim @@ -0,0 +1,14 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptBOMLocationProp contained href protocol host hostname port +syntax keyword typescriptBOMLocationProp contained pathname search hash username password +syntax keyword typescriptBOMLocationProp contained origin +syntax cluster props add=typescriptBOMLocationProp +if exists("did_typescript_hilink") | HiLink typescriptBOMLocationProp Keyword +endif +syntax keyword typescriptBOMLocationMethod contained assign reload replace toString nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptBOMLocationMethod +if exists("did_typescript_hilink") | HiLink typescriptBOMLocationMethod Keyword +endif diff --git a/syntax/yats/web-navigator.vim b/syntax/yats/web-navigator.vim new file mode 100644 index 000000000..cb826d825 --- /dev/null +++ b/syntax/yats/web-navigator.vim @@ -0,0 +1,24 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptBOMNavigatorProp contained battery buildID connection cookieEnabled +syntax keyword typescriptBOMNavigatorProp contained doNotTrack maxTouchPoints oscpu +syntax keyword typescriptBOMNavigatorProp contained productSub push serviceWorker +syntax keyword typescriptBOMNavigatorProp contained vendor vendorSub +syntax cluster props add=typescriptBOMNavigatorProp +if exists("did_typescript_hilink") | HiLink typescriptBOMNavigatorProp Keyword +endif +syntax keyword typescriptBOMNavigatorMethod contained addIdleObserver geolocation nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMNavigatorMethod contained getDeviceStorage getDeviceStorages nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMNavigatorMethod contained getGamepads getUserMedia registerContentHandler nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMNavigatorMethod contained removeIdleObserver requestWakeLock nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMNavigatorMethod contained share vibrate watch registerProtocolHandler nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMNavigatorMethod contained sendBeacon nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptBOMNavigatorMethod +if exists("did_typescript_hilink") | HiLink typescriptBOMNavigatorMethod Keyword +endif +syntax keyword typescriptServiceWorkerMethod contained register nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptServiceWorkerMethod +if exists("did_typescript_hilink") | HiLink typescriptServiceWorkerMethod Keyword +endif diff --git a/syntax/yats/web-network.vim b/syntax/yats/web-network.vim new file mode 100644 index 000000000..497e10d20 --- /dev/null +++ b/syntax/yats/web-network.vim @@ -0,0 +1,10 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName NetworkInformation +syntax keyword typescriptBOMNetworkProp contained downlink downlinkMax effectiveType +syntax keyword typescriptBOMNetworkProp contained rtt type +syntax cluster props add=typescriptBOMNetworkProp +if exists("did_typescript_hilink") | HiLink typescriptBOMNetworkProp Keyword +endif diff --git a/syntax/yats/web-payment.vim b/syntax/yats/web-payment.vim new file mode 100644 index 000000000..fc0e4557b --- /dev/null +++ b/syntax/yats/web-payment.vim @@ -0,0 +1,37 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptGlobal containedin=typescriptIdentifierName PaymentRequest +syntax keyword typescriptPaymentMethod contained show abort canMakePayment nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptPaymentMethod +if exists("did_typescript_hilink") | HiLink typescriptPaymentMethod Keyword +endif +syntax keyword typescriptPaymentProp contained shippingAddress shippingOption result +syntax cluster props add=typescriptPaymentProp +if exists("did_typescript_hilink") | HiLink typescriptPaymentProp Keyword +endif +syntax keyword typescriptPaymentEvent contained onshippingaddresschange onshippingoptionchange +if exists("did_typescript_hilink") | HiLink typescriptPaymentEvent Keyword +endif +syntax keyword typescriptPaymentResponseMethod contained complete nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptPaymentResponseMethod +if exists("did_typescript_hilink") | HiLink typescriptPaymentResponseMethod Keyword +endif +syntax keyword typescriptPaymentResponseProp contained details methodName payerEmail +syntax keyword typescriptPaymentResponseProp contained payerPhone shippingAddress +syntax keyword typescriptPaymentResponseProp contained shippingOption +syntax cluster props add=typescriptPaymentResponseProp +if exists("did_typescript_hilink") | HiLink typescriptPaymentResponseProp Keyword +endif +syntax keyword typescriptPaymentAddressProp contained addressLine careOf city country +syntax keyword typescriptPaymentAddressProp contained country dependentLocality languageCode +syntax keyword typescriptPaymentAddressProp contained organization phone postalCode +syntax keyword typescriptPaymentAddressProp contained recipient region sortingCode +syntax cluster props add=typescriptPaymentAddressProp +if exists("did_typescript_hilink") | HiLink typescriptPaymentAddressProp Keyword +endif +syntax keyword typescriptPaymentShippingOptionProp contained id label amount selected +syntax cluster props add=typescriptPaymentShippingOptionProp +if exists("did_typescript_hilink") | HiLink typescriptPaymentShippingOptionProp Keyword +endif diff --git a/syntax/yats/web-service-worker.vim b/syntax/yats/web-service-worker.vim new file mode 100644 index 000000000..0c9cd5431 --- /dev/null +++ b/syntax/yats/web-service-worker.vim @@ -0,0 +1,18 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptServiceWorkerProp contained controller ready +syntax cluster props add=typescriptServiceWorkerProp +if exists("did_typescript_hilink") | HiLink typescriptServiceWorkerProp Keyword +endif +syntax keyword typescriptServiceWorkerMethod contained register getRegistration nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptServiceWorkerMethod +if exists("did_typescript_hilink") | HiLink typescriptServiceWorkerMethod Keyword +endif +syntax keyword typescriptGlobal containedin=typescriptIdentifierName Cache +syntax keyword typescriptCacheMethod contained match matchAll add addAll put delete nextgroup=typescriptFuncCallArg +syntax keyword typescriptCacheMethod contained keys nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptCacheMethod +if exists("did_typescript_hilink") | HiLink typescriptCacheMethod Keyword +endif diff --git a/syntax/yats/web-window.vim b/syntax/yats/web-window.vim new file mode 100644 index 000000000..2633ba97a --- /dev/null +++ b/syntax/yats/web-window.vim @@ -0,0 +1,113 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName applicationCache +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName closed +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName Components +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName controllers +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName dialogArguments +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName document +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName frameElement +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName frames +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName fullScreen +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName history +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName innerHeight +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName innerWidth +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName length +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName location +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName locationbar +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName menubar +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName messageManager +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName name navigator +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName opener +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName outerHeight +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName outerWidth +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName pageXOffset +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName pageYOffset +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName parent +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName performance +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName personalbar +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName returnValue +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screen +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screenX +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screenY +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollbars +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollMaxX +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollMaxY +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollX +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollY +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName self sidebar +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName status +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName statusbar +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName toolbar +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName top visualViewport +syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName window +syntax cluster props add=typescriptBOMWindowProp +if exists("did_typescript_hilink") | HiLink typescriptBOMWindowProp Structure +endif +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName alert nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName atob nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName blur nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName btoa nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearImmediate nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearInterval nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearTimeout nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName close nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName confirm nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName dispatchEvent nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName find nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName focus nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getAttention nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getAttentionWithCycleCount nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getComputedStyle nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getDefaulComputedStyle nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getSelection nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName matchMedia nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName maximize nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName moveBy nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName moveTo nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName open nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName openDialog nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName postMessage nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName print nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName prompt nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName removeEventListener nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName resizeBy nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName resizeTo nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName restore nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scroll nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollBy nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollByLines nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollByPages nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollTo nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setCursor nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setImmediate nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setInterval nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setResizable nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setTimeout nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName showModalDialog nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName sizeToContent nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName stop nextgroup=typescriptFuncCallArg +syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName updateCommands nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptBOMWindowMethod +if exists("did_typescript_hilink") | HiLink typescriptBOMWindowMethod Structure +endif +syntax keyword typescriptBOMWindowEvent contained onabort onbeforeunload onblur onchange +syntax keyword typescriptBOMWindowEvent contained onclick onclose oncontextmenu ondevicelight +syntax keyword typescriptBOMWindowEvent contained ondevicemotion ondeviceorientation +syntax keyword typescriptBOMWindowEvent contained ondeviceproximity ondragdrop onerror +syntax keyword typescriptBOMWindowEvent contained onfocus onhashchange onkeydown onkeypress +syntax keyword typescriptBOMWindowEvent contained onkeyup onload onmousedown onmousemove +syntax keyword typescriptBOMWindowEvent contained onmouseout onmouseover onmouseup +syntax keyword typescriptBOMWindowEvent contained onmozbeforepaint onpaint onpopstate +syntax keyword typescriptBOMWindowEvent contained onreset onresize onscroll onselect +syntax keyword typescriptBOMWindowEvent contained onsubmit onunload onuserproximity +syntax keyword typescriptBOMWindowEvent contained onpageshow onpagehide +if exists("did_typescript_hilink") | HiLink typescriptBOMWindowEvent Keyword +endif +syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName DOMParser +syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName QueryInterface +syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName XMLSerializer +if exists("did_typescript_hilink") | HiLink typescriptBOMWindowCons Structure +endif diff --git a/syntax/yats/web-xhr.vim b/syntax/yats/web-xhr.vim new file mode 100644 index 000000000..60769f217 --- /dev/null +++ b/syntax/yats/web-xhr.vim @@ -0,0 +1,18 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptXHRGlobal containedin=typescriptIdentifierName XMLHttpRequest +if exists("did_typescript_hilink") | HiLink typescriptXHRGlobal Structure +endif +syntax keyword typescriptXHRProp contained onreadystatechange readyState response +syntax keyword typescriptXHRProp contained responseText responseType responseXML status +syntax keyword typescriptXHRProp contained statusText timeout ontimeout upload withCredentials +syntax cluster props add=typescriptXHRProp +if exists("did_typescript_hilink") | HiLink typescriptXHRProp Keyword +endif +syntax keyword typescriptXHRMethod contained abort getAllResponseHeaders getResponseHeader nextgroup=typescriptFuncCallArg +syntax keyword typescriptXHRMethod contained open overrideMimeType send setRequestHeader nextgroup=typescriptFuncCallArg +syntax cluster props add=typescriptXHRMethod +if exists("did_typescript_hilink") | HiLink typescriptXHRMethod Keyword +endif diff --git a/syntax/yats/web.vim b/syntax/yats/web.vim new file mode 100644 index 000000000..33d4e0660 --- /dev/null +++ b/syntax/yats/web.vim @@ -0,0 +1,253 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1 + finish +endif + +syntax keyword typescriptBOM containedin=typescriptIdentifierName AbortController +syntax keyword typescriptBOM containedin=typescriptIdentifierName AbstractWorker AnalyserNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName App Apps ArrayBuffer +syntax keyword typescriptBOM containedin=typescriptIdentifierName ArrayBufferView +syntax keyword typescriptBOM containedin=typescriptIdentifierName Attr AudioBuffer +syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioBufferSourceNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioContext AudioDestinationNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioListener AudioNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioParam BatteryManager +syntax keyword typescriptBOM containedin=typescriptIdentifierName BiquadFilterNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName BlobEvent BluetoothAdapter +syntax keyword typescriptBOM containedin=typescriptIdentifierName BluetoothDevice +syntax keyword typescriptBOM containedin=typescriptIdentifierName BluetoothManager +syntax keyword typescriptBOM containedin=typescriptIdentifierName CameraCapabilities +syntax keyword typescriptBOM containedin=typescriptIdentifierName CameraControl CameraManager +syntax keyword typescriptBOM containedin=typescriptIdentifierName CanvasGradient CanvasImageSource +syntax keyword typescriptBOM containedin=typescriptIdentifierName CanvasPattern CanvasRenderingContext2D +syntax keyword typescriptBOM containedin=typescriptIdentifierName CaretPosition CDATASection +syntax keyword typescriptBOM containedin=typescriptIdentifierName ChannelMergerNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName ChannelSplitterNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName CharacterData ChildNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName ChromeWorker Comment +syntax keyword typescriptBOM containedin=typescriptIdentifierName Connection Console +syntax keyword typescriptBOM containedin=typescriptIdentifierName ContactManager Contacts +syntax keyword typescriptBOM containedin=typescriptIdentifierName ConvolverNode Coordinates +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSS CSSConditionRule +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSGroupingRule +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSKeyframeRule +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSKeyframesRule +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSMediaRule CSSNamespaceRule +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSPageRule CSSRule +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSRuleList CSSStyleDeclaration +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSStyleRule CSSStyleSheet +syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSSupportsRule +syntax keyword typescriptBOM containedin=typescriptIdentifierName DataTransfer DataView +syntax keyword typescriptBOM containedin=typescriptIdentifierName DedicatedWorkerGlobalScope +syntax keyword typescriptBOM containedin=typescriptIdentifierName DelayNode DeviceAcceleration +syntax keyword typescriptBOM containedin=typescriptIdentifierName DeviceRotationRate +syntax keyword typescriptBOM containedin=typescriptIdentifierName DeviceStorage DirectoryEntry +syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryEntrySync +syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryReader +syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryReaderSync +syntax keyword typescriptBOM containedin=typescriptIdentifierName Document DocumentFragment +syntax keyword typescriptBOM containedin=typescriptIdentifierName DocumentTouch DocumentType +syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMCursor DOMError +syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMException DOMHighResTimeStamp +syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMImplementation +syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMImplementationRegistry +syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMParser DOMRequest +syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMString DOMStringList +syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMStringMap DOMTimeStamp +syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMTokenList DynamicsCompressorNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName Element Entry EntrySync +syntax keyword typescriptBOM containedin=typescriptIdentifierName Extensions FileException +syntax keyword typescriptBOM containedin=typescriptIdentifierName Float32Array Float64Array +syntax keyword typescriptBOM containedin=typescriptIdentifierName FMRadio FormData +syntax keyword typescriptBOM containedin=typescriptIdentifierName GainNode Gamepad +syntax keyword typescriptBOM containedin=typescriptIdentifierName GamepadButton Geolocation +syntax keyword typescriptBOM containedin=typescriptIdentifierName History HTMLAnchorElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLAreaElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLAudioElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBaseElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBodyElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBRElement HTMLButtonElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLCanvasElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLCollection HTMLDataElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDataListElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDivElement HTMLDListElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDocument HTMLElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLEmbedElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFieldSetElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFormControlsCollection +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFormElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHeadElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHeadingElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHRElement HTMLHtmlElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLIFrameElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLImageElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLInputElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLKeygenElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLabelElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLegendElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLIElement HTMLLinkElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMapElement HTMLMediaElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMetaElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMeterElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLModElement HTMLObjectElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOListElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptGroupElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptionElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptionsCollection +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOutputElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLParagraphElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLParamElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLPreElement HTMLProgressElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLQuoteElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLScriptElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSelectElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSourceElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSpanElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLStyleElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableCaptionElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableCellElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableColElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableDataCellElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableHeaderCellElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableRowElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableSectionElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTextAreaElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTimeElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTitleElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTrackElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLUListElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLUnknownElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLVideoElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBCursor IDBCursorSync +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBCursorWithValue +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBDatabase IDBDatabaseSync +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBEnvironment IDBEnvironmentSync +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBFactory IDBFactorySync +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBIndex IDBIndexSync +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBKeyRange IDBObjectStore +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBObjectStoreSync +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBOpenDBRequest +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBRequest IDBTransaction +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBTransactionSync +syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBVersionChangeEvent +syntax keyword typescriptBOM containedin=typescriptIdentifierName ImageData IndexedDB +syntax keyword typescriptBOM containedin=typescriptIdentifierName Int16Array Int32Array +syntax keyword typescriptBOM containedin=typescriptIdentifierName Int8Array L10n LinkStyle +syntax keyword typescriptBOM containedin=typescriptIdentifierName LocalFileSystem +syntax keyword typescriptBOM containedin=typescriptIdentifierName LocalFileSystemSync +syntax keyword typescriptBOM containedin=typescriptIdentifierName Location LockedFile +syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaQueryList MediaQueryListListener +syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaRecorder MediaSource +syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaStream MediaStreamTrack +syntax keyword typescriptBOM containedin=typescriptIdentifierName MutationObserver +syntax keyword typescriptBOM containedin=typescriptIdentifierName Navigator NavigatorGeolocation +syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorID NavigatorLanguage +syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorOnLine +syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorPlugins +syntax keyword typescriptBOM containedin=typescriptIdentifierName Node NodeFilter +syntax keyword typescriptBOM containedin=typescriptIdentifierName NodeIterator NodeList +syntax keyword typescriptBOM containedin=typescriptIdentifierName Notification OfflineAudioContext +syntax keyword typescriptBOM containedin=typescriptIdentifierName OscillatorNode PannerNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName ParentNode Performance +syntax keyword typescriptBOM containedin=typescriptIdentifierName PerformanceNavigation +syntax keyword typescriptBOM containedin=typescriptIdentifierName PerformanceTiming +syntax keyword typescriptBOM containedin=typescriptIdentifierName Permissions PermissionSettings +syntax keyword typescriptBOM containedin=typescriptIdentifierName Plugin PluginArray +syntax keyword typescriptBOM containedin=typescriptIdentifierName Position PositionError +syntax keyword typescriptBOM containedin=typescriptIdentifierName PositionOptions +syntax keyword typescriptBOM containedin=typescriptIdentifierName PowerManager ProcessingInstruction +syntax keyword typescriptBOM containedin=typescriptIdentifierName PromiseResolver +syntax keyword typescriptBOM containedin=typescriptIdentifierName PushManager Range +syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCConfiguration +syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCPeerConnection +syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCPeerConnectionErrorCallback +syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCSessionDescription +syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCSessionDescriptionCallback +syntax keyword typescriptBOM containedin=typescriptIdentifierName ScriptProcessorNode +syntax keyword typescriptBOM containedin=typescriptIdentifierName Selection SettingsLock +syntax keyword typescriptBOM containedin=typescriptIdentifierName SettingsManager +syntax keyword typescriptBOM containedin=typescriptIdentifierName SharedWorker StyleSheet +syntax keyword typescriptBOM containedin=typescriptIdentifierName StyleSheetList SVGAElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAngle SVGAnimateColorElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedAngle +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedBoolean +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedEnumeration +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedInteger +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedLength +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedLengthList +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedNumber +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedNumberList +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedPoints +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedPreserveAspectRatio +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedRect +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedString +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedTransformList +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateMotionElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateTransformElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimationElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGCircleElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGClipPathElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGCursorElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGDefsElement SVGDescElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGElement SVGEllipseElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFilterElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontElement SVGFontFaceElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceFormatElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceNameElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceSrcElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceUriElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGForeignObjectElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGGElement SVGGlyphElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGGradientElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGHKernElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGImageElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLength SVGLengthList +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLinearGradientElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLineElement SVGMaskElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGMatrix SVGMissingGlyphElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGMPathElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGNumber SVGNumberList +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPathElement SVGPatternElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPoint SVGPolygonElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPolylineElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPreserveAspectRatio +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGRadialGradientElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGRect SVGRectElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGScriptElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSetElement SVGStopElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGStringList SVGStylable +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGStyleElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSVGElement SVGSwitchElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSymbolElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTests SVGTextElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTextPositioningElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTitleElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTransform SVGTransformable +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTransformList +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTRefElement SVGTSpanElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGUseElement SVGViewElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGVKernElement +syntax keyword typescriptBOM containedin=typescriptIdentifierName TCPServerSocket +syntax keyword typescriptBOM containedin=typescriptIdentifierName TCPSocket Telephony +syntax keyword typescriptBOM containedin=typescriptIdentifierName TelephonyCall Text +syntax keyword typescriptBOM containedin=typescriptIdentifierName TextDecoder TextEncoder +syntax keyword typescriptBOM containedin=typescriptIdentifierName TextMetrics TimeRanges +syntax keyword typescriptBOM containedin=typescriptIdentifierName Touch TouchList +syntax keyword typescriptBOM containedin=typescriptIdentifierName Transferable TreeWalker +syntax keyword typescriptBOM containedin=typescriptIdentifierName Uint16Array Uint32Array +syntax keyword typescriptBOM containedin=typescriptIdentifierName Uint8Array Uint8ClampedArray +syntax keyword typescriptBOM containedin=typescriptIdentifierName URLSearchParams +syntax keyword typescriptBOM containedin=typescriptIdentifierName URLUtilsReadOnly +syntax keyword typescriptBOM containedin=typescriptIdentifierName UserProximityEvent +syntax keyword typescriptBOM containedin=typescriptIdentifierName ValidityState VideoPlaybackQuality +syntax keyword typescriptBOM containedin=typescriptIdentifierName WaveShaperNode WebBluetooth +syntax keyword typescriptBOM containedin=typescriptIdentifierName WebGLRenderingContext +syntax keyword typescriptBOM containedin=typescriptIdentifierName WebSMS WebSocket +syntax keyword typescriptBOM containedin=typescriptIdentifierName WebVTT WifiManager +syntax keyword typescriptBOM containedin=typescriptIdentifierName Window Worker WorkerConsole +syntax keyword typescriptBOM containedin=typescriptIdentifierName WorkerLocation WorkerNavigator +syntax keyword typescriptBOM containedin=typescriptIdentifierName XDomainRequest XMLDocument +syntax keyword typescriptBOM containedin=typescriptIdentifierName XMLHttpRequestEventTarget +if exists("did_typescript_hilink") | HiLink typescriptBOM Structure +endif