aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/dist/ft.vim2
-rw-r--r--runtime/autoload/health/provider.vim44
-rw-r--r--runtime/autoload/provider/clipboard.vim72
-rw-r--r--runtime/autoload/provider/node.vim19
-rw-r--r--runtime/autoload/provider/perl.vim28
-rw-r--r--runtime/autoload/provider/pythonx.vim4
-rw-r--r--runtime/autoload/provider/ruby.vim3
-rw-r--r--runtime/autoload/spellfile.vim10
-rw-r--r--runtime/compiler/ts-node.vim29
-rw-r--r--runtime/compiler/tsc.vim26
-rw-r--r--runtime/compiler/xo.vim26
-rw-r--r--runtime/doc/api.txt209
-rw-r--r--runtime/doc/autocmd.txt183
-rw-r--r--runtime/doc/change.txt4
-rw-r--r--runtime/doc/cmdline.txt5
-rw-r--r--runtime/doc/deprecated.txt2
-rw-r--r--runtime/doc/develop.txt6
-rw-r--r--runtime/doc/digraph.txt1
-rw-r--r--runtime/doc/eval.txt183
-rw-r--r--runtime/doc/help.txt4
-rw-r--r--runtime/doc/if_perl.txt268
-rw-r--r--runtime/doc/if_ruby.txt12
-rw-r--r--runtime/doc/index.txt3
-rw-r--r--runtime/doc/insert.txt4
-rw-r--r--runtime/doc/intro.txt95
-rw-r--r--runtime/doc/lsp.txt876
-rw-r--r--runtime/doc/lua.txt475
-rw-r--r--runtime/doc/map.txt50
-rw-r--r--runtime/doc/mbyte.txt208
-rw-r--r--runtime/doc/message.txt2
-rw-r--r--runtime/doc/mlang.txt3
-rw-r--r--runtime/doc/nvim_terminal_emulator.txt2
-rw-r--r--runtime/doc/options.txt119
-rw-r--r--runtime/doc/provider.txt14
-rw-r--r--runtime/doc/quickfix.txt46
-rw-r--r--runtime/doc/quickref.txt2
-rw-r--r--runtime/doc/spell.txt14
-rw-r--r--runtime/doc/starting.txt175
-rw-r--r--runtime/doc/treesitter.txt295
-rw-r--r--runtime/doc/ui.txt4
-rw-r--r--runtime/doc/usr_02.txt2
-rw-r--r--runtime/doc/vim_diff.txt28
-rw-r--r--runtime/doc/visual.txt5
-rw-r--r--runtime/filetype.vim24
-rw-r--r--runtime/ftplugin/markdown.vim46
-rw-r--r--runtime/ftplugin/typescript.vim39
-rw-r--r--runtime/ftplugin/typescriptreact.vim33
-rw-r--r--runtime/indent/typescript.vim4
-rw-r--r--runtime/lua/vim/highlight.lua2
-rw-r--r--runtime/lua/vim/lsp.lua363
-rw-r--r--runtime/lua/vim/lsp/buf.lua144
-rw-r--r--runtime/lua/vim/lsp/callbacks.lua98
-rw-r--r--runtime/lua/vim/lsp/log.lua17
-rw-r--r--runtime/lua/vim/lsp/protocol.lua25
-rw-r--r--runtime/lua/vim/lsp/rpc.lua148
-rw-r--r--runtime/lua/vim/lsp/util.lua377
-rw-r--r--runtime/lua/vim/shared.lua93
-rw-r--r--runtime/lua/vim/treesitter.lua272
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua210
-rw-r--r--runtime/lua/vim/treesitter/language.lua37
-rw-r--r--runtime/lua/vim/treesitter/query.lua335
-rw-r--r--runtime/lua/vim/tshighlighter.lua116
-rw-r--r--runtime/lua/vim/uri.lua20
-rw-r--r--runtime/pack/dist/opt/cfilter/plugin/cfilter.vim39
-rw-r--r--runtime/queries/c/highlights.scm151
-rw-r--r--runtime/syntax/markdown.vim66
-rw-r--r--runtime/syntax/resolv.vim53
-rw-r--r--runtime/syntax/tex.vim53
-rw-r--r--runtime/syntax/typescript.vim2052
-rw-r--r--runtime/syntax/typescriptcommon.vim2067
-rw-r--r--runtime/syntax/typescriptreact.vim160
-rw-r--r--runtime/tools/check_colors.vim51
72 files changed, 6462 insertions, 4195 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index e85ffc763b..b6297472c3 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -575,7 +575,7 @@ endfunc
let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*'
func dist#ft#FTRules()
let path = expand('<amatch>:p')
- if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/udev/\%(rules\.d/\)\=.*\.rules\)$'
+ if path =~ '/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|\%(usr/\)\=lib/udev/\%(rules\.d/\)\=.*\.rules\)$'
setf udevrules
return
endif
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 0482cb7f3c..e8e38f581f 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -573,7 +573,7 @@ function! s:check_ruby() abort
endif
call health#report_info('Ruby: '. s:system('ruby -v'))
- let host = provider#ruby#Detect()
+ let [host, err] = provider#ruby#Detect()
if empty(host)
call health#report_warn('`neovim-ruby-host` not found.',
\ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.',
@@ -636,7 +636,7 @@ function! s:check_node() abort
call health#report_warn('node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.')
endif
- let host = provider#node#Detect()
+ let [host, err] = provider#node#Detect()
if empty(host)
call health#report_warn('Missing "neovim" npm (or yarn) package.',
\ ['Run in shell: npm install -g neovim',
@@ -689,29 +689,31 @@ function! s:check_perl() abort
return
endif
- if !executable('perl') || !executable('cpanm')
- call health#report_warn(
- \ '`perl` and `cpanm` must be in $PATH.',
- \ ['Install Perl and cpanminus and verify that `perl` and `cpanm` commands work.'])
- return
+ let [perl_exec, perl_errors] = provider#perl#Detect()
+ if empty(perl_exec)
+ if !empty(perl_errors)
+ call health#report_error('perl provider error:', perl_errors)
+ else
+ call health#report_warn('No usable perl executable found')
+ endif
+ return
endif
- let perl_v = get(split(s:system(['perl', '-W', '-e', 'print $^V']), "\n"), 0, '')
- call health#report_info('Perl: '. perl_v)
+
+ call health#report_info('perl executable: '. perl_exec)
+
+ " we cannot use cpanm that is on the path, as it may not be for the perl
+ " set with g:perl_host_prog
+ call s:system([perl_exec, '-W', '-MApp::cpanminus', '-e', ''])
if s:shell_error
- call health#report_warn('Nvim perl host does not support '.perl_v)
- " Skip further checks, they are nonsense if perl is too old.
- return
+ return [perl_exec, '"App::cpanminus" module is not installed']
endif
- let host = provider#perl#Detect()
- if empty(host)
- call health#report_warn('Missing "Neovim::Ext" cpan module.',
- \ ['Run in shell: cpanm Neovim::Ext'])
- return
- endif
- call health#report_info('Nvim perl host: '. host)
+ let latest_cpan_cmd = [perl_exec,
+ \ '-MApp::cpanminus::fatscript', '-e',
+ \ 'my $app = App::cpanminus::script->new;
+ \ $app->parse_options ("--info", "-q", "Neovim::Ext");
+ \ exit $app->doit']
- let latest_cpan_cmd = 'cpanm --info -q Neovim::Ext'
let latest_cpan = s:system(latest_cpan_cmd)
if s:shell_error || empty(latest_cpan)
call health#report_error('Failed to run: '. latest_cpan_cmd,
@@ -735,7 +737,7 @@ function! s:check_perl() abort
return
endif
- let current_cpan_cmd = [host, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION']
+ let current_cpan_cmd = [perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION']
let current_cpan = s:system(current_cpan_cmd)
if s:shell_error
call health#report_error('Failed to run: '. string(current_cpan_cmd),
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index a96a0a61b7..275d18a5a9 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -35,8 +35,7 @@ endfunction
let s:selections = { '*': s:selection, '+': copy(s:selection) }
function! s:try_cmd(cmd, ...) abort
- let argv = split(a:cmd, " ")
- let out = systemlist(argv, (a:0 ? a:1 : ['']), 1)
+ let out = systemlist(a:cmd, (a:0 ? a:1 : ['']), 1)
if v:shell_error
if !exists('s:did_error_try_cmd')
echohl WarningMsg
@@ -55,6 +54,10 @@ function! s:cmd_ok(cmd) abort
return v:shell_error == 0
endfunction
+function! s:split_cmd(cmd) abort
+ return (type(a:cmd) == v:t_string) ? split(a:cmd, " ") : a:cmd
+endfunction
+
let s:cache_enabled = 1
let s:err = ''
@@ -71,44 +74,50 @@ function! provider#clipboard#Executable() abort
return ''
endif
- let s:copy = get(g:clipboard, 'copy', { '+': v:null, '*': v:null })
- let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null })
+ let s:copy = {}
+ let s:copy['+'] = s:split_cmd(get(g:clipboard.copy, '+', v:null))
+ let s:copy['*'] = s:split_cmd(get(g:clipboard.copy, '*', v:null))
+
+ let s:paste = {}
+ let s:paste['+'] = s:split_cmd(get(g:clipboard.paste, '+', v:null))
+ let s:paste['*'] = s:split_cmd(get(g:clipboard.paste, '*', v:null))
+
let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0)
return get(g:clipboard, 'name', 'g:clipboard')
elseif has('mac')
- let s:copy['+'] = 'pbcopy'
- let s:paste['+'] = 'pbpaste'
+ let s:copy['+'] = ['pbcopy']
+ let s:paste['+'] = ['pbpaste']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
let s:cache_enabled = 0
return 'pbcopy'
elseif exists('$WAYLAND_DISPLAY') && executable('wl-copy') && executable('wl-paste')
- let s:copy['+'] = 'wl-copy --foreground --type text/plain'
- let s:paste['+'] = 'wl-paste --no-newline'
- let s:copy['*'] = 'wl-copy --foreground --primary --type text/plain'
- let s:paste['*'] = 'wl-paste --no-newline --primary'
+ let s:copy['+'] = ['wl-copy', '--foreground', '--type', 'text/plain']
+ let s:paste['+'] = ['wl-paste', '--no-newline']
+ let s:copy['*'] = ['wl-copy', '--foreground', '--primary', '--type', 'text/plain']
+ let s:paste['*'] = ['wl-paste', '--no-newline', '--primary']
return 'wl-copy'
elseif exists('$DISPLAY') && executable('xclip')
- let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
- let s:paste['+'] = 'xclip -o -selection clipboard'
- let s:copy['*'] = 'xclip -quiet -i -selection primary'
- let s:paste['*'] = 'xclip -o -selection primary'
+ let s:copy['+'] = ['xclip', '-quiet', '-i', '-selection', 'clipboard']
+ let s:paste['+'] = ['xclip', '-o', '-selection', 'clipboard']
+ let s:copy['*'] = ['xclip', '-quiet', '-i', '-selection', 'primary']
+ let s:paste['*'] = ['xclip', '-o', '-selection', 'primary']
return 'xclip'
elseif exists('$DISPLAY') && executable('xsel') && s:cmd_ok('xsel -o -b')
- let s:copy['+'] = 'xsel --nodetach -i -b'
- let s:paste['+'] = 'xsel -o -b'
- let s:copy['*'] = 'xsel --nodetach -i -p'
- let s:paste['*'] = 'xsel -o -p'
+ let s:copy['+'] = ['xsel', '--nodetach', '-i', '-b']
+ let s:paste['+'] = ['xsel', '-o', '-b']
+ let s:copy['*'] = ['xsel', '--nodetach', '-i', '-p']
+ let s:paste['*'] = ['xsel', '-o', '-p']
return 'xsel'
elseif executable('lemonade')
- let s:copy['+'] = 'lemonade copy'
- let s:paste['+'] = 'lemonade paste'
- let s:copy['*'] = 'lemonade copy'
- let s:paste['*'] = 'lemonade paste'
+ let s:copy['+'] = ['lemonade', 'copy']
+ let s:paste['+'] = ['lemonade', 'paste']
+ let s:copy['*'] = ['lemonade', 'copy']
+ let s:paste['*'] = ['lemonade', 'paste']
return 'lemonade'
elseif executable('doitclient')
- let s:copy['+'] = 'doitclient wclip'
- let s:paste['+'] = 'doitclient wclip -r'
+ let s:copy['+'] = ['doitclient', 'wclip']
+ let s:paste['+'] = ['doitclient', 'wclip', '-r']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'doitclient'
@@ -118,14 +127,14 @@ function! provider#clipboard#Executable() abort
else
let win32yank = 'win32yank.exe'
endif
- let s:copy['+'] = win32yank.' -i --crlf'
- let s:paste['+'] = win32yank.' -o --lf'
+ let s:copy['+'] = [win32yank, '-i', '--crlf']
+ let s:paste['+'] = [win32yank, '-o', '--lf']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'win32yank'
elseif exists('$TMUX') && executable('tmux')
- let s:copy['+'] = 'tmux load-buffer -'
- let s:paste['+'] = 'tmux save-buffer -'
+ let s:copy['+'] = ['tmux', 'load-buffer', '-']
+ let s:paste['+'] = ['tmux', 'save-buffer', '-']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'tmux'
@@ -169,16 +178,15 @@ function! s:clipboard.set(lines, regtype, reg) abort
let s:selections[a:reg] = copy(s:selection)
let selection = s:selections[a:reg]
let selection.data = [a:lines, a:regtype]
- let argv = split(s:copy[a:reg], " ")
- let selection.argv = argv
+ let selection.argv = s:copy[a:reg]
let selection.detach = s:cache_enabled
let selection.cwd = "/"
- let jobid = jobstart(argv, selection)
+ let jobid = jobstart(selection.argv, selection)
if jobid > 0
call jobsend(jobid, a:lines)
call jobclose(jobid, 'stdin')
" xclip does not close stdout when receiving input via stdin
- if argv[0] ==# 'xclip'
+ if selection.argv[0] ==# 'xclip'
call jobclose(jobid, 'stdout')
endif
let selection.owner = jobid
diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim
index c5d5e87729..17b6137816 100644
--- a/runtime/autoload/provider/node.vim
+++ b/runtime/autoload/provider/node.vim
@@ -48,14 +48,15 @@ function! provider#node#can_inspect() abort
endfunction
function! provider#node#Detect() abort
+ let minver = [6, 0]
if exists('g:node_host_prog')
- return expand(g:node_host_prog)
+ return [expand(g:node_host_prog), '']
endif
if !executable('node')
- return ''
+ return ['', 'node not found (or not executable)']
endif
- if !s:is_minimum_version(v:null, 6, 0)
- return ''
+ if !s:is_minimum_version(v:null, minver[0], minver[1])
+ return ['', printf('node version %s.%s not found', minver[0], minver[1])]
endif
let npm_opts = {}
@@ -75,7 +76,7 @@ function! provider#node#Detect() abort
if has('unix')
let yarn_default_path = $HOME . '/.config/yarn/global/' . yarn_opts.entry_point
if filereadable(yarn_default_path)
- return yarn_default_path
+ return [yarn_default_path, '']
endif
endif
let yarn_opts.job_id = jobstart('yarn global dir', yarn_opts)
@@ -85,18 +86,18 @@ function! provider#node#Detect() abort
if !empty(npm_opts)
let result = jobwait([npm_opts.job_id])
if result[0] == 0 && npm_opts.result != ''
- return npm_opts.result
+ return [npm_opts.result, '']
endif
endif
if !empty(yarn_opts)
let result = jobwait([yarn_opts.job_id])
if result[0] == 0 && yarn_opts.result != ''
- return yarn_opts.result
+ return [yarn_opts.result, '']
endif
endif
- return ''
+ return ['', 'failed to detect node']
endfunction
function! provider#node#Prog() abort
@@ -142,7 +143,7 @@ endfunction
let s:err = ''
-let s:prog = provider#node#Detect()
+let [s:prog, s:_] = provider#node#Detect()
let g:loaded_node_provider = empty(s:prog) ? 1 : 2
if g:loaded_node_provider != 2
diff --git a/runtime/autoload/provider/perl.vim b/runtime/autoload/provider/perl.vim
index 36ca2bbf14..24f2b018bb 100644
--- a/runtime/autoload/provider/perl.vim
+++ b/runtime/autoload/provider/perl.vim
@@ -5,15 +5,25 @@ endif
let s:loaded_perl_provider = 1
function! provider#perl#Detect() abort
- " use g:perl_host_prof if set or check if perl is on the path
+ " use g:perl_host_prog if set or check if perl is on the path
let prog = exepath(get(g:, 'perl_host_prog', 'perl'))
if empty(prog)
- return ''
+ return ['', '']
+ endif
+
+ " if perl is available, make sure we have 5.22+
+ call system([prog, '-e', 'use v5.22'])
+ if v:shell_error
+ return ['', 'Perl version is too old, 5.22+ required']
endif
" if perl is available, make sure the required module is available
call system([prog, '-W', '-MNeovim::Ext', '-e', ''])
- return v:shell_error ? '' : prog
+ if v:shell_error
+ return ['', '"Neovim::Ext" cpan module is not installed']
+ endif
+
+ return [prog, '']
endfunction
function! provider#perl#Prog() abort
@@ -46,7 +56,7 @@ function! provider#perl#Call(method, args) abort
if !exists('s:host')
try
- let s:host = remote#host#Require('perl')
+ let s:host = remote#host#Require('legacy-perl-provider')
catch
let s:err = v:exception
echohl WarningMsg
@@ -58,12 +68,16 @@ function! provider#perl#Call(method, args) abort
return call('rpcrequest', insert(insert(a:args, 'perl_'.a:method), s:host))
endfunction
-let s:err = ''
-let s:prog = provider#perl#Detect()
+let [s:prog, s:err] = provider#perl#Detect()
let g:loaded_perl_provider = empty(s:prog) ? 1 : 2
if g:loaded_perl_provider != 2
let s:err = 'Cannot find perl or the required perl module'
endif
-call remote#host#RegisterPlugin('perl-provider', 'perl', [])
+
+" The perl provider plugin will run in a separate instance of the perl
+" host.
+call remote#host#RegisterClone('legacy-perl-provider', 'perl')
+call remote#host#RegisterPlugin('legacy-perl-provider', 'ScriptHost.pm', [])
+
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index e89d519790..550931d8aa 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -29,8 +29,8 @@ endfunction
function! s:get_python_candidates(major_version) abort
return {
\ 2: ['python2', 'python2.7', 'python2.6', 'python'],
- \ 3: ['python3', 'python3.9', 'python3.8', 'python3.7', 'python3.6', 'python3.5',
- \ 'python3.4', 'python3.3', 'python']
+ \ 3: ['python3', 'python3.10', 'python3.9', 'python3.8', 'python3.7',
+ \ 'python3.6', 'python']
\ }[a:major_version]
endfunction
diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim
index f843050df9..1f49c623ac 100644
--- a/runtime/autoload/provider/ruby.vim
+++ b/runtime/autoload/provider/ruby.vim
@@ -5,7 +5,8 @@ endif
let g:loaded_ruby_provider = 1
function! provider#ruby#Detect() abort
- return s:prog
+ let e = empty(s:prog) ? 'missing ruby or ruby-host' : ''
+ return [s:prog, e]
endfunction
function! provider#ruby#Prog() abort
diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim
index d098902305..e36e2f936b 100644
--- a/runtime/autoload/spellfile.vim
+++ b/runtime/autoload/spellfile.vim
@@ -1,13 +1,9 @@
" Vim script to download a missing spell file
if !exists('g:spellfile_URL')
- " Prefer using http:// when netrw should be able to use it, since
- " more firewalls let this through.
- if executable("curl") || executable("wget") || executable("fetch")
- let g:spellfile_URL = 'http://ftp.vim.org/pub/vim/runtime/spell'
- else
- let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/runtime/spell'
- endif
+ " Always use https:// because it's secure. The certificate is for nluug.nl,
+ " thus we can't use the alias ftp.vim.org here.
+ let g:spellfile_URL = 'https://ftp.nluug.nl/pub/vim/runtime/spell'
endif
let s:spellfile_URL = '' " Start with nothing so that s:donedict is reset.
diff --git a/runtime/compiler/ts-node.vim b/runtime/compiler/ts-node.vim
new file mode 100644
index 0000000000..14f0ea790c
--- /dev/null
+++ b/runtime/compiler/ts-node.vim
@@ -0,0 +1,29 @@
+" Vim compiler file
+" Compiler: TypeScript Runner
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2020 Feb 10
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "node"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" CompilerSet makeprg=npx\ ts-node
+
+CompilerSet makeprg=ts-node
+CompilerSet errorformat=%f\ %#(%l\\,%c):\ %trror\ TS%n:\ %m,
+ \%E%f:%l,
+ \%+Z%\\w%\\+Error:\ %.%#,
+ \%C%p^%\\+,
+ \%C%.%#,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/compiler/tsc.vim b/runtime/compiler/tsc.vim
new file mode 100644
index 0000000000..a246fc7751
--- /dev/null
+++ b/runtime/compiler/tsc.vim
@@ -0,0 +1,26 @@
+" Vim compiler file
+" Compiler: TypeScript Compiler
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2020 Feb 10
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "tsc"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" CompilerSet makeprg=npx\ tsc
+
+CompilerSet makeprg=tsc
+CompilerSet errorformat=%f\ %#(%l\\,%c):\ %trror\ TS%n:\ %m,
+ \%trror\ TS%n:\ %m,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/compiler/xo.vim b/runtime/compiler/xo.vim
new file mode 100644
index 0000000000..525657d4bb
--- /dev/null
+++ b/runtime/compiler/xo.vim
@@ -0,0 +1,26 @@
+" Vim compiler file
+" Compiler: XO
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2019 Jul 10
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "xo"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" CompilerSet makeprg=npx\ xo\ --reporter\ compact
+
+CompilerSet makeprg=xo\ --reporter\ compact
+CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %trror\ %m,
+ \%f:\ line\ %l\\,\ col\ %c\\,\ %tarning\ %m,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index ea3a8242ae..0c726ddd86 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -70,7 +70,7 @@ Nvim instance:
nvim = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, ENV['NVIM_LISTEN_ADDRESS'])
result = nvim.call(:nvim_command, 'echo "hello world!"')
<
-A better way is to use the Python REPL with the `neovim` package, where API
+A better way is to use the Python REPL with the "pynvim" package, where API
functions can be called interactively:
>
>>> from pynvim import attach
@@ -336,7 +336,7 @@ callbacks. These callbacks are called frequently in various contexts;
|textlock| prevents changing buffer contents and window layout (use
|vim.schedule| to defer such operations to the main loop instead).
-|nvim_buf_attach| will take keyword args for the callbacks. "on_lines" will
+|nvim_buf_attach()| will take keyword args for the callbacks. "on_lines" will
receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline},
{new_lastline}, {old_byte_size}[, {old_utf32_size}, {old_utf16_size}]).
Unlike remote channel events the text contents are not passed. The new text can
@@ -355,7 +355,7 @@ was changed. The parameters recieved are ("changedtick", {buf}, {changedtick}).
*api-lua-detach*
In-process Lua callbacks can detach by returning `true`. This will detach all
-callbacks attached with the same |nvim_buf_attach| call.
+callbacks attached with the same |nvim_buf_attach()| call.
==============================================================================
@@ -529,13 +529,11 @@ nvim__id_float({flt}) *nvim__id_float()*
nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()*
TODO: Documentation
- *nvim__put_attr()*
-nvim__put_attr({id}, {start_row}, {start_col}, {end_row}, {end_col})
- Set attrs in nvim__buf_set_lua_hl callbacks
+nvim__screenshot({path}) *nvim__screenshot()*
+ TODO: Documentation
- TODO(bfredl): This is rather pedestrian. The final interface
- should probably be derived from a reformed bufhl/virttext
- interface with full support for multi-line ranges etc
+ Attributes: ~
+ {fast}
nvim__stats() *nvim__stats()*
Gets internal stats.
@@ -734,13 +732,14 @@ nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()*
On execution error: does not fail, but updates v:errmsg.
- If you need to input sequences like <C-o> use nvim_replace_termcodes
- to replace the termcodes and then pass the resulting string to
- nvim_feedkeys. You'll also want to enable escape_csi.
+ If you need to input sequences like <C-o> use
+ |nvim_replace_termcodes| to replace the termcodes and then
+ pass the resulting string to nvim_feedkeys. You'll also want
+ to enable escape_csi.
Example: >
- :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
- :call nvim_feedkeys(key, 'n', v:true)
+ :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
+ :call nvim_feedkeys(key, 'n', v:true)
<
Parameters: ~
@@ -1473,6 +1472,53 @@ nvim_set_current_win({window}) *nvim_set_current_win()*
Parameters: ~
{window} Window handle
+ *nvim_set_decoration_provider()*
+nvim_set_decoration_provider({ns_id}, {opts})
+ Set or change decoration provider for a namespace
+
+ This is a very general purpose interface for having lua
+ callbacks being triggered during the redraw code.
+
+ The expected usage is to set extmarks for the currently
+ redrawn buffer. |nvim_buf_set_extmark| can be called to add
+ marks on a per-window or per-lines basis. Use the `ephemeral`
+ key to only use the mark for the current screen redraw (the
+ callback will be called again for the next redraw ).
+
+ Note: this function should not be called often. Rather, the
+ callbacks themselves can be used to throttle unneeded
+ callbacks. the `on_start` callback can return `false` to
+ disable the provider until the next redraw. Similarily, return
+ `false` in `on_win` will skip the `on_lines` calls for that
+ window (but any extmarks set in `on_win` will still be used).
+ A plugin managing multiple sources of decorations should
+ ideally only set one provider, and merge the sources
+ internally. You can use multiple `ns_id` for the extmarks
+ set/modified inside the callback anyway.
+
+ Note: doing anything other than setting extmarks is considered
+ experimental. Doing things like changing options are not
+ expliticly forbidden, but is likely to have unexpected
+ consequences (such as 100% CPU consumption). doing
+ `vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite
+ dubious for the moment.
+
+ Parameters: ~
+ {ns_id} Namespace id from |nvim_create_namespace()|
+ {opts} Callbacks invoked during redraw:
+ • on_start: called first on each screen redraw
+ ["start", tick]
+ • on_buf: called for each buffer being redrawn
+ (before window callbacks) ["buf", bufnr, tick]
+ • on_win: called when starting to redraw a
+ specific window. ["win", winid, bufnr, topline,
+ botline_guess]
+ • on_line: called for each buffer line being
+ redrawn. (The interation with fold lines is
+ subject to change) ["win", winid, bufnr, row]
+ • on_end: called at the end of a redraw cycle
+ ["end", tick]
+
nvim_set_keymap({mode}, {lhs}, {rhs}, {opts}) *nvim_set_keymap()*
Sets a global |mapping| for the given mode.
@@ -1564,28 +1610,10 @@ affected.
You can use |nvim_buf_is_loaded()| or |nvim_buf_line_count()|
to check whether a buffer is loaded.
- *nvim__buf_add_decoration()*
-nvim__buf_add_decoration({buffer}, {ns_id}, {hl_group}, {start_row},
- {start_col}, {end_row}, {end_col},
- {virt_text})
- TODO: Documentation
-
*nvim__buf_redraw_range()*
nvim__buf_redraw_range({buffer}, {first}, {last})
TODO: Documentation
-nvim__buf_set_luahl({buffer}, {opts}) *nvim__buf_set_luahl()*
- Unstabilized interface for defining syntax hl in lua.
-
- This is not yet safe for general use, lua callbacks will need
- to be restricted, like textlock and probably other stuff.
-
- The API on_line/nvim__put_attr is quite raw and not intended
- to be the final shape. Ideally this should operate on chunks
- larger than a single line to reduce interpreter overhead, and
- generate annotation objects (bufhl/virttext) on the fly but
- using the same representation.
-
nvim__buf_stats({buffer}) *nvim__buf_stats()*
TODO: Documentation
@@ -1602,19 +1630,20 @@ nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line},
marks do.
Namespaces are used for batch deletion/updating of a set of
- highlights. To create a namespace, use |nvim_create_namespace|
- which returns a namespace id. Pass it in to this function as
- `ns_id` to add highlights to the namespace. All highlights in
- the same namespace can then be cleared with single call to
- |nvim_buf_clear_namespace|. If the highlight never will be
- deleted by an API call, pass `ns_id = -1` .
+ highlights. To create a namespace, use
+ |nvim_create_namespace()| which returns a namespace id. Pass
+ it in to this function as `ns_id` to add highlights to the
+ namespace. All highlights in the same namespace can then be
+ cleared with single call to |nvim_buf_clear_namespace()|. If
+ the highlight never will be deleted by an API call, pass
+ `ns_id = -1` .
As a shorthand, `ns_id = 0` can be used to create a new
namespace for the highlight, the allocated id is then
returned. If `hl_group` is the empty string no highlight is
added, but a new `ns_id` is still returned. This is supported
for backwards compatibility, new code should use
- |nvim_create_namespace| to create a new empty namespace.
+ |nvim_create_namespace()| to create a new empty namespace.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
@@ -1688,6 +1717,29 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
|nvim_buf_detach()|
|api-buffer-updates-lua|
+nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
+ call a function with buffer as temporary current buffer
+
+ This temporarily switches current buffer to "buffer". If the
+ current window already shows "buffer", the window is not
+ switched If a window inside the current tabpage (including a
+ float) already shows the buffer One of these windows will be
+ set as current window temporarily. Otherwise a temporary
+ scratch window (calleed the "autocmd window" for historical
+ reasons) will be used.
+
+ This is useful e.g. to call vimL functions that only work with
+ the current buffer/window currently, like |termopen()|.
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer
+ {fun} Function to call inside the buffer (currently
+ lua callable only)
+
+ Return: ~
+ Return value of function. NB: will deepcopy lua values
+ currently, use upvalues to send lua references in and out.
+
*nvim_buf_clear_namespace()*
nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
Clears namespaced objects (highlights, extmarks, virtual text)
@@ -1731,6 +1783,17 @@ nvim_buf_del_var({buffer}, {name}) *nvim_buf_del_var()*
{buffer} Buffer handle, or 0 for current buffer
{name} Variable name
+nvim_buf_delete({buffer}, {opts}) *nvim_buf_delete()*
+ Deletes the buffer. See |:bwipeout|
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer
+ {opts} Optional parameters. Keys:
+ • force: Force deletion and ignore unsaved
+ changes.
+ • unload: Unloaded only, do not delete. See
+ |:bunload|
+
nvim_buf_detach({buffer}) *nvim_buf_detach()*
Deactivates buffer-update events on the channel.
@@ -1765,13 +1828,16 @@ nvim_buf_get_commands({buffer}, {opts}) *nvim_buf_get_commands()*
Map of maps describing commands.
*nvim_buf_get_extmark_by_id()*
-nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id})
+nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})
Returns position for a given extmark id
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{ns_id} Namespace id from |nvim_create_namespace()|
{id} Extmark id
+ {opts} Optional parameters. Keys:
+ • limit: Maximum number of marks to return
+ • details Whether to include the details dict
Return: ~
(row, col) tuple or empty list () if extmark id was absent
@@ -1820,6 +1886,7 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
extmark id (whose position defines the bound)
{opts} Optional parameters. Keys:
• limit: Maximum number of marks to return
+ • details Whether to include the details dict
Return: ~
List of [extmark_id, row, col] tuples in "traversal
@@ -1918,28 +1985,6 @@ nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()*
Return: ~
Variable value
- *nvim_buf_get_virtual_text()*
-nvim_buf_get_virtual_text({buffer}, {line})
- Get the virtual text (annotation) for a buffer line.
-
- The virtual text is returned as list of lists, whereas the
- inner lists have either one or two elements. The first element
- is the actual text, the optional second element is the
- highlight group.
-
- The format is exactly the same as given to
- nvim_buf_set_virtual_text().
-
- If there is no virtual text associated with the given line, an
- empty list is returned.
-
- Parameters: ~
- {buffer} Buffer handle, or 0 for current buffer
- {line} Line to get the virtual text from (zero-indexed)
-
- Return: ~
- List of virtual text chunks
-
nvim_buf_is_loaded({buffer}) *nvim_buf_is_loaded()*
Checks if a buffer is valid and loaded. See |api-buffer| for
more info about unloaded buffers.
@@ -1973,22 +2018,40 @@ nvim_buf_line_count({buffer}) *nvim_buf_line_count()*
Line count, or 0 for unloaded buffer. |api-buffer|
*nvim_buf_set_extmark()*
-nvim_buf_set_extmark({buffer}, {ns_id}, {id}, {line}, {col}, {opts})
+nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
Creates or updates an extmark.
To create a new extmark, pass id=0. The extmark id will be
- returned. It is also allowed to create a new mark by passing
- in a previously unused id, but the caller must then keep track
- of existing and unused ids itself. (Useful over RPC, to avoid
+ returned. To move an existing mark, pass its id.
+
+ It is also allowed to create a new mark by passing in a
+ previously unused id, but the caller must then keep track of
+ existing and unused ids itself. (Useful over RPC, to avoid
waiting for the return value.)
+ Using the optional arguments, it is possible to use this to
+ highlight a range of text, and also to associate virtual text
+ to the mark.
+
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{ns_id} Namespace id from |nvim_create_namespace()|
- {id} Extmark id, or 0 to create new
{line} Line number where to place the mark
{col} Column where to place the mark
- {opts} Optional parameters. Currently not used.
+ {opts} Optional parameters.
+ • id : id of the extmark to edit.
+ • end_line : ending line of the mark, 0-based
+ inclusive.
+ • end_col : ending col of the mark, 0-based
+ inclusive.
+ • hl_group : name of the highlight group used to
+ highlight this mark.
+ • virt_text : virtual text to link to this mark.
+ • ephemeral : for use with
+ |nvim_set_decoration_provider| callbacks. The
+ mark will only be used for the current redraw
+ cycle, and not be permantently stored in the
+ buffer.
Return: ~
Id of the created/updated extmark
@@ -2065,12 +2128,12 @@ nvim_buf_set_virtual_text({buffer}, {src_id}, {line}, {chunks},
Namespaces are used to support batch deletion/updating of
virtual text. To create a namespace, use
- |nvim_create_namespace|. Virtual text is cleared using
- |nvim_buf_clear_namespace|. The same `ns_id` can be used for
+ |nvim_create_namespace()|. Virtual text is cleared using
+ |nvim_buf_clear_namespace()|. The same `ns_id` can be used for
both virtual text and highlights added by
- |nvim_buf_add_highlight|, both can then be cleared with a
- single call to |nvim_buf_clear_namespace|. If the virtual text
- never will be cleared by an API call, pass `ns_id = -1` .
+ |nvim_buf_add_highlight()|, both can then be cleared with a
+ single call to |nvim_buf_clear_namespace()|. If the virtual
+ text never will be cleared by an API call, pass `ns_id = -1` .
As a shorthand, `ns_id = 0` can be used to create a new
namespace for the virtual text, the allocated id is then
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index f1753b75cc..a728593c40 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -206,169 +206,9 @@ autocommands, this doesn't happen.
You can use the 'eventignore' option to ignore a number of events or all
events.
- *autocommand-events* *{event}*
-Vim recognizes the following events. Vim ignores the case of event names
-(e.g., you can use "BUFread" or "bufread" instead of "BufRead").
-
-First an overview by function with a short explanation. Then the list
-alphabetically with full explanations |autocmd-events-abc|.
-
-Name triggered by ~
-
- Reading
-|BufNewFile| starting to edit a file that doesn't exist
-|BufReadPre| starting to edit a new buffer, before reading the file
-|BufRead| starting to edit a new buffer, after reading the file
-|BufReadPost| starting to edit a new buffer, after reading the file
-|BufReadCmd| before starting to edit a new buffer |Cmd-event|
-
-|FileReadPre| before reading a file with a ":read" command
-|FileReadPost| after reading a file with a ":read" command
-|FileReadCmd| before reading a file with a ":read" command |Cmd-event|
-
-|FilterReadPre| before reading a file from a filter command
-|FilterReadPost| after reading a file from a filter command
-
-|StdinReadPre| before reading from stdin into the buffer
-|StdinReadPost| After reading from the stdin into the buffer
-
- Writing
-|BufWrite| starting to write the whole buffer to a file
-|BufWritePre| starting to write the whole buffer to a file
-|BufWritePost| after writing the whole buffer to a file
-|BufWriteCmd| before writing the whole buffer to a file |Cmd-event|
-
-|FileWritePre| starting to write part of a buffer to a file
-|FileWritePost| after writing part of a buffer to a file
-|FileWriteCmd| before writing part of a buffer to a file |Cmd-event|
-
-|FileAppendPre| starting to append to a file
-|FileAppendPost| after appending to a file
-|FileAppendCmd| before appending to a file |Cmd-event|
-
-|FilterWritePre| starting to write a file for a filter command or diff
-|FilterWritePost| after writing a file for a filter command or diff
-
- Buffers
-|BufAdd| just after adding a buffer to the buffer list
-|BufDelete| before deleting a buffer from the buffer list
-|BufWipeout| before completely deleting a buffer
-
-|BufFilePre| before changing the name of the current buffer
-|BufFilePost| after changing the name of the current buffer
-
-|BufEnter| after entering a buffer
-|BufLeave| before leaving to another buffer
-|BufWinEnter| after a buffer is displayed in a window
-|BufWinLeave| before a buffer is removed from a window
-
-|BufUnload| before unloading a buffer
-|BufHidden| just after a buffer has become hidden
-|BufNew| just after creating a new buffer
-
-|SwapExists| detected an existing swap file
-|TermOpen| starting a terminal job
-|TermEnter| entering Terminal-mode
-|TermLeave| leaving Terminal-mode
-|TermClose| stopping a terminal job
-|ChanOpen| after a channel opened
-|ChanInfo| after a channel has its state changed
-
- Options
-|FileType| when the 'filetype' option has been set
-|Syntax| when the 'syntax' option has been set
-|OptionSet| after setting any option
-
- Startup and exit
-|VimEnter| after doing all the startup stuff
-|UIEnter| after a UI attaches
-|UILeave| after a UI detaches
-|TermResponse| after the terminal response to t_RV is received
-|QuitPre| when using `:quit`, before deciding whether to exit
-|ExitPre| when using a command that may make Vim exit
-|VimLeavePre| before exiting Nvim, before writing the shada file
-|VimLeave| before exiting Nvim, after writing the shada file
-|VimResume| after Nvim is resumed
-|VimSuspend| before Nvim is suspended
-
- Various
-|DiffUpdated| after diffs have been updated
-|DirChanged| after the |current-directory| was changed
-
-|FileChangedShell| Vim notices that a file changed since editing started
-|FileChangedShellPost| after handling a file changed since editing started
-|FileChangedRO| before making the first change to a read-only file
-
-|ShellCmdPost| after executing a shell command
-|ShellFilterPost| after filtering with a shell command
-
-|CmdUndefined| a user command is used but it isn't defined
-|FuncUndefined| a user function is used but it isn't defined
-|SpellFileMissing| a spell file is used but it can't be found
-|SourcePre| before sourcing a Vim script
-|SourcePost| after sourcing a Vim script
-|SourceCmd| before sourcing a Vim script |Cmd-event|
-
-|VimResized| after the Vim window size changed
-|FocusGained| Nvim got focus
-|FocusLost| Nvim lost focus
-|CursorHold| the user doesn't press a key for a while
-|CursorHoldI| the user doesn't press a key for a while in Insert mode
-|CursorMoved| the cursor was moved in Normal mode
-|CursorMovedI| the cursor was moved in Insert mode
-
-|WinClosed| after closing a window
-|WinNew| after creating a new window
-|WinEnter| after entering another window
-|WinLeave| before leaving a window
-|TabEnter| after entering another tab page
-|TabLeave| before leaving a tab page
-|TabNew| when creating a new tab page
-|TabNewEntered| after entering a new tab page
-|TabClosed| after closing a tab page
-|CmdlineChanged| after a change was made to the command-line text
-|CmdlineEnter| after entering cmdline mode
-|CmdlineLeave| before leaving cmdline mode
-|CmdwinEnter| after entering the command-line window
-|CmdwinLeave| before leaving the command-line window
-
-|InsertEnter| starting Insert mode
-|InsertChange| when typing <Insert> while in Insert or Replace mode
-|InsertLeave| when leaving Insert mode
-|InsertCharPre| when a character was typed in Insert mode, before
- inserting it
-
-|TextYankPost| when some text is yanked or deleted
-
-|TextChanged| after a change was made to the text in Normal mode
-|TextChangedI| after a change was made to the text in Insert mode
- when popup menu is not visible
-|TextChangedP| after a change was made to the text in Insert mode
- when popup menu visible
-
-|ColorSchemePre| before loading a color scheme
-|ColorScheme| after loading a color scheme
-
-|RemoteReply| a reply from a server Vim was received
-
-|QuickFixCmdPre| before a quickfix command is run
-|QuickFixCmdPost| after a quickfix command is run
-
-|SessionLoadPost| after loading a session file
-
-|MenuPopup| just before showing the popup menu
-|CompleteChanged| after popup menu changed, not fired on popup menu hide
-|CompleteDonePre| after Insert mode completion is done, before clearing
- info
-|CompleteDone| after Insert mode completion is done, after clearing
- info
-
-|User| to be used in combination with ":doautocmd"
-|Signal| after Nvim receives a signal
-
-
-
-The alphabetical list of autocommand events: *autocmd-events-abc*
+
+ *events* *{event}*
+Nvim recognizes the following events. Names are case-insensitive.
*BufAdd*
BufAdd Just after creating a new buffer which is
@@ -642,7 +482,7 @@ CursorHold When the user doesn't press a key for the time
Hint: to force an update of the status lines
use: >
:let &ro = &ro
-
+<
*CursorHoldI*
CursorHoldI Like CursorHold, but in Insert mode. Not
triggered when waiting for another key, e.g.
@@ -860,9 +700,14 @@ InsertEnter Just before starting Insert mode. Also for
The cursor is restored afterwards. If you do
not want that set |v:char| to a non-empty
string.
+ *InsertLeavePre*
+InsertLeavePre Just before leaving Insert mode. Also when
+ using CTRL-O |i_CTRL-O|. Be caseful not to
+ change mode or use `:normal`, it will likely
+ cause trouble.
*InsertLeave*
-InsertLeave When leaving Insert mode. Also when using
- CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
+InsertLeave Just after leaving Insert mode. Also when
+ using CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
*MenuPopup*
MenuPopup Just before showing the popup menu (under the
right mouse button). Useful for adjusting the
@@ -1111,13 +956,13 @@ VimEnter After doing all the startup stuff, including
if v:vim_did_enter
call s:init()
else
- au VimEnter * call s:init()
+ au VimEnter * call s:init()
endif
< *VimLeave*
VimLeave Before exiting Vim, just after writing the
.shada file. Executed only once, like
VimLeavePre.
-< Use |v:dying| to detect an abnormal exit.
+ Use |v:dying| to detect an abnormal exit.
Use |v:exiting| to get the exit code.
Not triggered if |v:dying| is 2 or more.
*VimLeavePre*
@@ -1126,7 +971,7 @@ VimLeavePre Before exiting Vim, just before writing the
if there is a match with the name of what
happens to be the current buffer when exiting.
Mostly useful with a "*" pattern. >
- :autocmd VimLeavePre * call CleanupStuff()
+ :autocmd VimLeavePre * call CleanupStuff()
< Use |v:dying| to detect an abnormal exit.
Use |v:exiting| to get the exit code.
Not triggered if |v:dying| is 2 or more.
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index dcebbc524c..5c67359002 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1615,6 +1615,10 @@ B When joining lines, don't insert a space between two multi-byte
characters. Overruled by the 'M' flag.
1 Don't break a line after a one-letter word. It's broken before it
instead (if possible).
+] Respect textwidth rigorously. With this flag set, no line can be
+ longer than textwidth, unless line-break-prohibition rules make this
+ impossible. Mainly for CJK scripts and works only if 'encoding' is
+ "utf-8".
j Where it makes sense, remove a comment leader when joining lines. For
example, joining:
int i; // the index ~
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index b31177ce0e..f7a281cb88 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -224,6 +224,10 @@ CTRL-[ *c_CTRL-[* *c_<Esc>* *c_Esc*
present in 'cpoptions', start entered command.
Note: If your <Esc> key is hard to hit on your keyboard, train
yourself to use CTRL-[.
+ *c_META* *c_ALT*
+ ALT (|META|) acts like <Esc> if the chord is not mapped.
+ For example <A-x> acts like <Esc>x if <A-x> does not have a
+ command-line mode mapping.
*c_CTRL-C*
CTRL-C quit command-line without executing
@@ -556,6 +560,7 @@ followed by another Vim command:
:lfdo
:make
:normal
+ :perlfile
:promptfind
:promptrepl
:pyfile
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index ce075e1bee..3b5287ee44 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -77,7 +77,9 @@ Options ~
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
*'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed.
*'langnoremap'* Deprecated alias to 'nolangremap'.
+'sessionoptions' Flags "unix", "slash" are ignored and always enabled.
*'vi'*
+'viewoptions' Flags "unix", "slash" are ignored and always enabled.
*'viminfo'* Deprecated alias to 'shada' option.
*'viminfofile'* Deprecated alias to 'shadafile' option.
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index 09c5b7c4ad..aec0178da2 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -103,8 +103,10 @@ Examples:
The provider framework invokes VimL from C. It is composed of two functions
in eval.c:
-- eval_call_provider(name, method, arguments): calls provider#{name}#Call
- with the method and arguments.
+- eval_call_provider(name, method, arguments, discard): calls
+ provider#{name}#Call with the method and arguments. If discard is true, any
+ value returned by the provider will be discarded and and empty value be
+ returned.
- eval_has_provider(name): Checks the `g:loaded_{name}_provider` variable
which must be set to 2 by the provider script to indicate that it is
"enabled and working". Called by |has()| to check if features are available.
diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt
index 7f807b5eee..271b8c2597 100644
--- a/runtime/doc/digraph.txt
+++ b/runtime/doc/digraph.txt
@@ -913,6 +913,7 @@ char digraph hex dec official name ~
‟ 9" 201F 8223 DOUBLE HIGH-REVERSED-9 QUOTATION MARK
† /- 2020 8224 DAGGER
‡ /= 2021 8225 DOUBLE DAGGER
+• oo 2022 8226 BULLET
‥ .. 2025 8229 TWO DOT LEADER
… ,. 2026 8230 HORIZONTAL ELLIPSIS
‰ %0 2030 8240 PER MILLE SIGN
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index efb6272e58..800de63a55 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -38,7 +38,9 @@ List An ordered sequence of items |List|.
Dictionary An associative, unordered array: Each entry has a key and a
value. |Dictionary|
- Example: {'blue': "#0000ff", 'red': "#ff0000"}
+ Examples:
+ {'blue': "#0000ff", 'red': "#ff0000"}
+ #{blue: "#0000ff", red: "#ff0000"}
The Number and String types are converted automatically, depending on how they
are used.
@@ -436,8 +438,14 @@ only appear once. Examples: >
A key is always a String. You can use a Number, it will be converted to a
String automatically. Thus the String '4' and the number 4 will find the same
entry. Note that the String '04' and the Number 04 are different, since the
-Number will be converted to the String '4'. The empty string can be used as a
-key.
+Number will be converted to the String '4'. The empty string can also be used
+as a key.
+ *literal-Dict*
+To avoid having to put quotes around every key the #{} form can be used. This
+does require the key to consist only of ASCII letters, digits, '-' and '_'.
+Example: >
+ let mydict = #{zero: 0, one_key: 1, two-key: 2, 333: 3}
+Note that 333 here is the string "333". Empty keys are not possible with #{}.
A value can be any expression. Using a Dictionary for a value creates a
nested Dictionary: >
@@ -2224,6 +2232,7 @@ inputsecret({prompt} [, {text}])
String like input() but hiding the text
insert({list}, {item} [, {idx}])
List insert {item} in {list} [before {idx}]
+interrupt() none interrupt script execution
invert({expr}) Number bitwise invert
isdirectory({directory}) Number |TRUE| if {directory} is a directory
isinf({expr}) Number determine if {expr} is infinity value
@@ -2287,6 +2296,7 @@ nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr}
nvim_...({args}...) any call nvim |api| functions
or({expr}, {expr}) Number bitwise OR
pathshorten({expr}) String shorten directory names in a path
+perleval({expr}) any evaluate |perl| expression
pow({x}, {y}) Float {x} to the power of {y}
prevnonblank({lnum}) Number line nr of non-blank line <= {lnum}
printf({fmt}, {expr1}...) String format text
@@ -2326,6 +2336,7 @@ repeat({expr}, {count}) String repeat {expr} {count} times
resolve({filename}) String get filename a shortcut points to
reverse({list}) List reverse {list} in-place
round({expr}) Float round off {expr}
+rubyeval({expr}) any evaluate |Ruby| expression
rpcnotify({channel}, {event}[, {args}...])
Sends an |RPC| notification to {channel}
rpcrequest({channel}, {method}[, {args}...])
@@ -2408,7 +2419,8 @@ str2list({expr} [, {utf8}]) List convert each character of {expr} to
str2nr({expr} [, {base}]) Number convert String to Number
strchars({expr} [, {skipcc}]) Number character length of the String {expr}
strcharpart({str}, {start} [, {len}])
- String {len} characters of {str} at {start}
+ String {len} characters of {str} at
+ character {start}
strdisplaywidth({expr} [, {col}]) Number display length of the String {expr}
strftime({format} [, {time}]) String time in specified format
strgetchar({str}, {index}) Number get char {index} from {str}
@@ -2416,8 +2428,9 @@ stridx({haystack}, {needle} [, {start}])
Number index of {needle} in {haystack}
string({expr}) String String representation of {expr} value
strlen({expr}) Number length of the String {expr}
-strpart({str}, {start} [, {len}])
- String {len} characters of {str} at {start}
+strpart({str}, {start} [, {len} [, {chars}]])
+ String {len} bytes/chars of {str} at
+ byte {start}
strridx({haystack}, {needle} [, {start}])
Number last index of {needle} in {haystack}
strtrans({expr}) String translate string to make it printable
@@ -2456,7 +2469,8 @@ tolower({expr}) String the String {expr} switched to lowercase
toupper({expr}) String the String {expr} switched to uppercase
tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
to chars in {tostr}
-trim({text} [, {mask}]) String trim characters in {mask} from {text}
+trim({text} [, {mask} [, {dir}]])
+ String trim characters in {mask} from {text}
trunc({expr}) Float truncate Float {expr}
type({name}) Number type of variable {name}
undofile({name}) String undo file name for {name}
@@ -2905,7 +2919,8 @@ byte2line({byte}) *byte2line()*
byteidx({expr}, {nr}) *byteidx()*
Return byte index of the {nr}'th character in the string
- {expr}. Use zero for the first character, it returns zero.
+ {expr}. Use zero for the first character, it then returns
+ zero.
This function is only useful when there are multibyte
characters, otherwise the returned value is equal to {nr}.
Composing characters are not counted separately, their byte
@@ -3826,7 +3841,7 @@ feedkeys({string} [, {mode}]) *feedkeys()*
stuck, waiting for a character to be typed before the
script continues.
Note that if you manage to call feedkeys() while
- executing commands, thus calling it recursively, the
+ executing commands, thus calling it recursively, then
all typehead will be consumed by the last call.
'!' When used with 'x' will not end Insert mode. Can be
used in a test when a timer is set to exit Insert mode
@@ -4629,7 +4644,7 @@ getloclist({nr},[, {what}]) *getloclist()*
If {what} contains 'filewinid', then returns the id of the
window used to display files from the location list. This
field is applicable only when called from a location list
- window.
+ window. See |location-list-file-window| for more details.
getmatches([{win}]) *getmatches()*
Returns a |List| with all matches previously defined for the
@@ -4720,7 +4735,9 @@ getqflist([{what}]) *getqflist()*
id get information for the quickfix list with
|quickfix-ID|; zero means the id for the
current list or the list specified by "nr"
- idx index of the current entry in the list
+ idx index of the current entry in the quickfix
+ list specified by 'id' or 'nr'.
+ See |quickfix-index|
items quickfix list entries
lines parse a list of lines using 'efm' and return
the resulting entries. Only a |List| type is
@@ -4913,6 +4930,19 @@ getwinpos([{timeout}]) *getwinpos()*
{timeout} can be used to specify how long to wait in msec for
a response from the terminal. When omitted 100 msec is used.
+ Use a longer time for a remote terminal.
+ When using a value less than 10 and no response is received
+ within that time, a previously reported position is returned,
+ if available. This can be used to poll for the position and
+ do some work in the meantime: >
+ while 1
+ let res = getwinpos(1)
+ if res[0] >= 0
+ break
+ endif
+ " Do some work here
+ endwhile
+<
*getwinposx()*
getwinposx() The result is a Number, which is the X coordinate in pixels of
the left hand side of the GUI Vim window. The result will be
@@ -5412,6 +5442,19 @@ insert({list}, {item} [, {idx}]) *insert()*
Note that when {item} is a |List| it is inserted as a single
item. Use |extend()| to concatenate |Lists|.
+interrupt() *interrupt()*
+ Interrupt script execution. It works more or less like the
+ user typing CTRL-C, most commands won't execute and control
+ returns to the user. This is useful to abort execution
+ from lower down, e.g. in an autocommand. Example: >
+ :function s:check_typoname(file)
+ : if fnamemodify(a:file, ':t') == '['
+ : echomsg 'Maybe typo'
+ : call interrupt()
+ : endif
+ :endfunction
+ :au BufWritePre * call s:check_typoname(expand('<amatch>'))
+
invert({expr}) *invert()*
Bitwise invert. The argument is converted to a number. A
List, Dict or Float argument causes an error. Example: >
@@ -6237,6 +6280,7 @@ mode([expr]) Return a string that indicates the current mode.
nov Operator-pending (forced charwise |o_v|)
noV Operator-pending (forced linewise |o_V|)
noCTRL-V Operator-pending (forced blockwise |o_CTRL-V|)
+ CTRL-V is one character
niI Normal using |i_CTRL-O| in |Insert-mode|
niR Normal using |i_CTRL-O| in |Replace-mode|
niV Normal using |i_CTRL-O| in |Virtual-Replace-mode|
@@ -6406,6 +6450,21 @@ pathshorten({expr}) *pathshorten()*
< ~/.c/n/a/file1.vim ~
It doesn't matter if the path exists or not.
+perleval({expr}) *perleval()*
+ Evaluate |perl| expression {expr} and return its result
+ converted to Vim data structures.
+ Numbers and strings are returned as they are (strings are
+ copied though).
+ Lists are represented as Vim |List| type.
+ Dictionaries are represented as Vim |Dictionary| type,
+ non-string keys result in error.
+
+ Note: If you want an array or hash, {expr} must return a
+ reference to it.
+ Example: >
+ :echo perleval('[1 .. 4]')
+< [1, 2, 3, 4]
+
pow({x}, {y}) *pow()*
Return the power of {x} to the exponent {y} as a |Float|.
{x} and {y} must evaluate to a |Float| or a |Number|.
@@ -7012,6 +7071,17 @@ rpcstart({prog}[, {argv}]) *rpcstart()*
< with >
:let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true})
+rubyeval({expr}) *rubyeval()*
+ Evaluate Ruby expression {expr} and return its result
+ converted to Vim data structures.
+ Numbers, floats and strings are returned as they are (strings
+ are copied though).
+ Arrays are represented as Vim |List| type.
+ Hashes are represented as Vim |Dictionary| type.
+ Other objects are represented as strings resulted from their
+ "Object#to_s" method.
+ {only available when compiled with the |+ruby| feature}
+
screenattr({row}, {col}) *screenattr()*
Like |screenchar()|, but return the attribute. This is a rather
arbitrary number that can only be used to compare to the
@@ -7581,16 +7651,22 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
efm errorformat to use when parsing text from
"lines". If this is not present, then the
'errorformat' option value is used.
+ See |quickfix-parse|
id quickfix list identifier |quickfix-ID|
+ idx index of the current entry in the quickfix
+ list specified by 'id' or 'nr'. If set to '$',
+ then the last entry in the list is set as the
+ current entry. See |quickfix-index|
items list of quickfix entries. Same as the {list}
argument.
lines use 'errorformat' to parse a list of lines and
add the resulting entries to the quickfix list
{nr} or {id}. Only a |List| value is supported.
+ See |quickfix-parse|
nr list number in the quickfix stack; zero
means the current quickfix list and "$" means
- the last quickfix list
- title quickfix list title text
+ the last quickfix list.
+ title quickfix list title text. See |quickfix-title|
Unsupported keys in {what} are ignored.
If the "nr" item is not present, then the current quickfix list
is modified. When creating a new quickfix list, "nr" can be
@@ -7737,26 +7813,23 @@ sha256({string}) *sha256()*
shellescape({string} [, {special}]) *shellescape()*
Escape {string} for use as a shell command argument.
- On Windows when 'shellslash' is not set, it
- will enclose {string} in double quotes and double all double
- quotes within {string}.
- Otherwise, it will enclose {string} in single quotes and
- replace all "'" with "'\''".
-
- When the {special} argument is present and it's a non-zero
- Number or a non-empty String (|non-zero-arg|), then special
- items such as "!", "%", "#" and "<cword>" will be preceded by
- a backslash. This backslash will be removed again by the |:!|
- command.
- The "!" character will be escaped (again with a |non-zero-arg|
- {special}) when 'shell' contains "csh" in the tail. That is
- because for csh and tcsh "!" is used for history replacement
- even when inside single quotes.
+ On Windows when 'shellslash' is not set, encloses {string} in
+ double-quotes and doubles all double-quotes within {string}.
+ Otherwise encloses {string} in single-quotes and replaces all
+ "'" with "'\''".
- With a |non-zero-arg| {special} the <NL> character is also
- escaped. When 'shell' containing "csh" in the tail it's
- escaped a second time.
+ If {special} is a ||non-zero-arg|:
+ - Special items such as "!", "%", "#" and "<cword>" will be
+ preceded by a backslash. The backslash will be removed again
+ by the |:!| command.
+ - The <NL> character is escaped.
+
+ If 'shell' contains "csh" in the tail:
+ - The "!" character will be escaped. This is because csh and
+ tcsh use "!" for history replacement even in single-quotes.
+ - The <NL> character is escaped (twice if {special} is
+ a ||non-zero-arg|).
Example of use with a |:!| command: >
:exe '!dir ' . shellescape(expand('<cfile>'), 1)
@@ -8229,15 +8302,13 @@ sqrt({expr}) *sqrt()*
stdioopen({opts}) *stdioopen()*
- In a nvim launched with the |--headless| option, this opens
- stdin and stdout as a |channel|. This function can only be
- invoked once per instance. See |channel-stdio| for more
- information and examples. Note that stderr is not handled by
- this function, see |v:stderr|.
+ With |--headless| this opens stdin and stdout as a |channel|.
+ May be called only once. See |channel-stdio|. stderr is not
+ handled by this function, see |v:stderr|.
- Returns a |channel| ID. Close the stdio descriptors with |chanclose()|.
- Use |chansend()| to send data to stdout, and
- |rpcrequest()| and |rpcnotify()| to communicate over RPC.
+ Close the stdio handles with |chanclose()|. Use |chansend()|
+ to send data to stdout, and |rpcrequest()| and |rpcnotify()|
+ to communicate over RPC.
{opts} is a dictionary with these keys:
|on_stdin| : callback invoked when stdin is written to.
@@ -8245,7 +8316,7 @@ stdioopen({opts}) *stdioopen()*
rpc : If set, |msgpack-rpc| will be used to communicate
over stdio
Returns:
- - The channel ID on success (this is always 1)
+ - |channel-id| on success (value is always 1)
- 0 on invalid arguments
@@ -8424,14 +8495,19 @@ strlen({expr}) The result is a Number, which is the length of the String
{expr} in bytes.
If the argument is a Number it is first converted to a String.
For other types an error is given.
- If you want to count the number of multi-byte characters use
+ If you want to count the number of multibyte characters use
|strchars()|.
Also see |len()|, |strdisplaywidth()| and |strwidth()|.
-strpart({src}, {start} [, {len}]) *strpart()*
+strpart({src}, {start} [, {len} [, {chars}]]) *strpart()*
The result is a String, which is part of {src}, starting from
byte {start}, with the byte length {len}.
- To count characters instead of bytes use |strcharpart()|.
+ When {chars} is present and TRUE then {len} is the number of
+ characters positions (composing characters are not counted
+ separately, thus "1" means one base character and any
+ following composing characters).
+ To count {start} as characters instead of bytes use
+ |strcharpart()|.
When bytes are selected which do not exist, this doesn't
result in an error, the bytes are simply omitted.
@@ -8443,8 +8519,8 @@ strpart({src}, {start} [, {len}]) *strpart()*
strpart("abcdefg", 3) == "defg"
< Note: To get the first character, {start} must be 0. For
- example, to get three bytes under and after the cursor: >
- strpart(getline("."), col(".") - 1, 3)
+ example, to get the character under the cursor: >
+ strpart(getline("."), col(".") - 1, 1, v:true)
<
strridx({haystack}, {needle} [, {start}]) *strridx()*
The result is a Number, which gives the byte index in
@@ -8974,21 +9050,28 @@ tr({src}, {fromstr}, {tostr}) *tr()*
echo tr("<blob>", "<>", "{}")
< returns "{blob}"
-trim({text} [, {mask}]) *trim()*
+trim({text} [, {mask} [, {dir}]]) *trim()*
Return {text} as a String where any character in {mask} is
- removed from the beginning and end of {text}.
+ removed from the beginning and/or end of {text}.
If {mask} is not given, {mask} is all characters up to 0x20,
which includes Tab, space, NL and CR, plus the non-breaking
space character 0xa0.
- This code deals with multibyte characters properly.
-
+ The optional {dir} argument specifies where to remove the
+ characters:
+ 0 remove from the beginning and end of {text}
+ 1 remove only at the beginning of {text}
+ 2 remove only at the end of {text}
+ When omitted both ends are trimmed.
+ This function deals with multibyte characters properly.
Examples: >
echo trim(" some text ")
< returns "some text" >
echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") . "_TAIL"
< returns "RESERVE_TAIL" >
echo trim("rm<Xrm<>X>rrm", "rm<>")
-< returns "Xrm<>X" (characters in the middle are not removed)
+< returns "Xrm<>X" (characters in the middle are not removed) >
+ echo trim(" vim ", " ", 2)
+< returns " vim"
trunc({expr}) *trunc()*
Return the largest integral value with magnitude less than or
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index a384b5f876..203699435b 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -137,7 +137,7 @@ Special issues ~
Programming language support ~
|indent.txt| automatic indenting for C and other languages
-|lsp.txt| Language Server Protocol (LSP)
+|lsp.txt| Language Server Protocol (LSP)
|syntax.txt| syntax highlighting
|filetype.txt| settings done specifically for a type of file
|quickfix.txt| commands for a quick edit-compile-fix cycle
@@ -168,9 +168,9 @@ Versions ~
|vi_diff.txt| Main differences between Vim and Vi
*standard-plugin-list*
Standard plugins ~
+|matchit.txt| Extended |%| matching
|pi_gzip.txt| Reading and writing compressed files
|pi_health.txt| Healthcheck framework
-|pi_matchit.txt| Extended |%| matching
|pi_msgpack.txt| msgpack utilities
|pi_netrw.txt| Reading and writing files over a network
|pi_paren.txt| Highlight matching parens
diff --git a/runtime/doc/if_perl.txt b/runtime/doc/if_perl.txt
new file mode 100644
index 0000000000..f1d07ddb20
--- /dev/null
+++ b/runtime/doc/if_perl.txt
@@ -0,0 +1,268 @@
+*if_perl.txt* Nvim
+
+
+ VIM REFERENCE MANUAL by Jacques Germishuys
+
+The perl Interface to Vim *if_perl* *perl*
+
+See |provider-perl| for more information.
+
+ Type |gO| to see the table of contents.
+
+==============================================================================
+1. Commands *perl-commands*
+
+ *:perl*
+:[range]perl {stmt}
+ Execute perl statement {stmt}. The current package is
+ "main". A simple check if the `:perl` command is
+ working: >
+ :perl print "Hello"
+
+:[range]perl << [endmarker]
+{script}
+{endmarker}
+ Execute perl script {script}. Useful for including
+ perl code in Vim scripts. Requires perl, see
+ |script-here|.
+
+The {endmarker} below the {script} must NOT be preceded by any white space.
+
+If [endmarker] is omitted from after the "<<", a dot '.' must be used after
+{script}, like for the |:append| and |:insert| commands.
+
+Example: >
+ function! MyVimMethod()
+ perl << EOF
+ sub my_vim_method
+ {
+ print "Hello World!\n";
+ }
+ EOF
+ endfunction
+
+To see what version of perl you have: >
+
+ :perl print $^V
+<
+ *:perldo*
+:[range]perldo {cmd} Execute perl command {cmd} for each line in the[range],
+ with $_ being set to the test of each line in turn,
+ without a trailing <EOL>. In addition to $_, $line and
+ $linenr is also set to the line content and line number
+ respectively. Setting $_ will change the text, but note
+ that it is not possible to add or delete lines using
+ this command.
+ The default for [range] is the whole file: "1,$".
+
+Examples:
+>
+ :perldo $_ = reverse($_);
+ :perldo $_ = "".$linenr." => $line";
+
+One can use `:perldo` in conjunction with `:perl` to filter a range using
+perl. For example: >
+
+ :perl << EOF
+ sub perl_vim_string_replace
+ {
+ my $line = shift;
+ my $needle = $vim->eval('@a');
+ my $replacement = $vim->eval('@b');
+ $line =~ s/$needle/$replacement/g;
+ return $line;
+ }
+ EOF
+ :let @a='somevalue'
+ :let @b='newvalue'
+ :'<,'>perldo $_ = perl_vim_string_replace($_)
+<
+ *:perlfile*
+:[range]perlfile {file}
+ Execute the perl script in {file}. The whole
+ argument is used as a single file name.
+
+Both of these commands do essentially the same thing - they execute a piece of
+perl code, with the "current range" set to the given line range.
+
+In the case of :perl, the code to execute is in the command-line.
+In the case of :perlfile, the code to execute is the contents of the given file.
+
+perl commands cannot be used in the |sandbox|.
+
+To pass arguments you need to set @ARGV explicitly. Example: >
+
+ :perl @ARGV = ("foo", "bar");
+ :perlfile myscript.pl
+
+Here are some examples *perl-examples* >
+
+ :perl print "Hello"
+ :perl $current->line (uc ($current->line))
+ :perl my $str = $current->buffer->[42]; print "Set \$str to: $str"
+
+Note that changes (such as the "use" statements) persist from one command
+to the next.
+
+==============================================================================
+2. The VIM module *perl-vim*
+
+Perl code gets all of its access to Neovim via the "VIM" module.
+
+Overview >
+ print "Hello" # displays a message
+ VIM::Msg("Hello") # displays a message
+ VIM::SetOption("ai") # sets a vim option
+ $nbuf = VIM::Buffers() # returns the number of buffers
+ @buflist = VIM::Buffers() # returns array of all buffers
+ $mybuf = (VIM::Buffers('a.c'))[0] # returns buffer object for 'a.c'
+ @winlist = VIM::Windows() # returns array of all windows
+ $nwin = VIM::Windows() # returns the number of windows
+ ($success, $v) = VIM::Eval('&path') # $v: option 'path', $success: 1
+ ($success, $v) = VIM::Eval('&xyz') # $v: '' and $success: 0
+ $v = VIM::Eval('expand("<cfile>")') # expands <cfile>
+ $curwin->SetHeight(10) # sets the window height
+ @pos = $curwin->Cursor() # returns (row, col) array
+ @pos = (10, 10)
+ $curwin->Cursor(@pos) # sets cursor to @pos
+ $curwin->Cursor(10,10) # sets cursor to row 10 col 10
+ $mybuf = $curwin->Buffer() # returns the buffer object for window
+ $curbuf->Name() # returns buffer name
+ $curbuf->Number() # returns buffer number
+ $curbuf->Count() # returns the number of lines
+ $l = $curbuf->Get(10) # returns line 10
+ @l = $curbuf->Get(1 .. 5) # returns lines 1 through 5
+ $curbuf->Delete(10) # deletes line 10
+ $curbuf->Delete(10, 20) # delete lines 10 through 20
+ $curbuf->Append(10, "Line") # appends a line
+ $curbuf->Append(10, "L1", "L2", "L3") # appends 3 lines
+ @l = ("L1", "L2", "L3")
+ $curbuf->Append(10, @l) # appends L1, L2 and L3
+ $curbuf->Set(10, "Line") # replaces line 10
+ $curbuf->Set(10, "Line1", "Line2") # replaces lines 10 and 11
+ $curbuf->Set(10, @l) # replaces 3 lines
+
+Module Functions:
+
+ *perl-Msg*
+VIM::Msg({msg})
+ Displays the message {msg}.
+
+ *perl-SetOption*
+VIM::SetOption({arg}) Sets a vim option. {arg} can be any argument that the
+ ":set" command accepts. Note that this means that no
+ spaces are allowed in the argument! See |:set|.
+
+ *perl-Buffers*
+VIM::Buffers([{bn}...]) With no arguments, returns a list of all the buffers
+ in an array context or returns the number of buffers
+ in a scalar context. For a list of buffer names or
+ numbers {bn}, returns a list of the buffers matching
+ {bn}, using the same rules as Vim's internal
+ |bufname()| function.
+ WARNING: the list becomes invalid when |:bwipe| is
+ used.
+
+ *perl-Windows*
+VIM::Windows([{wn}...]) With no arguments, returns a list of all the windows
+ in an array context or returns the number of windows
+ in a scalar context. For a list of window numbers
+ {wn}, returns a list of the windows with those
+ numbers.
+ WARNING: the list becomes invalid when a window is
+ closed.
+
+ *perl-DoCommand*
+VIM::DoCommand({cmd}) Executes Ex command {cmd}.
+
+ *perl-Eval*
+VIM::Eval({expr}) Evaluates {expr} and returns (success, value) in list
+ context or just value in scalar context.
+ success=1 indicates that val contains the value of
+ {expr}; success=0 indicates a failure to evaluate
+ the expression. '@x' returns the contents of register
+ x, '&x' returns the value of option x, 'x' returns the
+ value of internal |variables| x, and '$x' is equivalent
+ to perl's $ENV{x}. All |functions| accessible from
+ the command-line are valid for {expr}.
+ A |List| is turned into a string by joining the items
+ and inserting line breaks.
+
+==============================================================================
+3. VIM::Buffer objects *perl-buffer*
+
+Methods:
+
+ *perl-Buffer-Name*
+Name() Returns the filename for the Buffer.
+
+ *perl-Buffer-Number*
+Number() Returns the number of the Buffer.
+
+ *perl-Buffer-Count*
+Count() Returns the number of lines in the Buffer.
+
+ *perl-Buffer-Get*
+Get({lnum}, {lnum}?, ...)
+ Returns a text string of line {lnum} in the Buffer
+ for each {lnum} specified. An array can be passed
+ with a list of {lnum}'s specified.
+
+ *perl-Buffer-Delete*
+Delete({lnum}, {lnum}?)
+ Deletes line {lnum} in the Buffer. With the second
+ {lnum}, deletes the range of lines from the first
+ {lnum} to the second {lnum}.
+
+ *perl-Buffer-Append*
+Append({lnum}, {line}, {line}?, ...)
+ Appends each {line} string after Buffer line {lnum}.
+ The list of {line}s can be an array.
+
+ *perl-Buffer-Set*
+Set({lnum}, {line}, {line}?, ...)
+ Replaces one or more Buffer lines with specified
+ {lines}s, starting at Buffer line {lnum}. The list of
+ {line}s can be an array. If the arguments are
+ invalid, replacement does not occur.
+
+==============================================================================
+4. VIM::Window objects *perl-window*
+
+Methods:
+ *perl-Window-SetHeight*
+SetHeight({height})
+ Sets the Window height to {height}, within screen
+ limits.
+
+ *perl-Window-GetCursor*
+Cursor({row}?, {col}?)
+ With no arguments, returns a (row, col) array for the
+ current cursor position in the Window. With {row} and
+ {col} arguments, sets the Window's cursor position to
+ {row} and {col}. Note that {col} is numbered from 0,
+ Perl-fashion, and thus is one less than the value in
+ Vim's ruler.
+
+Buffer() *perl-Window-Buffer*
+ Returns the Buffer object corresponding to the given
+ Window.
+
+==============================================================================
+5. Lexical variables *perl-globals*
+
+There are multiple lexical variables.
+
+$curwin The current Window object.
+$curbuf The current Buffer object.
+$vim A Neovim::Ext object.
+$nvim The same as $nvim.
+$current A Neovim::Ext::Current object.
+
+These are also available via the "main" package:
+
+$main::curwin The current Window object.
+$main::curbuf The current Buffer object.
+
+==============================================================================
+ vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt
index 6468e4c81e..c8d2409549 100644
--- a/runtime/doc/if_ruby.txt
+++ b/runtime/doc/if_ruby.txt
@@ -136,7 +136,7 @@ self[{n}] Returns the buffer object for the number {n}. The first number
Methods:
-name Returns the name of the buffer.
+name Returns the full name of the buffer.
number Returns the number of the buffer.
count Returns the number of lines.
length Returns the number of lines.
@@ -172,6 +172,7 @@ height = {n} Sets the window height to {n}.
width Returns the width of the window.
width = {n} Sets the window width to {n}.
cursor Returns a [row, col] array for the cursor position.
+ First line number is 1 and first column number is 0.
cursor = [{row}, {col}]
Sets the cursor position to {row} and {col}.
@@ -184,4 +185,13 @@ $curwin The current window object.
$curbuf The current buffer object.
==============================================================================
+6. rubyeval() Vim function *ruby-rubyeval*
+
+To facilitate bi-directional interface, you can use |rubyeval()| function to
+evaluate Ruby expressions and pass their values to Vim script.
+
+The Ruby value "true", "false" and "nil" are converted to v:true, v:false and
+v:null, respectively.
+
+==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index bdab10c0e4..afcacad460 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1441,6 +1441,9 @@ tag command action ~
|:packloadall| :packl[oadall] load all packages under 'packpath'
|:pclose| :pc[lose] close preview window
|:pedit| :ped[it] edit file in the preview window
+|:perl| :perl execute perl command
+|:perldo| :perldo execute perl command for each line
+|:perfile| :perlfile execute perl script file
|:print| :p[rint] print lines
|:profdel| :profd[el] stop profiling a function or script
|:profile| :prof[ile] profiling functions and scripts
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index e53af5074b..c4b93a2a27 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -42,9 +42,9 @@ char action ~
abbreviation.
Note: If your <Esc> key is hard to hit, try CTRL-[ instead.
*i_META* *i_ALT*
- ALT (|META|) acts like <Esc> if the chord is not mapped.
+ ALT (|META|) acts like <Esc> if the chord is not mapped.
For example <A-x> acts like <Esc>x if <A-x> does not have an
- insert-mode mapping.
+ insert-mode mapping.
*i_CTRL-C*
CTRL-C Quit insert mode, go back to Normal mode. Do not check for
abbreviations. Does not trigger the |InsertLeave| autocommand
diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt
index 3c3753df78..d858985e3f 100644
--- a/runtime/doc/intro.txt
+++ b/runtime/doc/intro.txt
@@ -4,21 +4,15 @@
NVIM REFERENCE MANUAL
-Introduction to Vim *ref* *reference*
+Nvim *ref* *reference*
Type |gO| to see the table of contents.
==============================================================================
Introduction *intro*
-Vim stands for Vi IMproved. It used to be Vi IMitation, but there are so many
-improvements that a name change was appropriate. Vim is a text editor which
-includes almost all the commands from the Unix program "Vi" and a lot of new
-ones. It is very useful for editing programs and other plain text.
- All commands are given with the keyboard. This has the advantage that you
-can keep your fingers on the keyboard and your eyes on the screen. For those
-who want it, there is mouse support and a GUI version with scrollbars and
-menus (see |gui.txt|).
+Vim is a text editor which includes most commands from the Unix program "Vi"
+and many new ones.
An overview of this manual can be found in the file "help.txt", |help.txt|.
It can be accessed from within Vim with the <Help> or <F1> key and with the
@@ -28,16 +22,15 @@ is not located in the default place. You can jump to subjects like with tags:
Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.
*pronounce*
-Vim is pronounced as one word, like Jim. Nvim is pronounced as N-vim, or,
-continuing with the Jim simile, N-Jim, which sounds like Ninja.
+Vim is pronounced as one word, like Jim. So Nvim is N-Jim, which sounds like
+"Ninja". Starting Nvim is like performing a roundhouse kick.
-This manual is a reference for all the Vim commands and options. This is not
-an introduction to the use of Vi or Vim, it gets a bit complicated here and
-there. For beginners, there is a hands-on |tutor|. To learn using Vim, read
-the user manual |usr_toc.txt|.
+This manual is a reference for all Nvim editor and API features. It is not an
+introduction; instead for beginners, there is a hands-on |tutor| and a user
+manual |usr_toc.txt|.
*book*
-There are many books on Vi and Vim. We recommend these books:
+There are many books on Vi and Vim. We recommend:
"Practical Vim" by Drew Neil
"Modern Vim" by Drew Neil
@@ -48,7 +41,7 @@ tasks with Vim. "Modern Vim" explores new features in Nvim and Vim 8.
"Vim - Vi Improved" by Steve Oualline
-This is the first book dedicated to Vim. Parts of it were included in the
+This was the first book dedicated to Vim. Parts of it were included in the
user manual. |frombook| ISBN: 0735710015
For more information try one of these:
https://iccf-holland.org/click5.html
@@ -63,11 +56,9 @@ Nvim on the interwebs *internet*
Nvim FAQ: https://github.com/neovim/neovim/wiki/FAQ
Downloads: https://github.com/neovim/neovim/releases
Vim FAQ: https://vimhelp.appspot.com/vim_faq.txt.html
- Vim home page: https://www.vim.org/
- *bugs* *bug-report* *bugreport.vim* *feature-request*
-
+ *bugs* *bug-report*
Report bugs and request features here:
https://github.com/neovim/neovim/issues
@@ -97,7 +88,7 @@ Neovim development is funded separately from Vim:
https://neovim.io/#sponsor
==============================================================================
-Credits *credits* *author* *Bram* *Moolenaar*
+Credits *credits*
Most of Vim was written by Bram Moolenaar <Bram@vim.org>.
@@ -185,25 +176,21 @@ the ideas from all these people: They keep Vim alive!
*love* *peace* *friendship* *gross-national-happiness*
-In this documentation there are several references to other versions of Vi:
+Documentation may refer to other versions of Vi:
*Vi* *vi*
Vi "the original". Without further remarks this is the version
of Vi that appeared in Sun OS 4.x. ":version" returns
- "Version 3.7, 6/7/85". Sometimes other versions are referred
- to. Only runs under Unix. Source code only available with a
- license.
+ "Version 3.7, 6/7/85". Source code only available with a license.
*Nvi*
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
Very good compatibility with the original Vi, with a few extensions.
The version used is 1.79. ":version" returns "Version 1.79
- (10/23/96)". There has been no release the last few years, although
- there is a development version 1.81.
- Source code is freely available.
+ (10/23/96)". Source code is freely available.
*Elvis*
Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't
- as flexible as Vim.
- The version used is 2.1. It is still being developed. Source code is
- freely available.
+ as flexible as Vim. Source code is freely available.
+
+Vim Nvim is based on Vim. https://www.vim.org/
==============================================================================
Notation *notation*
@@ -387,37 +374,26 @@ notation meaning equivalent decimal value(s) ~
<D-…> command-key or "super" key *<D-*
-----------------------------------------------------------------------
-Note: The shifted cursor keys, the help key, and the undo key are only
-available on a few terminals.
-
-Note: There are two codes for the delete key. 127 is the decimal ASCII value
-for the delete key, which is always recognized. Some delete keys send another
-value, in which case this value is obtained from the |terminfo| entry "key_dc".
-Both values have the same effect.
+Note:
-Note: The keypad keys are used in the same way as the corresponding "normal"
-keys. For example, <kHome> has the same effect as <Home>. If a keypad key
-sends the same raw key code as its non-keypad equivalent, it will be
-recognized as the non-keypad code. For example, when <kHome> sends the same
-code as <Home>, when pressing <kHome> Vim will think <Home> was pressed.
-Mapping <kHome> will not work then.
-
-Note: If numlock is on, the |TUI| receives plain ASCII values, so
-mappings to <k0> - <k9> and <kPoint> will not work.
-
-Note: Nvim supports mapping multibyte chars with modifiers such as `<M-ä>`.
-Which combinations actually are usable depends on the terminal emulator or GUI.
+- Availability of some keys (<Help>, <S-Right>, …) depends on the UI or host
+ terminal.
+- If numlock is on the |TUI| receives plain ASCII values, so mapping <k0>,
+ <k1>, ..., <k9> and <kPoint> will not work.
+- Nvim supports mapping multibyte chars with modifiers such as `<M-ä>`. Which
+ combinations actually work depends on the the UI or host terminal.
+- When a key is pressed using a meta or alt modifier and no mapping exists
+ for that keypress, Nvim behaves as though <Esc> was pressed before the key.
*<>*
Examples are often given in the <> notation. Sometimes this is just to make
clear what you need to type, but often it can be typed literally, e.g., with
the ":map" command. The rules are:
- 1. Any printable characters are typed directly, except backslash and '<'
- 2. A backslash is represented with "\\", double backslash, or "<Bslash>".
- 3. A real '<' is represented with "\<" or "<lt>". When there is no
- confusion possible, a '<' can be used directly.
- 4. "<key>" means the special key typed. This is the notation explained in
- the table above. A few examples:
+ 1. Printable characters are typed directly, except backslash and "<"
+ 2. Backslash is represented with "\\", double backslash, or "<Bslash>".
+ 3. Literal "<" is represented with "\<" or "<lt>". When there is no
+ confusion possible, "<" can be used directly.
+ 4. "<key>" means the special key typed (see the table above). Examples:
<Esc> Escape key
<C-G> CTRL-G
<Up> cursor up key
@@ -437,11 +413,6 @@ one always works.
To get a literal "<lt>" in a mapping: >
:map <C-L> <lt>lt>
-For mapping, abbreviation and menu commands you can then copy-paste the
-examples and use them directly. Or type them literally, including the '<' and
-'>' characters. This does NOT work for other commands, like ":set" and
-":autocmd"!
-
==============================================================================
Modes, introduction *vim-modes-intro* *vim-modes*
@@ -599,7 +570,7 @@ Q or gQ Switch to Ex mode. This is like typing ":" commands
Use the ":vi" command |:visual| to exit this mode.
==============================================================================
-The window contents *window-contents*
+Window contents *window-contents*
In Normal mode and Insert/Replace mode the screen window will show the current
contents of the buffer: What You See Is What You Get. There are two
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index b934d2dfa0..33d65406a1 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -4,7 +4,7 @@
NVIM REFERENCE MANUAL
-LSP client/framework *lsp*
+LSP client/framework *lsp* *LSP*
Nvim supports the Language Server Protocol (LSP), which means it acts as
a client to LSP servers and includes a Lua framework `vim.lsp` for building
@@ -23,14 +23,14 @@ QUICKSTART *lsp-quickstart*
Nvim provides a LSP client, but the servers are provided by third parties.
Follow these steps to get LSP features:
- 1. Install the nvim-lsp plugin. It provides common configuration for
+ 1. Install the nvim-lspconfig plugin. It provides common configuration for
various servers so you can get started quickly.
- https://github.com/neovim/nvim-lsp
+ https://github.com/neovim/nvim-lspconfig
2. Install a language server. Try ":LspInstall <tab>" or use your system
package manager to install the relevant language server:
https://microsoft.github.io/language-server-protocol/implementors/servers/
3. Add `nvim_lsp.xx.setup{…}` to your vimrc, where "xx" is the name of the
- relevant config. See the nvim-lsp README for details.
+ relevant config. See the nvim-lspconfig README for details.
To check LSP clients attached to the current buffer: >
@@ -39,9 +39,10 @@ To check LSP clients attached to the current buffer: >
*lsp-config*
Inline diagnostics are enabled automatically, e.g. syntax errors will be
annotated in the buffer. But you probably want to use other features like
-go-to-definition, hover, etc. Example config: >
+go-to-definition, hover, etc. Full list of features in |vim.lsp.buf|.
+
+Example config: >
- nnoremap <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR>
nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
nnoremap <silent> gD <cmd>lua vim.lsp.buf.implementation()<CR>
@@ -50,6 +51,9 @@ go-to-definition, hover, etc. Example config: >
nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR>
nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
+ nnoremap <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR>
+
+Note: Language servers may have limited support for these features.
Nvim provides the |vim.lsp.omnifunc| 'omnifunc' handler which allows
|i_CTRL-X_CTRL-O| to consume LSP completion. Example config (note the use of
@@ -353,9 +357,6 @@ buf_get_clients({bufnr}) *vim.lsp.buf_get_clients()*
{bufnr} (optional, number): Buffer handle, or 0 for
current
-buf_get_full_text({bufnr}) *vim.lsp.buf_get_full_text()*
- TODO: Documentation
-
buf_is_attached({bufnr}, {client_id}) *vim.lsp.buf_is_attached()*
Checks if a buffer is attached for a particular client.
@@ -416,71 +417,69 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
error, returns `(nil, err)` where `err` is a string
describing the failure reason.
-cancel_request({id}) *vim.lsp.cancel_request()*
- TODO: Documentation
-
client() *vim.lsp.client*
- LSP client object.
+ LSP client object. You can get an active client object via
+ |vim.lsp.get_client_by_id()| or
+ |vim.lsp.get_active_clients()|.
• Methods:
- • request(method, params, [callback]) Send a request to the
- server. If callback is not specified, it will use
+ • request(method, params, [callback], bufnr) Sends a request
+ to the server. This is a thin wrapper around
+ {client.rpc.request} with some additional checking. If
+ {callback} is not specified, it will use
{client.callbacks} to try to find a callback. If one is
- not found there, then an error will occur. This is a thin
- wrapper around {client.rpc.request} with some additional
- checking. Returns a boolean to indicate if the
- notification was successful. If it is false, then it will
- always be false (the client has shutdown). If it was
- successful, then it will return the request id as the
- second result. You can use this with `notify("$/cancel", {
- id = request_id })` to cancel the request. This helper is
- made automatically with |vim.lsp.buf_request()| Returns:
- status, [client_id]
- • notify(method, params) This is just {client.rpc.notify}()
- Returns a boolean to indicate if the notification was
- successful. If it is false, then it will always be false
- (the client has shutdown). Returns: status
- • cancel_request(id) This is just
- {client.rpc.notify}("$/cancelRequest", { id = id })
- Returns the same as `notify()` .
- • stop([force]) Stop a client, optionally with force. By
+ not found there, then an error will occur. Returns:
+ {status}, {[client_id]}. {status} is a boolean indicating
+ if the notification was successful. If it is `false` ,
+ then it will always be `false` (the client has shutdown).
+ If {status} is `true` , the function returns {request_id}
+ as the second result. You can use this with
+ `client.cancel_request(request_id)` to cancel the request.
+ • notify(method, params) Sends a notification to an LSP
+ server. Returns: a boolean to indicate if the notification
+ was successful. If it is false, then it will always be
+ false (the client has shutdown).
+ • cancel_request(id) Cancels a request with a given request
+ id. Returns: same as `notify()` .
+ • stop([force]) Stops a client, optionally with force. By
default, it will just ask the server to shutdown without
force. If you request to stop a client which has
previously been requested to shutdown, it will
automatically escalate and force shutdown.
- • is_stopped() Returns true if the client is fully stopped.
+ • is_stopped() Checks whether a client is stopped. Returns:
+ true if the client is fully stopped.
+ • on_attach(bufnr) Runs the on_attach function from the
+ client's config if it was defined.
• Members
- • id (number): The id allocated to the client.
- • name (string): If a name is specified on creation, that
+ • {id} (number): The id allocated to the client.
+ • {name} (string): If a name is specified on creation, that
will be used. Otherwise it is just the client id. This is
used for logs and messages.
- • offset_encoding (string): The encoding used for
+ • {rpc} (table): RPC client object, for low level
+ interaction with the client. See |vim.lsp.rpc.start()|.
+ • {offset_encoding} (string): The encoding used for
communicating with the server. You can modify this in the
- `on_init` method before text is sent to the server.
- • callbacks (table): The callbacks used by the client as
+ `config` 's `on_init` method before text is sent to the
+ server.
+ • {callbacks} (table): The callbacks used by the client as
described in |lsp-callbacks|.
- • config (table): copy of the table that was passed by the
+ • {config} (table): copy of the table that was passed by the
user to |vim.lsp.start_client()|.
- • server_capabilities (table): Response from the server sent
- on `initialize` describing the server's capabilities.
- • resolved_capabilities (table): Normalized table of
+ • {server_capabilities} (table): Response from the server
+ sent on `initialize` describing the server's capabilities.
+ • {resolved_capabilities} (table): Normalized table of
capabilities that we have detected based on the initialize
response from the server in `server_capabilities` .
client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
- TODO: Documentation
+ Checks whether a client is stopped.
- *vim.lsp.define_default_sign()*
-define_default_sign({name}, {properties})
- TODO: Documentation
-
-err_message({...}) *vim.lsp.err_message()*
- TODO: Documentation
+ Parameters: ~
+ {client_id} (Number)
- *vim.lsp.for_each_buffer_client()*
-for_each_buffer_client({bufnr}, {callback})
- TODO: Documentation
+ Return: ~
+ true if client is stopped, false otherwise.
get_active_clients() *vim.lsp.get_active_clients()*
Gets all active clients.
@@ -489,8 +488,8 @@ get_active_clients() *vim.lsp.get_active_clients()*
Table of |vim.lsp.client| objects
get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
- Gets an active client by id, or nil if the id is invalid or
- the client is not yet initialized.
+ Gets a client by id, or nil if the id is invalid.
+ The returned client may not yet be fully initialized.
Parameters: ~
{client_id} client id number
@@ -499,25 +498,10 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
|vim.lsp.client| object, or nil
get_log_path() *vim.lsp.get_log_path()*
- TODO: Documentation
-
-initialize() *vim.lsp.initialize()*
- TODO: Documentation
-
-is_dir({filename}) *vim.lsp.is_dir()*
- TODO: Documentation
-
-is_stopped() *vim.lsp.is_stopped()*
- TODO: Documentation
+ Gets the path of the logfile used by the LSP client.
-next_client_id() *vim.lsp.next_client_id()*
- TODO: Documentation
-
-notification({method}, {params}) *vim.lsp.notification()*
- TODO: Documentation
-
-notify({...}) *vim.lsp.notify()*
- TODO: Documentation
+ Return: ~
+ (String) Path to logfile.
omnifunc({findstart}, {base}) *vim.lsp.omnifunc()*
Implements 'omnifunc' compatible LSP completion.
@@ -538,30 +522,6 @@ omnifunc({findstart}, {base}) *vim.lsp.omnifunc()*
|complete-items|
|CompleteDone|
-on_error({code}, {err}) *vim.lsp.on_error()*
- TODO: Documentation
-
-on_exit({code}, {signal}) *vim.lsp.on_exit()*
- TODO: Documentation
-
-once({fn}) *vim.lsp.once()*
- TODO: Documentation
-
-optional_validator({fn}) *vim.lsp.optional_validator()*
- TODO: Documentation
-
-request({method}, {params}, {callback}, {bufnr}) *vim.lsp.request()*
- TODO: Documentation
-
-resolve_bufnr({bufnr}) *vim.lsp.resolve_bufnr()*
- TODO: Documentation
-
-resolve_callback({method}) *vim.lsp.resolve_callback()*
- TODO: Documentation
-
-server_request({method}, {params}) *vim.lsp.server_request()*
- TODO: Documentation
-
set_log_level({level}) *vim.lsp.set_log_level()*
Sets the global log level for LSP logging.
@@ -582,6 +542,9 @@ start_client({config}) *vim.lsp.start_client()*
Parameters `cmd` and `root_dir` are required.
+ The following parameters describe fields in the {config}
+ table.
+
Parameters: ~
{root_dir} (required, string) Directory where the
LSP server will base its rootUri on
@@ -612,13 +575,13 @@ start_client({config}) *vim.lsp.start_client()*
array.
{callbacks} Map of language server method names to `function(err, method, params,
client_id)` handler. Invoked for:
- • Notifications from the server, where
+ • Notifications to the server, where
`err` will always be `nil` .
- • Requests initiated by the server. For
- these you can respond by returning
- two values: `result, err` where err
- must be shaped like a RPC error, i.e.
- `{ code, message, data? }` . Use
+ • Requests by the server. For these you
+ can respond by returning two values:
+ `result, err` where err must be
+ shaped like a RPC error, i.e. `{
+ code, message, data? }` . Use
|vim.lsp.rpc_response_error()| to
help with this.
• Default callback for client requests
@@ -647,8 +610,9 @@ start_client({config}) *vim.lsp.start_client()*
where `params` contains the parameters
being sent to the server and `config`
is the config that was passed to
- `start_client()` . You can use this to
- modify parameters before they are sent.
+ |vim.lsp.start_client()|. You can use
+ this to modify parameters before they
+ are sent.
{on_init} Callback (client, initialize_result)
invoked after LSP "initialize", where
`result` is a table of `capabilities`
@@ -680,9 +644,6 @@ start_client({config}) *vim.lsp.start_client()*
error). Use `on_init` to do any actions once the client
has been initialized.
-stop({force}) *vim.lsp.stop()*
- TODO: Documentation
-
stop_client({client_id}, {force}) *vim.lsp.stop_client()*
Stops a client(s).
@@ -690,7 +651,7 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
object. To stop all clients:
>
- vim.lsp.stop_client(lsp.get_active_clients())
+ vim.lsp.stop_client(vim.lsp.get_active_clients())
<
By default asks the server to shutdown, unless stop was
@@ -702,26 +663,10 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
thereof
{force} boolean (optional) shutdown forcefully
- *vim.lsp.text_document_did_open_handler()*
-text_document_did_open_handler({bufnr}, {client})
- TODO: Documentation
-
-unsupported_method({method}) *vim.lsp.unsupported_method()*
- TODO: Documentation
-
-validate_client_config({config}) *vim.lsp.validate_client_config()*
- TODO: Documentation
-
-validate_encoding({encoding}) *vim.lsp.validate_encoding()*
- TODO: Documentation
-
==============================================================================
Lua module: vim.lsp.protocol *lsp-protocol*
-ifnil({a}, {b}) *vim.lsp.protocol.ifnil()*
- TODO: Documentation
-
*vim.lsp.protocol.make_client_capabilities()*
make_client_capabilities()
Gets a new ClientCapabilities object describing the LSP client
@@ -739,28 +684,38 @@ resolve_capabilities({server_capabilities})
characters to match in a path segment (e.g., `example.[!0-9]`
to match on `example.a` , `example.b` , but not `example.0` )
- *vim.lsp.protocol.transform_schema_comments()*
-transform_schema_comments()
- TODO: Documentation
-
- *vim.lsp.protocol.transform_schema_to_table()*
-transform_schema_to_table()
- TODO: Documentation
-
==============================================================================
Lua module: vim.lsp.buf *lsp-buf*
clear_references() *vim.lsp.buf.clear_references()*
- TODO: Documentation
+ Removes document highlights from current buffer.
code_action({context}) *vim.lsp.buf.code_action()*
- TODO: Documentation
+ Selects a code action from the input list that is available at
+ the current cursor position.
+
+ Parameters: ~
+ {context} (table, optional) Valid `CodeActionContext`
+ object
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
completion({context}) *vim.lsp.buf.completion()*
Retrieves the completion items at the current cursor position.
Can only be called in Insert mode.
+ Parameters: ~
+ {context} (context support not yet implemented)
+ Additional information about the context in
+ which a completion was triggered (how it was
+ triggered, and by which trigger character, if
+ applicable)
+
+ See also: ~
+ |vim.lsp.protocol.constants.CompletionTriggerKind|
+
declaration() *vim.lsp.buf.declaration()*
Jumps to the declaration of the symbol under the cursor.
@@ -782,22 +737,41 @@ document_symbol() *vim.lsp.buf.document_symbol()*
window.
execute_command({command}) *vim.lsp.buf.execute_command()*
- TODO: Documentation
+ Executes an LSP server command.
+
+ Parameters: ~
+ {command} A valid `ExecuteCommandParams` object
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
formatting({options}) *vim.lsp.buf.formatting()*
Formats the current buffer.
- The optional {options} table can be used to specify
- FormattingOptions, a list of which is available at https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting . Some unspecified options will be automatically derived from
- the current Neovim options.
+ Parameters: ~
+ {options} (optional, table) Can be used to specify
+ FormattingOptions. Some unspecified options
+ will be automatically derived from the current
+ Neovim options.
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting
*vim.lsp.buf.formatting_sync()*
formatting_sync({options}, {timeout_ms})
- Perform |vim.lsp.buf.formatting()| synchronously.
+ Performs |vim.lsp.buf.formatting()| synchronously.
Useful for running on save, to make sure buffer is formatted
prior to being saved. {timeout_ms} is passed on to
- |vim.lsp.buf_request_sync()|.
+ |vim.lsp.buf_request_sync()|. Example:
+>
+
+ vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]]
+<
+
+ Parameters: ~
+ {options} Table with valid `FormattingOptions` entries
+ {timeout_ms} (number) Request timeout
hover() *vim.lsp.buf.hover()*
Displays hover information about the symbol under the cursor
@@ -808,29 +782,61 @@ implementation() *vim.lsp.buf.implementation()*
Lists all the implementations for the symbol under the cursor
in the quickfix window.
-npcall({fn}, {...}) *vim.lsp.buf.npcall()*
- TODO: Documentation
+incoming_calls() *vim.lsp.buf.incoming_calls()*
+ Lists all the call sites of the symbol under the cursor in the
+ |quickfix| window. If the symbol can resolve to multiple
+ items, the user can pick one in the |inputlist|.
+
+outgoing_calls() *vim.lsp.buf.outgoing_calls()*
+ Lists all the items that are called by the symbol under the
+ cursor in the |quickfix| window. If the symbol can resolve to
+ multiple items, the user can pick one in the |inputlist|.
+
+ *vim.lsp.buf.range_code_action()*
+range_code_action({context}, {start_pos}, {end_pos})
+ Performs |vim.lsp.buf.code_action()| for a given range.
-ok_or_nil({status}, {...}) *vim.lsp.buf.ok_or_nil()*
- TODO: Documentation
+ Parameters: ~
+ {context} (table, optional) Valid `CodeActionContext`
+ object
+ {start_pos} ({number, number}, optional) mark-indexed
+ position. Defaults to the start of the last
+ visual selection.
+ {end_pos} ({number, number}, optional) mark-indexed
+ position. Defaults to the end of the last
+ visual selection.
*vim.lsp.buf.range_formatting()*
range_formatting({options}, {start_pos}, {end_pos})
- TODO: Documentation
+ Formats a given range.
+
+ Parameters: ~
+ {options} Table with valid `FormattingOptions` entries.
+ {start_pos} ({number, number}, optional) mark-indexed
+ position. Defaults to the end of the last
+ visual selection.
references({context}) *vim.lsp.buf.references()*
Lists all the references to the symbol under the cursor in the
quickfix window.
+ Parameters: ~
+ {context} (table) Context for the request
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
+
rename({new_name}) *vim.lsp.buf.rename()*
- Renames all references to the symbol under the cursor. If
- {new_name} is not provided, the user will be prompted for a
- new name using |input()|.
+ Renames all references to the symbol under the cursor.
-request({method}, {params}, {callback}) *vim.lsp.buf.request()*
- TODO: Documentation
+ Parameters: ~
+ {new_name} (string) If not provided, the user will be
+ prompted for a new name using |input()|.
server_ready() *vim.lsp.buf.server_ready()*
+ Checks whether the language servers attached to the current
+ buffer are ready.
+
Return: ~
`true` if server responds.
@@ -846,115 +852,75 @@ workspace_symbol({query}) *vim.lsp.buf.workspace_symbol()*
Lists all symbols in the current workspace in the quickfix
window.
- The list is filtered against the optional argument {query}; if
- the argument is omitted from the call, the user is prompted to
- enter a string on the command line. An empty string means no
- filtering is done.
-
-incoming_calls() *vim.lsp.buf.incoming_calls()*
- Lists all the call sites of the symbol under the cursor in the
- |quickfix| window. If the symbol can resolve to multiple
- items, the user can pick one in the |inputlist|.
-
-outgoing_calls() *vim.lsp.buf.outgoing_calls()*
- Lists all the items that are called by the symbol under the
- cursor in the |quickfix| window. If the symbol can resolve to
- multiple items, the user can pick one in the |inputlist|.
-
-
-==============================================================================
-Lua module: vim.lsp.callbacks *lsp-callbacks*
-
-err_message({...}) *vim.lsp.callbacks.err_message()*
- TODO: Documentation
+ The list is filtered against {query}; if the argument is
+ omitted from the call, the user is prompted to enter a string
+ on the command line. An empty string means no filtering is
+ done.
- *vim.lsp.callbacks.location_callback()*
-location_callback({_}, {method}, {result})
- TODO: Documentation
+ Parameters: ~
+ {query} (string, optional)
==============================================================================
Lua module: vim.lsp.log *lsp-log*
get_filename() *vim.lsp.log.get_filename()*
- TODO: Documentation
+ Returns the log filename.
-path_join({...}) *vim.lsp.log.path_join()*
- TODO: Documentation
+ Return: ~
+ (string) log filename
set_level({level}) *vim.lsp.log.set_level()*
- TODO: Documentation
-
-should_log({level}) *vim.lsp.log.should_log()*
- TODO: Documentation
-
-
-==============================================================================
-Lua module: vim.lsp.rpc *lsp-rpc*
-
-convert_NIL({v}) *vim.lsp.rpc.convert_NIL()*
- TODO: Documentation
+ Sets the current log level.
- *vim.lsp.rpc.create_and_start_client()*
-create_and_start_client({cmd}, {cmd_args}, {handlers},
- {extra_spawn_params})
- TODO: Documentation
+ Parameters: ~
+ {level} (string or number) One of `vim.lsp.log.levels`
-encode_and_send({payload}) *vim.lsp.rpc.encode_and_send()*
- TODO: Documentation
+should_log({level}) *vim.lsp.log.should_log()*
+ Checks whether the level is sufficient for logging.
-env_merge({env}) *vim.lsp.rpc.env_merge()*
- Merges current process env with the given env and returns the
- result as a list of "k=v" strings.
->
+ Parameters: ~
+ {level} number log level
- Example:
-<
+ Return: ~
+ (bool) true if would log, false if not
- > in: { PRODUCTION="false", PATH="/usr/bin/", PORT=123, HOST="0.0.0.0", }
- out: { "PRODUCTION=false", "PATH=/usr/bin/", "PORT=123", "HOST=0.0.0.0", }
-<
- *vim.lsp.rpc.format_message_with_content_length()*
-format_message_with_content_length({encoded_message})
- TODO: Documentation
+==============================================================================
+Lua module: vim.lsp.rpc *lsp-rpc*
format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()*
- TODO: Documentation
-
-handle_body({body}) *vim.lsp.rpc.handle_body()*
- TODO: Documentation
-
-is_dir({filename}) *vim.lsp.rpc.is_dir()*
- TODO: Documentation
-
-json_decode({data}) *vim.lsp.rpc.json_decode()*
- TODO: Documentation
+ Constructs an error message from an LSP error object.
-json_encode({data}) *vim.lsp.rpc.json_encode()*
- TODO: Documentation
+ Parameters: ~
+ {err} (table) The error object
-notification({method}, {params}) *vim.lsp.rpc.notification()*
- TODO: Documentation
+ Return: ~
+ (string) The formatted error message
-on_error({errkind}, {...}) *vim.lsp.rpc.on_error()*
- TODO: Documentation
+notify({method}, {params}) *vim.lsp.rpc.notify()*
+ Sends a notification to the LSP server.
-on_exit({code}, {signal}) *vim.lsp.rpc.on_exit()*
- TODO: Documentation
+ Parameters: ~
+ {method} (string) The invoked LSP method
+ {params} (table): Parameters for the invoked LSP method
-onexit({code}, {signal}) *vim.lsp.rpc.onexit()*
- TODO: Documentation
+ Return: ~
+ (bool) `true` if notification could be sent, `false` if
+ not
-parse_headers({header}) *vim.lsp.rpc.parse_headers()*
- TODO: Documentation
+request({method}, {params}, {callback}) *vim.lsp.rpc.request()*
+ Sends a request to the LSP server and runs {callback} upon
+ response.
- *vim.lsp.rpc.pcall_handler()*
-pcall_handler({errkind}, {status}, {head}, {...})
- TODO: Documentation
+ Parameters: ~
+ {method} (string) The invoked LSP method
+ {params} (table) Parameters for the invoked LSP method
+ {callback} (function) Callback to invoke
-request_parser_loop() *vim.lsp.rpc.request_parser_loop()*
- TODO: Documentation
+ Return: ~
+ (bool, number) `(true, message_id)` if request could be
+ sent, `false` if not
*vim.lsp.rpc.rpc_response_error()*
rpc_response_error({code}, {message}, {data})
@@ -966,48 +932,81 @@ rpc_response_error({code}, {message}, {data})
{message} (optional) arbitrary message to send to server
{data} (optional) arbitrary data to send to server
-send_notification({method}, {params}) *vim.lsp.rpc.send_notification()*
- TODO: Documentation
-
- *vim.lsp.rpc.send_request()*
-send_request({method}, {params}, {callback})
- TODO: Documentation
+ *vim.lsp.rpc.start()*
+start({cmd}, {cmd_args}, {handlers}, {extra_spawn_params})
+ Starts an LSP server process and create an LSP RPC client
+ object to interact with it.
- *vim.lsp.rpc.send_response()*
-send_response({request_id}, {err}, {result})
- TODO: Documentation
+ Parameters: ~
+ {cmd} (string) Command to start the LSP
+ server.
+ {cmd_args} (table) List of additional string
+ arguments to pass to {cmd}.
+ {handlers} (table, optional) Handlers for LSP
+ message types. Valid handler names
+ are:
+ • `"notification"`
+ • `"server_request"`
+ • `"on_error"`
+ • `"on_exit"`
+ {extra_spawn_params} (table, optional) Additional context
+ for the LSP server process. May
+ contain:
+ • {cwd} (string) Working directory
+ for the LSP server process
+ • {env} (table) Additional
+ environment variables for LSP
+ server process
-server_request({method}, {params}) *vim.lsp.rpc.server_request()*
- TODO: Documentation
+ Return: ~
+ Client RPC object.
+ Methods:
+ • `notify()` |vim.lsp.rpc.notify()|
+ • `request()` |vim.lsp.rpc.request()|
-try_call({errkind}, {fn}, {...}) *vim.lsp.rpc.try_call()*
- TODO: Documentation
+ Members:
+ • {pid} (number) The LSP server's PID.
+ • {handle} A handle for low-level interaction with the LSP
+ server process |vim.loop|.
==============================================================================
Lua module: vim.lsp.util *lsp-util*
- *vim.lsp.util.apply_syntax_to_region()*
-apply_syntax_to_region({ft}, {start}, {finish})
- TODO: Documentation
-
*vim.lsp.util.apply_text_document_edit()*
apply_text_document_edit({text_document_edit})
- TODO: Documentation
+ Parameters: ~
+ {text_document_edit} (table) a `TextDocumentEdit` object
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit
*vim.lsp.util.apply_text_edits()*
apply_text_edits({text_edits}, {bufnr})
- TODO: Documentation
+ Applies a list of text edits to a buffer.
+
+ Parameters: ~
+ {text_edits} (table) list of `TextEdit` objects
+ {buf_nr} (number) Buffer id
*vim.lsp.util.apply_workspace_edit()*
apply_workspace_edit({workspace_edit})
- TODO: Documentation
+ Applies a `WorkspaceEdit` .
+
+ Parameters: ~
+ {workspace_edit} (table) `WorkspaceEdit`
buf_clear_diagnostics({bufnr}) *vim.lsp.util.buf_clear_diagnostics()*
- TODO: Documentation
+ Clears diagnostics for a buffer.
+
+ Parameters: ~
+ {bufnr} (number) buffer id
buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()*
- TODO: Documentation
+ Removes document highlights from a buffer.
+
+ Parameters: ~
+ {bufnr} buffer id
buf_diagnostics_count({kind}) *vim.lsp.util.buf_diagnostics_count()*
Returns the number of diagnostics of given kind for current
@@ -1040,16 +1039,18 @@ buf_diagnostics_count({kind}) *vim.lsp.util.buf_diagnostics_count()*
*vim.lsp.util.buf_diagnostics_save_positions()*
buf_diagnostics_save_positions({bufnr}, {diagnostics})
- Saves the diagnostics (Diagnostic[]) into diagnostics_by_buf
+ Saves diagnostics into
+ vim.lsp.util.diagnostics_by_buf[{bufnr}].
Parameters: ~
- {bufnr} bufnr for which the diagnostics are for.
- {diagnostics} Diagnostics[] received from the language
- server.
+ {bufnr} (number) buffer id for which the
+ diagnostics are for
+ {diagnostics} list of `Diagnostic` s received from the
+ LSP server
*vim.lsp.util.buf_diagnostics_signs()*
buf_diagnostics_signs({bufnr}, {diagnostics})
- Place signs for each diagnostic in the sign column.
+ Places signs for each diagnostic in the sign column.
Sign characters can be customized with the following commands:
>
@@ -1061,47 +1062,125 @@ buf_diagnostics_signs({bufnr}, {diagnostics})
*vim.lsp.util.buf_diagnostics_underline()*
buf_diagnostics_underline({bufnr}, {diagnostics})
- TODO: Documentation
+ Highlights a list of diagnostics in a buffer by underlining
+ them.
+
+ Parameters: ~
+ {bufnr} (number) buffer id
+ {diagnostics} (list of `Diagnostic` s)
*vim.lsp.util.buf_diagnostics_virtual_text()*
buf_diagnostics_virtual_text({bufnr}, {diagnostics})
- TODO: Documentation
+ Given a list of diagnostics, sets the corresponding virtual
+ text for a buffer.
+
+ Parameters: ~
+ {bufnr} buffer id
+ {diagnostics} (table) list of `Diagnostic` s
*vim.lsp.util.buf_highlight_references()*
buf_highlight_references({bufnr}, {references})
- TODO: Documentation
+ Shows a list of document highlights for a certain buffer.
+
+ Parameters: ~
+ {bufnr} buffer id
+ {references} List of `DocumentHighlight` objects to
+ highlight
character_offset({buf}, {row}, {col}) *vim.lsp.util.character_offset()*
- TODO: Documentation
+ Returns the UTF-32 and UTF-16 offsets for a position in a
+ certain buffer.
+
+ Parameters: ~
+ {buf} buffer id (0 for current)
+ {row} 0-indexed line
+ {col} 0-indexed byte offset in line
+
+ Return: ~
+ (number, number) UTF-32 and UTF-16 index of the character
+ in line {row} column {col} in buffer {buf}
*vim.lsp.util.close_preview_autocmd()*
close_preview_autocmd({events}, {winnr})
- TODO: Documentation
+ Creates autocommands to close a preview window when events
+ happen.
+
+ Parameters: ~
+ {events} (table) list of events
+ {winnr} (number) window id of preview window
+
+ See also: ~
+ |autocmd-events|
*vim.lsp.util.convert_input_to_markdown_lines()*
convert_input_to_markdown_lines({input}, {contents})
- TODO: Documentation
+ Converts any of `MarkedString` | `MarkedString[]` |
+ `MarkupContent` into a list of lines containing valid
+ markdown. Useful to populate the hover window for
+ `textDocument/hover` , for parsing the result of
+ `textDocument/signatureHelp` , and potentially others.
+
+ Parameters: ~
+ {input} ( `MarkedString` | `MarkedString[]` |
+ `MarkupContent` )
+ {contents} (table, optional, default `{}` ) List of
+ strings to extend with converted lines
+
+ Return: ~
+ {contents}, extended with lines of converted markdown.
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
*vim.lsp.util.convert_signature_help_to_markdown_lines()*
convert_signature_help_to_markdown_lines({signature_help})
- TODO: Documentation
+ Converts `textDocument/SignatureHelp` response to markdown
+ lines.
+
+ Parameters: ~
+ {signature_help} Response of `textDocument/SignatureHelp`
+
+ Return: ~
+ list of lines of converted markdown.
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
*vim.lsp.util.diagnostics_group_by_line()*
diagnostics_group_by_line({diagnostics})
- TODO: Documentation
+ Groups a list of diagnostics by line.
+
+ Parameters: ~
+ {diagnostics} (table) list of `Diagnostic` s
+
+ Return: ~
+ (table) dictionary mapping lines to lists of diagnostics
+ valid on those lines
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic
*vim.lsp.util.extract_completion_items()*
extract_completion_items({result})
- TODO: Documentation
+ Can be used to extract the completion items from a `textDocument/completion` request, which may return one of `CompletionItem[]` , `CompletionList` or null.
+
+ Parameters: ~
+ {result} (table) The result of a
+ `textDocument/completion` request
+
+ Return: ~
+ (table) List of completion items
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
*vim.lsp.util.fancy_floating_markdown()*
fancy_floating_markdown({contents}, {opts})
- Convert markdown into syntax highlighted regions by stripping
+ Converts markdown into syntax highlighted regions by stripping
the code blocks and converting them into highlighted code.
This will by default insert a blank line separator after those
code block regions to improve readability. The result is shown
- in a floating preview TODO: refactor to separate
- stripping/converting and make use of open_floating_preview
+ in a floating preview.
Parameters: ~
{contents} table of lines to show in window
@@ -1110,25 +1189,37 @@ fancy_floating_markdown({contents}, {opts})
Return: ~
width,height size of float
-find_window_by_var({name}, {value}) *vim.lsp.util.find_window_by_var()*
- TODO: Documentation
-
focusable_float({unique_name}, {fn}) *vim.lsp.util.focusable_float()*
- TODO: Documentation
+ Parameters: ~
+ {unique_name} (string) Window variable
+ {fn} (function) should return create a new
+ window and return a tuple of
+ ({focusable_buffer_id}, {window_id}). if
+ {focusable_buffer_id} is a valid buffer id,
+ the newly created window will be the new
+ focus associated with the current buffer
+ via the tag `unique_name` .
+
+ Return: ~
+ (pbufnr, pwinnr) if `fn()` has created a new window; nil
+ otherwise
*vim.lsp.util.focusable_preview()*
focusable_preview({unique_name}, {fn})
- TODO: Documentation
+ Focuses/unfocuses the floating preview window associated with
+ the current buffer via the window variable `unique_name` . If
+ no such preview window exists, makes a new one.
-get_completion_word({item}) *vim.lsp.util.get_completion_word()*
- TODO: Documentation
-
- *vim.lsp.util.get_current_line_to_cursor()*
-get_current_line_to_cursor()
- TODO: Documentation
+ Parameters: ~
+ {unique_name} (string) Window variable
+ {fn} (function) The return values of this
+ function will be passed directly to
+ |vim.lsp.util.open_floating_preview()|, in
+ the case that a new floating window should
+ be created
get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
- Get visual width of tabstop.
+ Returns visual width of tabstop.
Parameters: ~
{bufnr} (optional, number): Buffer handle, defaults to
@@ -1140,52 +1231,125 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
See also: ~
|softtabstop|
- *vim.lsp.util.get_line_byte_from_position()*
-get_line_byte_from_position({bufnr}, {position})
- TODO: Documentation
-
get_line_diagnostics() *vim.lsp.util.get_line_diagnostics()*
- TODO: Documentation
+ Gets list of diagnostics for the current line.
+
+ Return: ~
+ (table) list of `Diagnostic` tables
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic
*vim.lsp.util.get_severity_highlight_name()*
get_severity_highlight_name({severity})
- TODO: Documentation
+ Gets the name of a severity's highlight group.
+
+ Parameters: ~
+ {severity} A member of
+ `vim.lsp.protocol.DiagnosticSeverity`
+
+ Return: ~
+ (string) Highlight group name
jump_to_location({location}) *vim.lsp.util.jump_to_location()*
- TODO: Documentation
+ Jumps to a location.
+
+ Parameters: ~
+ {location} ( `Location` | `LocationLink` )
+
+ Return: ~
+ `true` if the jump succeeded
locations_to_items({locations}) *vim.lsp.util.locations_to_items()*
- TODO: Documentation
+ Returns the items with the byte position calculated correctly
+ and in sorted order, for display in quickfix and location
+ lists.
+
+ Parameters: ~
+ {locations} (table) list of `Location` s or
+ `LocationLink` s
+
+ Return: ~
+ (table) list of items
*vim.lsp.util.make_floating_popup_options()*
make_floating_popup_options({width}, {height}, {opts})
- TODO: Documentation
+ Creates a table with sensible default options for a floating
+ window. The table can be passed to |nvim_open_win()|.
+
+ Parameters: ~
+ {width} (number) window width (in character cells)
+ {height} (number) window height (in character cells)
+ {opts} (table, optional)
+
+ Return: ~
+ (table) Options
*vim.lsp.util.make_formatting_params()*
make_formatting_params({options})
- TODO: Documentation
+ Creates a `FormattingOptions` object for the current buffer
+ and cursor position.
+
+ Parameters: ~
+ {options} Table with valid `FormattingOptions` entries
+
+ Return: ~
+ `FormattingOptions object
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
+
+ *vim.lsp.util.make_given_range_params()*
+make_given_range_params({start_pos}, {end_pos})
+ Using the given range in the current buffer, creates an object
+ that is similar to |vim.lsp.util.make_range_params()|.
-make_position_param() *vim.lsp.util.make_position_param()*
- TODO: Documentation
+ Parameters: ~
+ {start_pos} ({number, number}, optional) mark-indexed
+ position. Defaults to the start of the last
+ visual selection.
+ {end_pos} ({number, number}, optional) mark-indexed
+ position. Defaults to the end of the last
+ visual selection.
+
+ Return: ~
+ { textDocument = { uri = `current_file_uri` }, range = {
+ start = `start_position` , end = `end_position` } }
make_position_params() *vim.lsp.util.make_position_params()*
- TODO: Documentation
+ Creates a `TextDocumentPositionParams` object for the current
+ buffer and cursor position.
+
+ Return: ~
+ `TextDocumentPositionParams` object
+
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
make_range_params() *vim.lsp.util.make_range_params()*
- TODO: Documentation
+ Using the current position in the current buffer, creates an
+ object that can be used as a building block for several LSP
+ requests, such as `textDocument/codeAction` ,
+ `textDocument/colorPresentation` ,
+ `textDocument/rangeFormatting` .
+
+ Return: ~
+ { textDocument = { uri = `current_file_uri` }, range = {
+ start = `current_position` , end = `current_position` } }
make_text_document_params() *vim.lsp.util.make_text_document_params()*
- TODO: Documentation
+ Creates a `TextDocumentIdentifier` object for the current
+ buffer.
-npcall({fn}, {...}) *vim.lsp.util.npcall()*
- TODO: Documentation
+ Return: ~
+ `TextDocumentIdentifier`
-ok_or_nil({status}, {...}) *vim.lsp.util.ok_or_nil()*
- TODO: Documentation
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
*vim.lsp.util.open_floating_preview()*
open_floating_preview({contents}, {filetype}, {opts})
- Show contents in a floating window
+ Shows contents in a floating window.
Parameters: ~
{contents} table of lines to show in window
@@ -1193,17 +1357,20 @@ open_floating_preview({contents}, {filetype}, {opts})
{opts} dictionary with optional fields
Return: ~
- bufnr,winnr buffer and window number of floating window or
- nil
+ bufnr,winnr buffer and window number of the newly created
+ floating preview window
parse_snippet({input}) *vim.lsp.util.parse_snippet()*
- TODO: Documentation
+ Parses snippets in a completion entry.
-parse_snippet_rec({input}, {inner}) *vim.lsp.util.parse_snippet_rec()*
- TODO: Documentation
+ Parameters: ~
+ {input} (string) unparsed snippet
+
+ Return: ~
+ (string) parsed snippet
preview_location({location}) *vim.lsp.util.preview_location()*
- Preview a location in a floating windows
+ Previews a location in a floating window
behavior depends on type of location:
• for Location, range is shown (e.g., function definition)
@@ -1211,52 +1378,91 @@ preview_location({location}) *vim.lsp.util.preview_location()*
function definition)
Parameters: ~
- {location} a single Location or LocationLink
+ {location} a single `Location` or `LocationLink`
Return: ~
- bufnr,winnr buffer and window number of floating window or
- nil
-
- *vim.lsp.util.remove_unmatch_completion_items()*
-remove_unmatch_completion_items({items}, {prefix})
- TODO: Documentation
+ (bufnr,winnr) buffer and window number of floating window
+ or nil
set_lines({lines}, {A}, {B}, {new_lines}) *vim.lsp.util.set_lines()*
- TODO: Documentation
+ Replaces text in a range with new text.
-set_loclist({items}) *vim.lsp.util.set_loclist()*
- TODO: Documentation
+ CAUTION: Changes in-place!
-set_qflist({items}) *vim.lsp.util.set_qflist()*
- TODO: Documentation
+ Parameters: ~
+ {lines} (table) Original list of strings
+ {A} (table) Start position; a 2-tuple of {line,
+ col} numbers
+ {B} (table) End position; a 2-tuple of {line,
+ col} numbers
+ {new_lines} A list of strings to replace the original
-show_line_diagnostics() *vim.lsp.util.show_line_diagnostics()*
- TODO: Documentation
+ Return: ~
+ (table) The modified {lines} object
-sort_by_key({fn}) *vim.lsp.util.sort_by_key()*
- TODO: Documentation
+set_loclist({items}) *vim.lsp.util.set_loclist()*
+ Fills current window's location list with given list of items.
+ Can be obtained with e.g. |vim.lsp.util.locations_to_items()|.
-sort_completion_items({items}) *vim.lsp.util.sort_completion_items()*
- TODO: Documentation
+ Parameters: ~
+ {items} (table) list of items
-split_lines({value}) *vim.lsp.util.split_lines()*
- TODO: Documentation
+set_qflist({items}) *vim.lsp.util.set_qflist()*
+ Fills quickfix list with given list of items. Can be obtained
+ with e.g. |vim.lsp.util.locations_to_items()|.
+
+ Parameters: ~
+ {items} (table) list of items
+
+show_line_diagnostics() *vim.lsp.util.show_line_diagnostics()*
+ Displays the diagnostics for the current line in a floating
+ hover window.
symbols_to_items({symbols}, {bufnr}) *vim.lsp.util.symbols_to_items()*
- Convert symbols to quickfix list items
+ Converts symbols to quickfix list items.
Parameters: ~
{symbols} DocumentSymbol[] or SymbolInformation[]
*vim.lsp.util.text_document_completion_list_to_complete_items()*
text_document_completion_list_to_complete_items({result}, {prefix})
- TODO: Documentation
+ Turns the result of a `textDocument/completion` request into
+ vim-compatible |complete-items|.
+
+ Parameters: ~
+ {result} The result of a `textDocument/completion` call,
+ e.g. from |vim.lsp.buf.completion()|, which may
+ be one of `CompletionItem[]` , `CompletionList`
+ or `null`
+ {prefix} (string) the prefix to filter the completion
+ items
+
+ Return: ~
+ { matches = complete-items table, incomplete = bool }
+
+ See also: ~
+ |complete-items|
trim_empty_lines({lines}) *vim.lsp.util.trim_empty_lines()*
- TODO: Documentation
+ Removes empty lines from the beginning and end.
+
+ Parameters: ~
+ {lines} (table) list of lines to trim
+
+ Return: ~
+ (table) trimmed list of lines
*vim.lsp.util.try_trim_markdown_code_blocks()*
try_trim_markdown_code_blocks({lines})
- TODO: Documentation
+ Accepts markdown lines and tries to reduce them to a filetype
+ if they comprise just a single code block.
+
+ CAUTION: Modifies the input in-place!
+
+ Parameters: ~
+ {lines} (table) list of lines
+
+ Return: ~
+ (string) filetype or 'markdown' if it was unchanged.
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 60c7a60d25..334bb33c1e 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -9,7 +9,7 @@ Lua engine *lua* *Lua*
Type |gO| to see the table of contents.
==============================================================================
-Introduction *lua-intro*
+INTRODUCTION *lua-intro*
The Lua 5.1 language is builtin and always available. Try this command to get
an idea of what lurks beneath: >
@@ -30,7 +30,7 @@ finds and loads Lua modules. The conventions are similar to VimL plugins,
with some extra features. See |lua-require-example| for a walkthrough.
==============================================================================
-Importing Lua modules *lua-require*
+IMPORTING LUA MODULES *lua-require*
*lua-package-path*
Nvim automatically adjusts `package.path` and `package.cpath` according to
@@ -233,7 +233,7 @@ lua/charblob.lua: >
}
==============================================================================
-Commands *lua-commands*
+COMMANDS *lua-commands*
These commands execute a Lua chunk from either the command line (:lua, :luado)
or a file (:luafile) on the given line [range]. As always in Lua, each chunk
@@ -456,7 +456,7 @@ management. Try this command to see available functions: >
:lua print(vim.inspect(vim.loop))
-Reference: http://docs.libuv.org
+Reference: https://github.com/luvit/luv/blob/master/docs.md
Examples: https://github.com/luvit/luv/tree/master/examples
*E5560* *lua-loop-callbacks*
@@ -551,223 +551,6 @@ Example: TCP echo-server *tcp-server*
print('TCP echo-server listening on port: '..server:getsockname().port)
------------------------------------------------------------------------------
-VIM.TREESITTER *lua-treesitter*
-
-Nvim integrates the tree-sitter library for incremental parsing of buffers.
-
-Currently Nvim does not provide the tree-sitter parsers, instead these must
-be built separately, for instance using the tree-sitter utility. The only
-exception is a C parser being included in official builds for testing
-purposes. Parsers are searched for as `parser/{lang}.*` in any 'runtimepath'
-directory. A parser can also be loaded manually using a full path: >
-
- vim.treesitter.require_language("python", "/path/to/python.so")
-
-<Create a parser for a buffer and a given language (if another plugin uses the
-same buffer/language combination, it will be safely reused). Use >
-
- parser = vim.treesitter.get_parser(bufnr, lang)
-
-<`bufnr=0` can be used for current buffer. `lang` will default to 'filetype' (this
-doesn't work yet for some filetypes like "cpp") Currently, the parser will be
-retained for the lifetime of a buffer but this is subject to change. A plugin
-should keep a reference to the parser object as long as it wants incremental
-updates.
-
-Parser methods *lua-treesitter-parser*
-
-tsparser:parse() *tsparser:parse()*
-Whenever you need to access the current syntax tree, parse the buffer: >
-
- tstree = parser:parse()
-
-<This will return an immutable tree that represents the current state of the
-buffer. When the plugin wants to access the state after a (possible) edit
-it should call `parse()` again. If the buffer wasn't edited, the same tree will
-be returned again without extra work. If the buffer was parsed before,
-incremental parsing will be done of the changed parts.
-
-NB: to use the parser directly inside a |nvim_buf_attach| Lua callback, you must
-call `get_parser()` before you register your callback. But preferably parsing
-shouldn't be done directly in the change callback anyway as they will be very
-frequent. Rather a plugin that does any kind of analysis on a tree should use
-a timer to throttle too frequent updates.
-
-tsparser:set_included_ranges(ranges) *tsparser:set_included_ranges()*
- Changes the ranges the parser should consider. This is used for
- language injection. `ranges` should be of the form (all zero-based): >
- {
- {start_node, end_node},
- ...
- }
-<
- NOTE: `start_node` and `end_node` are both inclusive.
-
-Tree methods *lua-treesitter-tree*
-
-tstree:root() *tstree:root()*
- Return the root node of this tree.
-
-
-Node methods *lua-treesitter-node*
-
-tsnode:parent() *tsnode:parent()*
- Get the node's immediate parent.
-
-tsnode:child_count() *tsnode:child_count()*
- Get the node's number of children.
-
-tsnode:child(N) *tsnode:child()*
- Get the node's child at the given index, where zero represents the
- first child.
-
-tsnode:named_child_count() *tsnode:named_child_count()*
- Get the node's number of named children.
-
-tsnode:named_child(N) *tsnode:named_child()*
- Get the node's named child at the given index, where zero represents
- the first named child.
-
-tsnode:start() *tsnode:start()*
- Get the node's start position. Return three values: the row, column
- and total byte count (all zero-based).
-
-tsnode:end_() *tsnode:end_()*
- Get the node's end position. Return three values: the row, column
- and total byte count (all zero-based).
-
-tsnode:range() *tsnode:range()*
- Get the range of the node. Return four values: the row, column
- of the start position, then the row, column of the end position.
-
-tsnode:type() *tsnode:type()*
- Get the node's type as a string.
-
-tsnode:symbol() *tsnode:symbol()*
- Get the node's type as a numerical id.
-
-tsnode:named() *tsnode:named()*
- Check if the node is named. Named nodes correspond to named rules in
- the grammar, whereas anonymous nodes correspond to string literals
- in the grammar.
-
-tsnode:missing() *tsnode:missing()*
- Check if the node is missing. Missing nodes are inserted by the
- parser in order to recover from certain kinds of syntax errors.
-
-tsnode:has_error() *tsnode:has_error()*
- Check if the node is a syntax error or contains any syntax errors.
-
-tsnode:sexpr() *tsnode:sexpr()*
- Get an S-expression representing the node as a string.
-
-tsnode:descendant_for_range(start_row, start_col, end_row, end_col)
- *tsnode:descendant_for_range()*
- Get the smallest node within this node that spans the given range of
- (row, column) positions
-
-tsnode:named_descendant_for_range(start_row, start_col, end_row, end_col)
- *tsnode:named_descendant_for_range()*
- Get the smallest named node within this node that spans the given
- range of (row, column) positions
-
-Query methods *lua-treesitter-query*
-
-Tree-sitter queries are supported, with some limitations. Currently, the only
-supported match predicate is `eq?` (both comparing a capture against a string
-and two captures against each other).
-
-vim.treesitter.parse_query(lang, query)
- *vim.treesitter.parse_query(()*
- Parse the query as a string. (If the query is in a file, the caller
- should read the contents into a string before calling).
-
-query:iter_captures(node, bufnr, start_row, end_row)
- *query:iter_captures()*
- Iterate over all captures from all matches inside a `node`.
- `bufnr` is needed if the query contains predicates, then the caller
- must ensure to use a freshly parsed tree consistent with the current
- text of the buffer. `start_row` and `end_row` can be used to limit
- matches inside a row range (this is typically used with root node
- as the node, i e to get syntax highlight matches in the current
- viewport)
-
- The iterator returns two values, a numeric id identifying the capture
- and the captured node. The following example shows how to get captures
- by name:
->
- for id, node in query:iter_captures(tree:root(), bufnr, first, last) do
- local name = query.captures[id] -- name of the capture in the query
- -- typically useful info about the node:
- local type = node:type() -- type of the captured node
- local row1, col1, row2, col2 = node:range() -- range of the capture
- ... use the info here ...
- end
-<
-query:iter_matches(node, bufnr, start_row, end_row)
- *query:iter_matches()*
- Iterate over all matches within a node. The arguments are the same as
- for |query:iter_captures()| but the iterated values are different:
- an (1-based) index of the pattern in the query, and a table mapping
- capture indices to nodes. If the query has more than one pattern
- the capture table might be sparse, and e.g. `pairs` should be used and not
- `ipairs`. Here an example iterating over all captures in
- every match:
->
- for pattern, match in cquery:iter_matches(tree:root(), bufnr, first, last) do
- for id,node in pairs(match) do
- local name = query.captures[id]
- -- `node` was captured by the `name` capture in the match
- ... use the info here ...
- end
- end
->
-Treesitter syntax highlighting (WIP) *lua-treesitter-highlight*
-
-NOTE: This is a partially implemented feature, and not usable as a default
-solution yet. What is documented here is a temporary interface indented
-for those who want to experiment with this feature and contribute to
-its development.
-
-Highlights are defined in the same query format as in the tree-sitter highlight
-crate, which some limitations and additions. Set a highlight query for a
-buffer with this code: >
-
- local query = [[
- "for" @keyword
- "if" @keyword
- "return" @keyword
-
- (string_literal) @string
- (number_literal) @number
- (comment) @comment
-
- (preproc_function_def name: (identifier) @function)
-
- ; ... more definitions
- ]]
-
- highlighter = vim.treesitter.TSHighlighter.new(query, bufnr, lang)
- -- alternatively, to use the current buffer and its filetype:
- -- highlighter = vim.treesitter.TSHighlighter.new(query)
-
- -- Don't recreate the highlighter for the same buffer, instead
- -- modify the query like this:
- local query2 = [[ ... ]]
- highlighter:set_query(query2)
-
-As mentioned above the supported predicate is currently only `eq?`. `match?`
-predicates behave like matching always fails. As an addition a capture which
-begin with an upper-case letter like `@WarningMsg` will map directly to this
-highlight group, if defined. Also if the predicate begins with upper-case and
-contains a dot only the part before the first will be interpreted as the
-highlight group. As an example, this warns of a binary expression with two
-identical identifiers, highlighting both as |hl-WarningMsg|: >
-
- ((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right)
- (eq? @WarningMsg.left @WarningMsg.right))
-
-------------------------------------------------------------------------------
VIM.HIGHLIGHT *lua-highlight*
Nvim includes a function for highlighting a selection on yank (see for example
@@ -839,11 +622,6 @@ vim.api.{func}({...}) *vim.api*
Example: call the "nvim_get_current_line()" API function: >
print(tostring(vim.api.nvim_get_current_line()))
-vim.call({func}, {...}) *vim.call()*
- Invokes |vim-function| or |user-function| {func} with arguments {...}.
- See also |vim.fn|. Equivalent to: >
- vim.fn[func]({...})
-
vim.in_fast_event() *vim.in_fast_event()*
Returns true if the code is executing as part of a "fast" event
handler, where most of the API is disabled. These are low-level events
@@ -876,6 +654,34 @@ vim.region({bufnr}, {pos1}, {pos2}, {type}, {inclusive}) *vim.region()*
whether the selection is inclusive or not, into a zero-indexed table
of linewise selections of the form `{linenr = {startcol, endcol}}` .
+ *vim.register_keystroke_callback()*
+vim.register_keystroke_callback({fn}, {ns_id})
+ Register a lua {fn} with an {ns_id} to be run after every keystroke.
+
+ Parameters: ~
+ {fn}: (function): Function to call on keystroke.
+ It should take one argument, which is a string.
+ The string will contain the literal keys typed.
+ See |i_CTRL-V|
+
+ If {fn} is `nil`, it removes the callback for the
+ associated {ns_id}.
+
+ {ns_id}: (number) Namespace ID. If not passed or 0, will generate
+ and return a new namespace ID from |nvim_create_namespace()|
+
+ Return: ~
+ (number) Namespace ID associated with {fn}
+
+ NOTE: {fn} will be automatically removed if an error occurs while
+ calling. This is to prevent the annoying situation of every keystroke
+ erroring while trying to remove a broken callback.
+
+ NOTE: {fn} will receive the keystrokes after mappings have been
+ evaluated
+
+ NOTE: {fn} will *NOT* be cleared from |nvim_buf_clear_namespace()|
+
vim.rpcnotify({channel}, {method}[, {args}...]) *vim.rpcnotify()*
Sends {event} to {channel} via |RPC| and returns immediately.
If {channel} is 0, the event is broadcast to all channels.
@@ -931,13 +737,20 @@ vim.defer_fn({fn}, {timeout}) *vim.defer_fn*
Returns: ~
|vim.loop|.new_timer() object
-vim.wait({time}, {callback} [, {interval}]) *vim.wait()*
+vim.wait({time} [, {callback}, {interval}, {fast_only}]) *vim.wait()*
Wait for {time} in milliseconds until {callback} returns `true`.
Executes {callback} immediately and at approximately {interval}
milliseconds (default 200). Nvim still processes other events during
this time.
+ Parameters: ~
+ {time} Number of milliseconds to wait
+ {callback} Optional callback. Waits until {callback} returns true
+ {interval} (Approximate) number of milliseconds to wait between polls
+ {fast_only} If true, only |api-fast| events will be processed.
+ If called from while in an |api-fast| event, will
+ automatically be set to `true`.
Returns: ~
If {callback} returns `true` during the {time}:
@@ -975,22 +788,6 @@ vim.wait({time}, {callback} [, {interval}]) *vim.wait()*
end
<
-vim.fn.{func}({...}) *vim.fn*
- Invokes |vim-function| or |user-function| {func} with arguments {...}.
- To call autoload functions, use the syntax: >
- vim.fn['some#function']({...})
-<
- Unlike vim.api.|nvim_call_function| this converts directly between Vim
- objects and Lua objects. If the Vim function returns a float, it will
- be represented directly as a Lua number. Empty lists and dictionaries
- both are represented by an empty table.
-
- Note: |v:null| values as part of the return value is represented as
- |vim.NIL| special value
-
- Note: vim.fn keys are generated lazily, thus `pairs(vim.fn)` only
- enumerates functions that were called at least once.
-
vim.type_idx *vim.type_idx*
Type index for use in |lua-special-tbl|. Specifying one of the
values from |vim.types| allows typing the empty table (it is
@@ -1026,64 +823,103 @@ vim.types *vim.types*
`vim.types.dictionary` will not change or that `vim.types` table will
only contain values for these three types.
-==============================================================================
-Vim Internal Variables *lua-vim-internal-variables*
-
-Built-in Vim dictionaries can be accessed and set idiomatically in Lua by each
-of the following tables.
-
-To set a value: >
-
- vim.g.my_global_variable = 5
-<
+------------------------------------------------------------------------------
+LUA-VIMSCRIPT BRIDGE *lua-vimscript*
-To read a value: >
+Nvim Lua provides an interface to Vimscript variables and functions, and
+editor commands and options.
- print(vim.g.my_global_variable)
-<
+vim.call({func}, {...}) *vim.call()*
+ Invokes |vim-function| or |user-function| {func} with arguments {...}.
+ See also |vim.fn|.
+ Equivalent to: >
+ vim.fn[func]({...})
-To delete a value: >
+vim.cmd({cmd}) *vim.cmd()*
+ Invokes an Ex command (the ":" commands, Vimscript statements).
+ See also |ex-cmd-index|.
+ Example: >
+ vim.cmd('echo 42')
- vim.g.my_global_variable = nil
+vim.fn.{func}({...}) *vim.fn*
+ Invokes |vim-function| or |user-function| {func} with arguments {...}.
+ To call autoload functions, use the syntax: >
+ vim.fn['some#function']({...})
<
+ Unlike vim.api.|nvim_call_function| this converts directly between Vim
+ objects and Lua objects. If the Vim function returns a float, it will
+ be represented directly as a Lua number. Empty lists and dictionaries
+ both are represented by an empty table.
-vim.g *vim.g*
- Table with values from |g:|
- Keys with no values set will result in `nil`.
-
-vim.b *vim.b*
- Gets a buffer-scoped (b:) variable for the current buffer.
- Keys with no values set will result in `nil`.
-
-vim.w *vim.w*
- Gets a window-scoped (w:) variable for the current window.
- Keys with no values set will result in `nil`.
+ Note: |v:null| values as part of the return value is represented as
+ |vim.NIL| special value
-vim.t *vim.t*
- Gets a tabpage-scoped (t:) variable for the current table.
- Keys with no values set will result in `nil`.
+ Note: vim.fn keys are generated lazily, thus `pairs(vim.fn)` only
+ enumerates functions that were called at least once.
-vim.v *vim.v*
- Gets a v: variable.
- Keys with no values set will result in `nil`.
+ *lua-vim-variables*
+The Vim editor global dictionaries |g:| |w:| |b:| |t:| |v:| can be accessed
+from Lua conveniently and idiomatically by referencing the `vim.*` Lua tables
+described below. In this way you can easily read and modify global Vimscript
+variables from Lua.
-Vim Internal Options *lua-vim-internal-options*
+Example: >
-Read, set and clear vim |options| in Lua by each of the following tables.
+ vim.g.foo = 5 -- Set the g:foo Vimscript variable.
+ print(vim.g.foo) -- Get and print the g:foo Vimscript variable.
+ vim.g.foo = nil -- Delete (:unlet) the Vimscript variable.
+
+vim.g *vim.g*
+ Global (|g:|) editor variables.
+ Key with no value returns `nil`.
+
+vim.b *vim.b*
+ Buffer-scoped (|b:|) variables for the current buffer.
+ Invalid or unset key returns `nil`.
+
+vim.w *vim.w*
+ Window-scoped (|w:|) variables for the current window.
+ Invalid or unset key returns `nil`.
+
+vim.t *vim.t*
+ Tabpage-scoped (|t:|) variables for the current tabpage.
+ Invalid or unset key returns `nil`.
+
+vim.v *vim.v*
+ |v:| variables.
+ Invalid or unset key returns `nil`.
+
+vim.env *vim.env*
+ Environment variables defined in the editor session.
+ See |expand-env| and |:let-environment| for the Vimscript behavior.
+ Invalid or unset key returns `nil`.
+ Example: >
+ vim.env.FOO = 'bar'
+ print(vim.env.TERM)
+<
+ *lua-vim-options*
+From Lua you can work with editor |options| by reading and setting items in
+these Lua tables:
-vim.o *vim.o*
- Table with values from |options|
- Invalid keys will result in an error.
+vim.o *vim.o*
+ Get or set editor options, like |:set|. Invalid key is an error.
+ Example: >
+ vim.o.cmdheight = 4
+ print(vim.o.columns)
-vim.bo *vim.bo*
- Gets a buffer-scoped option for the current buffer.
- Invalid keys will result in an error.
+vim.bo *vim.bo*
+ Get or set buffer-scoped |local-options|. Invalid key is an error.
+ Example: >
+ vim.bo.buflisted = true
+ print(vim.bo.comments)
-vim.wo *vim.wo*
- Gets a window-scoped option for the current window.
- Invalid keys will result in an error.
+vim.wo *vim.wo*
+ Get or set window-scoped |local-options|. Invalid key is an error.
+ Example: >
+ vim.wo.cursorcolumn = true
+ print(vim.wo.foldmarker)
==============================================================================
@@ -1195,6 +1031,9 @@ is_callable({f}) *vim.is_callable()*
Return: ~
true if `f` is callable, else false
+is_valid({opt}) *vim.is_valid()*
+ TODO: Documentation
+
list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
Extends a list-like table with the values of another list-like
table.
@@ -1339,17 +1178,21 @@ tbl_flatten({t}) *vim.tbl_flatten()*
Fromhttps://github.com/premake/premake-core/blob/master/src/base/table.lua
tbl_isempty({t}) *vim.tbl_isempty()*
+ Checks if a table is empty.
+
+ Parameters: ~
+ {t} Table to check
+
See also: ~
- Fromhttps://github.com/premake/premake-core/blob/master/src/base/table.lua@paramt Table to check
+ https://github.com/premake/premake-core/blob/master/src/base/table.lua
tbl_islist({t}) *vim.tbl_islist()*
- Determine whether a Lua table can be treated as an array.
+ Tests if a Lua table can be treated as an array.
- An empty table `{}` will default to being treated as an array.
- Use `vim.emtpy_dict()` to create a table treated as an empty
- dict. Empty tables returned by `rpcrequest()` and `vim.fn`
- functions can be checked using this function whether they
- represent empty API arrays and vimL lists.
+ Empty table `{}` is assumed to be an array, unless it was
+ created by |vim.empty_dict()| or returned as a dict-like |API|
+ or Vimscript result, for example from |rpcrequest()| or
+ |vim.fn|.
Parameters: ~
{t} Table
@@ -1446,8 +1289,52 @@ validate({opt}) *vim.validate()*
• arg_value: argument value
• fn: any function accepting one argument,
returns true if and only if the argument is
- valid
+ valid. Can optionally return an additional
+ informative error message as the second
+ returned value.
• msg: (optional) error string if validation
fails
+
+==============================================================================
+Lua module: uri *lua-uri*
+
+uri_from_bufnr({bufnr}) *vim.uri_from_bufnr()*
+ Get a URI from a bufnr
+
+ Parameters: ~
+ {bufnr} (number): Buffer number
+
+ Return: ~
+ URI
+
+uri_from_fname({path}) *vim.uri_from_fname()*
+ Get a URI from a file path.
+
+ Parameters: ~
+ {path} (string): Path to file
+
+ Return: ~
+ URI
+
+uri_to_bufnr({uri}) *vim.uri_to_bufnr()*
+ Return or create a buffer for a uri.
+
+ Parameters: ~
+ {uri} (string): The URI
+
+ Return: ~
+ bufnr.
+ Note:
+ Creates buffer but does not load it
+
+uri_to_fname({uri}) *vim.uri_to_fname()*
+ Get a filename from a URI
+
+ Parameters: ~
+ {uri} (string): The URI
+
+ Return: ~
+ Filename
+
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index ed31ecc42e..edec4a8de7 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1078,6 +1078,10 @@ When executing an autocommand or a user command, it will run in the context of
the script it was defined in. This makes it possible that the command calls a
local function or uses a local mapping.
+In case the value is used in a context where <SID> cannot be correctly
+expanded, use the expand() function: >
+ let &includexpr = expand('<SID>') .. 'My_includeexpr()'
+
Otherwise, using "<SID>" outside of a script context is an error.
If you need to get the script number to use in a complicated script, you can
@@ -1132,9 +1136,10 @@ scripts.
:com[mand] *:com* *:command*
List all user-defined commands. When listing commands,
- the characters in the first two columns are
+ the characters in the first columns are:
! Command has the -bang attribute
" Command has the -register attribute
+ | Command has the -bar attribute
b Command is local to current buffer
(see below for details on attributes)
The list can be filtered on command name with
@@ -1162,6 +1167,10 @@ See |:verbose-cmd| for more information.
attributes (see below) are {attr}. If the command
already exists, an error is reported, unless a ! is
specified, in which case the command is redefined.
+ There is one exception: When sourcing a script again,
+ a command that was previously defined in that script
+ will be silently replaced.
+
:delc[ommand] {cmd} *:delc* *:delcommand* *E184*
Delete the user-defined command {cmd}.
@@ -1169,7 +1178,8 @@ See |:verbose-cmd| for more information.
:comc[lear] *:comc* *:comclear*
Delete all user-defined commands.
-Command attributes
+
+Command attributes ~
User-defined commands are treated by Vim just like any other Ex commands. They
can have arguments, or have a range specified. Arguments are subject to
@@ -1180,8 +1190,9 @@ There are a number of attributes, split into four categories: argument
handling, completion behavior, range handling, and special cases. The
attributes are described below, by category.
-Argument handling *E175* *E176* *:command-nargs*
+Argument handling ~
+ *E175* *E176* *:command-nargs*
By default, a user defined command will take no arguments (and an error is
reported if any are supplied). However, it is possible to specify that the
command can take arguments, using the -nargs attribute. Valid cases are:
@@ -1257,9 +1268,9 @@ completion can be enabled:
Note: That some completion methods might expand environment variables.
-Custom completion *:command-completion-custom*
- *:command-completion-customlist*
- *E467* *E468*
+Custom completion ~
+ *:command-completion-custom*
+ *:command-completion-customlist* *E467* *E468*
It is possible to define customized completion schemes via the "custom,{func}"
or the "customlist,{func}" completion argument. The {func} part should be a
function with the following signature: >
@@ -1304,8 +1315,8 @@ the 'path' option: >
This example does not work for file names with spaces!
-Range handling *E177* *E178* *:command-range*
- *:command-count*
+Range handling ~
+ *E177* *E178* *:command-range* *:command-count*
By default, user-defined commands do not accept a line number range. However,
it is possible to specify that the command does take a range (the -range
attribute), or that it takes an arbitrary count value, either in the line
@@ -1332,17 +1343,19 @@ It is possible that the special characters in the range like `.`, `$` or `%`
which by default correspond to the current line, last line and the whole
buffer, relate to arguments, (loaded) buffers, windows or tab pages.
-Possible values are:
- -addr=lines Range of lines (this is the default)
- -addr=arguments Range for arguments
- -addr=buffers Range for buffers (also not loaded buffers)
- -addr=loaded_buffers Range for loaded buffers
- -addr=windows Range for windows
- -addr=tabs Range for tab pages
- -addr=other other kind of range
+Possible values are (second column is the short name used in listing):
+ -addr=lines Range of lines (this is the default)
+ -addr=arguments arg Range for arguments
+ -addr=buffers buf Range for buffers (also not loaded buffers)
+ -addr=loaded_buffers load Range for loaded buffers
+ -addr=windows win Range for windows
+ -addr=tabs tab Range for tab pages
+ -addr=quickfix qf Range for quickfix entries
+ -addr=other ? other kind of range
-Special cases *:command-bang* *:command-bar*
+Special cases ~
+ *:command-bang* *:command-bar*
*:command-register* *:command-buffer*
There are some special cases as well:
@@ -1360,7 +1373,8 @@ replacement text separately.
Note that these arguments can be abbreviated, but that is a deprecated
feature. Use the full name for new scripts.
-Replacement text
+
+Replacement text ~
The replacement text for a user defined command is scanned for special escape
sequences, using <...> notation. Escape sequences are replaced with values
diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt
index 127c46c27d..a6410a09cb 100644
--- a/runtime/doc/mbyte.txt
+++ b/runtime/doc/mbyte.txt
@@ -71,24 +71,15 @@ If you are working in a terminal (emulator) you must make sure it accepts
UTF-8, the encoding which Vim is working with. Otherwise only ASCII can
be displayed and edited correctly.
-For the GUI you must select fonts that work with UTF-8. This
-is the difficult part. It depends on the system you are using, the locale and
-a few other things.
-
-For X11 you can set the 'guifontset' option to a list of fonts that together
-cover the characters that are used. Example for Korean: >
-
- :set guifontset=k12,r12
-
-Alternatively, you can set 'guifont' and 'guifontwide'. 'guifont' is used for
-the single-width characters, 'guifontwide' for the double-width characters.
-Thus the 'guifontwide' font must be exactly twice as wide as 'guifont'.
-Example for UTF-8: >
+For the GUI you must select fonts that work with UTF-8. You can set 'guifont'
+and 'guifontwide'. 'guifont' is used for the single-width characters,
+'guifontwide' for the double-width characters. Thus the 'guifontwide' font
+must be exactly twice as wide as 'guifont'. Example for UTF-8: >
:set guifont=-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
:set guifontwide=-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1
-You can also set 'guifont' alone, Vim will try to find a matching
+You can also set 'guifont' alone, the Nvim GUI will try to find a matching
'guifontwide' for you.
@@ -267,16 +258,16 @@ Recognized 'fileencoding' values include: *encoding-values*
1 cp1258 Vietnamese
1 cp{number} MS-Windows: any installed single-byte codepage
2 cp932 Japanese (Windows only)
-2 euc-jp Japanese (Unix only)
-2 sjis Japanese (Unix only)
-2 cp949 Korean (Unix and Windows)
-2 euc-kr Korean (Unix only)
+2 euc-jp Japanese
+2 sjis Japanese
+2 cp949 Korean
+2 euc-kr Korean
2 cp936 simplified Chinese (Windows only)
-2 euc-cn simplified Chinese (Unix only)
-2 cp950 traditional Chinese (on Unix alias for big5)
-2 big5 traditional Chinese (on Windows alias for cp950)
-2 euc-tw traditional Chinese (Unix only)
-2 2byte-{name} Unix: any double-byte encoding (Vim specific name)
+2 euc-cn simplified Chinese
+2 cp950 traditional Chinese (alias for big5)
+2 big5 traditional Chinese (alias for cp950)
+2 euc-tw traditional Chinese
+2 2byte-{name} any double-byte encoding (Vim-specific name)
2 cp{number} MS-Windows: any installed double-byte codepage
u utf-8 32 bit UTF-8 encoded Unicode (ISO/IEC 10646-1)
u ucs-2 16 bit UCS-2 encoded Unicode (ISO/IEC 10646-1)
@@ -298,14 +289,14 @@ the same encoding is used and it's called latin1. 'isprint' can be used to
display the characters 0x80 - 0xA0 or not.
Several aliases can be used, they are translated to one of the names above.
-An incomplete list:
+Incomplete list:
1 ansi same as latin1 (obsolete, for backward compatibility)
-2 japan Japanese: on Unix "euc-jp", on MS-Windows cp932
-2 korea Korean: on Unix "euc-kr", on MS-Windows cp949
-2 prc simplified Chinese: on Unix "euc-cn", on MS-Windows cp936
+2 japan Japanese: "euc-jp"
+2 korea Korean: "euc-kr"
+2 prc simplified Chinese: "euc-cn"
2 chinese same as "prc"
-2 taiwan traditional Chinese: on Unix "euc-tw", on MS-Windows cp950
+2 taiwan traditional Chinese: "euc-tw"
u utf8 same as utf-8
u unicode same as ucs-2
u ucs2be same as ucs-2 (big endian)
@@ -394,148 +385,6 @@ conversion needs to be done. These conversions are supported:
request a very large buffer, more than Vim is willing to provide).
Try getting another iconv() implementation.
- *iconv-dynamic*
-On MS-Windows Vim can be compiled with the |+iconv/dyn| feature. This means
-Vim will search for the "iconv.dll" and "libiconv.dll" libraries. When
-neither of them can be found Vim will still work but some conversions won't be
-possible.
-
-==============================================================================
-Fonts on X11 *mbyte-fonts-X11*
-
-Unfortunately, using fonts in X11 is complicated. The name of a single-byte
-font is a long string. For multi-byte fonts we need several of these...
-
-First of all, Vim only accepts fixed-width fonts for displaying text. You
-cannot use proportionally spaced fonts. This excludes many of the available
-(and nicer looking) fonts. However, for menus and tooltips any font can be
-used.
-
-Note that Display and Input are independent. It is possible to see your
-language even though you have no input method for it.
-
-You should get a default font for menus and tooltips that works, but it might
-be ugly. Read the following to find out how to select a better font.
-
-
-X LOGICAL FONT DESCRIPTION (XLFD)
- *XLFD*
-XLFD is the X font name and contains the information about the font size,
-charset, etc. The name is in this format:
-
-FOUNDRY-FAMILY-WEIGHT-SLANT-WIDTH-STYLE-PIXEL-POINT-X-Y-SPACE-AVE-CR-CE
-
-Each field means:
-
-- FOUNDRY: FOUNDRY field. The company that created the font.
-- FAMILY: FAMILY_NAME field. Basic font family name. (helvetica, gothic,
- times, etc)
-- WEIGHT: WEIGHT_NAME field. How thick the letters are. (light, medium,
- bold, etc)
-- SLANT: SLANT field.
- r: Roman (no slant)
- i: Italic
- o: Oblique
- ri: Reverse Italic
- ro: Reverse Oblique
- ot: Other
- number: Scaled font
-- WIDTH: SETWIDTH_NAME field. Width of characters. (normal, condensed,
- narrow, double wide)
-- STYLE: ADD_STYLE_NAME field. Extra info to describe font. (Serif, Sans
- Serif, Informal, Decorated, etc)
-- PIXEL: PIXEL_SIZE field. Height, in pixels, of characters.
-- POINT: POINT_SIZE field. Ten times height of characters in points.
-- X: RESOLUTION_X field. X resolution (dots per inch).
-- Y: RESOLUTION_Y field. Y resolution (dots per inch).
-- SPACE: SPACING field.
- p: Proportional
- m: Monospaced
- c: CharCell
-- AVE: AVERAGE_WIDTH field. Ten times average width in pixels.
-- CR: CHARSET_REGISTRY field. The name of the charset group.
-- CE: CHARSET_ENCODING field. The rest of the charset name. For some
- charsets, such as JIS X 0208, if this field is 0, code points has
- the same value as GL, and GR if 1.
-
-For example, in case of a 16 dots font corresponding to JIS X 0208, it is
-written like:
- -misc-fixed-medium-r-normal--16-110-100-100-c-160-jisx0208.1990-0
-
-
-X FONTSET
- *fontset* *xfontset*
-A single-byte charset is typically associated with one font. For multi-byte
-charsets a combination of fonts is often used. This means that one group of
-characters are used from one font and another group from another font (which
-might be double wide). This collection of fonts is called a fontset.
-
-Which fonts are required in a fontset depends on the current locale. X
-windows maintains a table of which groups of characters are required for a
-locale. You have to specify all the fonts that a locale requires in the
-'guifontset' option.
-
-NOTE: The fontset always uses the current locale, even though 'encoding' may
-be set to use a different charset. In that situation you might want to use
-'guifont' and 'guifontwide' instead of 'guifontset'.
-
-Example:
- |charset| language "groups of characters" ~
- GB2312 Chinese (simplified) ISO-8859-1 and GB 2312
- Big5 Chinese (traditional) ISO-8859-1 and Big5
- CNS-11643 Chinese (traditional) ISO-8859-1, CNS 11643-1 and CNS 11643-2
- EUC-JP Japanese JIS X 0201 and JIS X 0208
- EUC-KR Korean ISO-8859-1 and KS C 5601 (KS X 1001)
-
-You can search for fonts using the xlsfonts command. For example, when you're
-searching for a font for KS C 5601: >
- xlsfonts | grep ksc5601
-
-This is complicated and confusing. You might want to consult the X-Windows
-documentation if there is something you don't understand.
-
- *base_font_name_list*
-When you have found the names of the fonts you want to use, you need to set
-the 'guifontset' option. You specify the list by concatenating the font names
-and putting a comma in between them.
-
-For example, when you use the ja_JP.eucJP locale, this requires JIS X 0201
-and JIS X 0208. You could supply a list of fonts that explicitly specifies
-the charsets, like: >
-
- :set guifontset=-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0,
- \-misc-fixed-medium-r-normal--14-130-75-75-c-70-jisx0201.1976-0
-
-Alternatively, you can supply a base font name list that omits the charset
-name, letting X-Windows select font characters required for the locale. For
-example: >
-
- :set guifontset=-misc-fixed-medium-r-normal--14-130-75-75-c-140,
- \-misc-fixed-medium-r-normal--14-130-75-75-c-70
-
-Alternatively, you can supply a single base font name that allows X-Windows to
-select from all available fonts. For example: >
-
- :set guifontset=-misc-fixed-medium-r-normal--14-*
-
-Alternatively, you can specify alias names. See the fonts.alias file in the
-fonts directory (e.g., /usr/X11R6/lib/X11/fonts/). For example: >
-
- :set guifontset=k14,r14
-<
- *E253*
-Note that in East Asian fonts, the standard character cell is square. When
-mixing a Latin font and an East Asian font, the East Asian font width should
-be twice the Latin font width.
-
-If 'guifontset' is not empty, the "font" argument of the |:highlight| command
-is also interpreted as a fontset. For example, you should use for
-highlighting: >
- :hi Comment font=english_font,your_font
-If you use a wrong "font" argument you will get an error message.
-Also make sure that you set 'guifontset' before setting fonts for highlight
-groups.
-
==============================================================================
Input on X11 *mbyte-XIM*
@@ -647,10 +496,6 @@ Note that Display and Input are independent. It is possible to see your
language even though you have no input method for it. But when your Display
method doesn't match your Input method, the text will be displayed wrong.
- Note: You can not use IM unless you specify 'guifontset'.
- Therefore, Latin users, you have to also use 'guifontset'
- if you use IM.
-
To input your language you should run the |IM-server| which supports your
language and |conversion-server| if needed.
@@ -962,9 +807,9 @@ Vim has comprehensive UTF-8 support. It works well in:
- MS-Windows GUI
- several other platforms
-Double-width characters are supported. This works best with 'guifontwide' or
-'guifontset'. When using only 'guifont' the wide characters are drawn in the
-normal width and a space to fill the gap.
+Double-width characters are supported. Works best with 'guifontwide'. When
+using only 'guifont' the wide characters are drawn in the normal width and
+a space to fill the gap.
*bom-bytes*
When reading a file a BOM (Byte Order Mark) can be used to recognize the
@@ -1031,7 +876,6 @@ this:
1. Set 'guifont' and let Vim find a matching 'guifontwide'
2. Set 'guifont' and 'guifontwide'
-3. Set 'guifontset'
See the documentation for each option for details. Example: >
@@ -1077,10 +921,7 @@ not everybody is able to type a composing character.
==============================================================================
Overview of options *mbyte-options*
-These options are relevant for editing multi-byte files. Check the help in
-options.txt for detailed information.
-
-'encoding' Internal text encoding, always "utf-8".
+These options are relevant for editing multi-byte files.
'fileencoding' Encoding of a file. When it's different from "utf-8"
conversion is done when reading or writing the file.
@@ -1096,9 +937,6 @@ options.txt for detailed information.
languages where a sequence of characters can be broken
anywhere.
-'guifontset' The list of font names used for a multi-byte encoding. When
- this option is not empty, it replaces 'guifont'.
-
'keymap' Specify the name of a keyboard mapping.
==============================================================================
diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt
index 43b1eb5e0c..745160da8a 100644
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -359,7 +359,7 @@ the other way around. It should be used like this: {foo,bar}. This matches
ml_get: invalid lnum: {number}
This is an internal Vim error. Please try to find out how it can be
-reproduced, and submit a bug report |bugreport.vim|.
+reproduced, and submit a |bug-report|.
*E173* >
{number} more files to edit
diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt
index 2a10a7051d..5217b2c160 100644
--- a/runtime/doc/mlang.txt
+++ b/runtime/doc/mlang.txt
@@ -124,8 +124,7 @@ maintainer of the translation and ask him to update it. You can find the
name and e-mail address of the translator in
"$VIMRUNTIME/lang/menu_<lang>.vim".
-To set the font (or fontset) to use for the menus, use the |:highlight|
-command. Example: >
+To set the font to use for the menus, use the |:highlight| command. Example: >
:highlight Menu font=k12,r12
diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt
index a96d118667..bec2b362ea 100644
--- a/runtime/doc/nvim_terminal_emulator.txt
+++ b/runtime/doc/nvim_terminal_emulator.txt
@@ -92,7 +92,7 @@ Mouse input has the following behavior:
the terminal wont lose focus and the hovered window will be scrolled.
==============================================================================
-Configuration *terminal-configuration*
+Configuration *terminal-config*
Options: 'modified', 'scrollback'
Events: |TermOpen|, |TermEnter|, |TermLeave|, |TermClose|
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 29f4abf250..448df31798 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -118,8 +118,7 @@ A few special texts:
Option was set with command line argument |-c|, +, |-S| or
|-q|.
Last set from environment variable ~
- Option was set from an environment variable, $VIMINIT,
- $GVIMINIT or $EXINIT.
+ Option was set from $VIMINIT.
Last set from error handler ~
Option was cleared when evaluating it resulted in an error.
@@ -1387,6 +1386,21 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
+ *'completeslash'* *'csl'*
+'completeslash' 'csl' string (default: "")
+ local to buffer
+ {not in Vi} {only for MS-Windows}
+ When this option is set it overrules 'shellslash' for completion:
+ - When this option is set to "slash", a forward slash is used for path
+ completion in insert mode. This is useful when editing HTML tag, or
+ Makefile with 'noshellslash' on Windows.
+ - When this option is set to "backslash", backslash is used. This is
+ useful when editing a batch file with 'shellslash' set on Windows.
+ - When this option is empty, same character is used as for
+ 'shellslash'.
+ For Insert mode completion the buffer-local value is used. For
+ command line completion the global value is used.
+
*'completeopt'* *'cot'*
'completeopt' 'cot' string (default: "menu,preview")
global
@@ -2739,21 +2753,26 @@ A jump table for the options with a short description can be found at |Q_op|.
hor{N} horizontal bar, {N} percent of the character height
ver{N} vertical bar, {N} percent of the character width
block block cursor, fills the whole character
- [only one of the above three should be present]
+ - Only one of the above three should be present.
+ - Default is "block" for each mode.
blinkwait{N} *cursor-blinking*
blinkon{N}
blinkoff{N}
blink times for cursor: blinkwait is the delay before
the cursor starts blinking, blinkon is the time that
the cursor is shown and blinkoff is the time that the
- cursor is not shown. The times are in msec. When one
- of the numbers is zero, there is no blinking. E.g.: >
+ cursor is not shown. Times are in msec. When one of
+ the numbers is zero, there is no blinking. E.g.: >
:set guicursor=n:blinkon0
-< {group-name}
- Highlight group name that sets the color and font for
- the cursor. |inverse|/reverse and no group-name are
- interpreted as "the host terminal default cursor
- colors" which usually invert bg and fg colors.
+< - Default is "blinkon0" for each mode.
+ {group-name}
+ Highlight group that decides the color and font of the
+ cursor.
+ In the |TUI|:
+ - |inverse|/reverse and no group-name are interpreted
+ as "host-terminal default cursor colors" which
+ typically means "inverted bg and fg colors".
+ - |ctermfg| and |guifg| are ignored.
{group-name}/{group-name}
Two highlight group names, the first is used when
no language mappings are used, the other when they
@@ -2796,9 +2815,6 @@ A jump table for the options with a short description can be found at |Q_op|.
font names a list can be specified, font names separated with commas.
The first valid font is used.
- On systems where 'guifontset' is supported (X11) and 'guifontset' is
- not empty, then 'guifont' is not used.
-
Spaces after a comma are ignored. To include a comma in a font name
precede it with a backslash. Setting an option requires an extra
backslash before a space and a backslash. See also
@@ -2850,45 +2866,16 @@ A jump table for the options with a short description can be found at |Q_op|.
:set guifont=courier_new:h12:w5:b:cRUSSIAN
:set guifont=Andale_Mono:h7.5:w4.5
<
-
- *'guifontset'* *'gfs'*
- *E250* *E252* *E234* *E597* *E598*
-'guifontset' 'gfs' string (default "")
- global
- When not empty, specifies two (or more) fonts to be used. The first
- one for normal English, the second one for your special language. See
- |xfontset|.
- Setting this option also means that all font names will be handled as
- a fontset name. Also the ones used for the "font" argument of the
- |:highlight| command.
- The fonts must match with the current locale. If fonts for the
- character sets that the current locale uses are not included, setting
- 'guifontset' will fail.
- Note the difference between 'guifont' and 'guifontset': In 'guifont'
- the comma-separated names are alternative names, one of which will be
- used. In 'guifontset' the whole string is one fontset name,
- including the commas. It is not possible to specify alternative
- fontset names.
- This example works on many X11 systems: >
- :set guifontset=-*-*-medium-r-normal--16-*-*-*-c-*-*-*
-<
*'guifontwide'* *'gfw'* *E231* *E533* *E534*
'guifontwide' 'gfw' string (default "")
global
- When not empty, specifies a comma-separated list of fonts to be used
- for double-width characters. The first font that can be loaded is
- used.
+ Comma-separated list of fonts to be used for double-width characters.
+ The first font that can be loaded is used.
Note: The size of these fonts must be exactly twice as wide as the one
specified with 'guifont' and the same height.
- 'guifontwide' is only used when 'guifontset' is empty or invalid.
- When 'guifont' is set and a valid font is found in it and
- 'guifontwide' is empty Vim will attempt to find a matching
- double-width font and set 'guifontwide' to it.
-
- Windows +multibyte only: *guifontwide_win_mbyte*
-
- If set and valid, 'guifontwide' is used for IME instead of 'guifont'.
+ When 'guifont' has a valid font and 'guifontwide' is empty Vim will
+ attempt to set 'guifontwide' to a matching double-width font.
*'guioptions'* *'go'*
'guioptions' 'go' string (default "egmrLT" (MS-Windows))
@@ -4055,7 +4042,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'mousefocus'* *'mousef'* *'nomousefocus'* *'nomousef'*
'mousefocus' 'mousef' boolean (default off)
global
- {only works in the GUI}
The window that the mouse pointer is on is automatically activated.
When changing the window layout or window focus in another way, the
mouse pointer is moved to the window with keyboard focus. Off is the
@@ -5028,24 +5014,18 @@ A jump table for the options with a short description can be found at |Q_op|.
will become the current directory (useful with
projects accessed over a network from different
systems)
- slash backslashes in file names replaced with forward
- slashes
tabpages all tab pages; without this only the current tab page
is restored, so that you can make a session for each
tab page separately
terminal include terminal windows where the command can be
restored
- unix with Unix end-of-line format (single <NL>), even when
- on Windows or DOS
winpos position of the whole Vim window
winsize window sizes
+ slash |deprecated| Always enabled. Uses "/" in filenames.
+ unix |deprecated| Always enabled. Uses "\n" line endings.
- Don't include both "curdir" and "sesdir".
- When neither "curdir" nor "sesdir" is included, file names are stored
- with absolute paths.
- "slash" and "unix" are useful on Windows when sharing session files
- with Unix. The Unix version of Vim cannot source dos format scripts,
- but the Windows version of Vim can source unix format scripts.
+ Don't include both "curdir" and "sesdir". When neither is included
+ filenames are stored as absolute paths.
*'shada'* *'sd'* *E526* *E527* *E528*
'shada' 'sd' string (Vim default for
@@ -5324,7 +5304,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'shellslash' only works when a backslash can be used as a path
separator. To test if this is so use: >
if exists('+shellslash')
-<
+< Also see 'completeslash'.
+
*'shelltemp'* *'stmp'* *'noshelltemp'* *'nostmp'*
'shelltemp' 'stmp' boolean (Vim default on, Vi default off)
global
@@ -5707,6 +5688,14 @@ A jump table for the options with a short description can be found at |Q_op|.
up to the first character that is not an ASCII letter or number and
not a dash. Also see |set-spc-auto|.
+ *'spelloptions'* *'spo'*
+'spelloptions' 'spo' string (default "")
+ local to buffer
+ A comma separated list of options for spell checking:
+ camel When a word is CamelCased, assume "Cased" is a
+ separate word: every upper-case character in a word
+ that comes after a lower case character indicates the
+ start of a new word.
*'spellsuggest'* *'sps'*
'spellsuggest' 'sps' string (default "best")
@@ -6532,7 +6521,9 @@ A jump table for the options with a short description can be found at |Q_op|.
>= 12 Every executed function.
>= 13 When an exception is thrown, caught, finished, or discarded.
>= 14 Anything pending in a ":finally" clause.
- >= 15 Every executed Ex command (truncated at 200 characters).
+ >= 15 Every executed Ex command from a script (truncated at 200
+ characters).
+ >= 16 Every executed Ex command
This option can also be set with the "-V" argument. See |-V|.
This option is also set by the |:verbose| command.
@@ -6571,14 +6562,8 @@ A jump table for the options with a short description can be found at |Q_op|.
options options and mappings local to a window or buffer (not
global values for local options)
localoptions same as "options"
- slash backslashes in file names replaced with forward
- slashes
- unix with Unix end-of-line format (single <NL>), even when
- on Windows or DOS
-
- "slash" and "unix" are useful on Windows when sharing view files
- with Unix. The Unix version of Vim cannot source dos format scripts,
- but the Windows version of Vim can source unix format scripts.
+ slash |deprecated| Always enabled. Uses "/" in filenames.
+ unix |deprecated| Always enabled. Uses "\n" line endings.
*'virtualedit'* *'ve'*
'virtualedit' 've' string (default "")
diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt
index 0a6cdc60e8..f944689d0b 100644
--- a/runtime/doc/provider.txt
+++ b/runtime/doc/provider.txt
@@ -129,9 +129,13 @@ To use the RVM "system" Ruby installation: >
==============================================================================
Perl integration *provider-perl*
-Nvim supports Perl |remote-plugin|s.
+Nvim supports Perl |remote-plugin|s on Unix platforms. Support for polling STDIN
+on MS-Windows is currently lacking from all known event loop implementations.
+The Vim legacy |perl-vim| interface is also supported (which is itself
+implemented as a Nvim remote-plugin).
https://github.com/jacquesg/p5-Neovim-Ext
+Note: Only perl versions from 5.22 onward are supported.
PERL QUICKSTART~
@@ -212,12 +216,12 @@ For example this configuration integrates the tmux clipboard: >
let g:clipboard = {
\ 'name': 'myClipboard',
\ 'copy': {
- \ '+': 'tmux load-buffer -',
- \ '*': 'tmux load-buffer -',
+ \ '+': ['tmux', 'load-buffer', '-'],
+ \ '*': ['tmux', 'load-buffer', '-'],
\ },
\ 'paste': {
- \ '+': 'tmux save-buffer -',
- \ '*': 'tmux save-buffer -',
+ \ '+': ['tmux', 'save-buffer', '-'],
+ \ '*': ['tmux', 'save-buffer', '-'],
\ },
\ 'cache_enabled': 1,
\ }
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 61e090cc78..9da11a553d 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -43,6 +43,7 @@ A location list is a window-local quickfix list. You get one after commands
like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a
location list instead of a quickfix list as the corresponding `:vimgrep`,
`:grep`, `:helpgrep`, `:make` do.
+ *location-list-file-window*
A location list is associated with a window and each window can have a
separate location list. A location list can be associated with only one
window. The location list is independent of the quickfix list.
@@ -501,6 +502,29 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
< Otherwise it works the same as `:ldo`.
{not in Vi}
+FILTERING A QUICKFIX OR LOCATION LIST:
+ *cfilter-plugin* *:Cfilter* *:Lfilter*
+If you have too many entries in a quickfix list, you can use the cfilter
+plugin to reduce the number of entries. Load the plugin with: >
+
+ packadd cfilter
+
+Then you can use the following commands to filter a quickfix/location list: >
+
+ :Cfilter[!] /{pat}/
+ :Lfilter[!] /{pat}/
+
+The |:Cfilter| command creates a new quickfix list from the entries matching
+{pat} in the current quickfix list. {pat} is a Vim |regular-expression|
+pattern. Both the file name and the text of the entries are matched against
+{pat}. If the optional ! is supplied, then the entries not matching {pat} are
+used. The pattern can be optionally enclosed using one of the following
+characters: ', ", /. If the pattern is empty, then the last used search
+pattern is used.
+
+The |:Lfilter| command does the same as |:Cfilter| but operates on the current
+location list.
+
=============================================================================
2. The error window *quickfix-window*
@@ -695,6 +719,9 @@ using these functions are below:
" get the location list window id of the third window
:echo getloclist(3, {'winid' : 0}).winid
+
+ " get the file window id of a location list window (winnr: 4)
+ :echo getloclist(4, {'filewinid' : 0}).filewinid
<
*setqflist-examples*
The |setqflist()| and |setloclist()| functions can be used to set the various
@@ -709,6 +736,9 @@ using these functions are below:
" set the title of the current quickfix list
:call setqflist([], 'a', {'title' : 'Mytitle'})
+ " change the current entry in the list specified by an identifier
+ :call setqflist([], 'a', {'id' : qfid, 'idx' : 10})
+
" set the context of a quickfix list specified by an identifier
:call setqflist([], 'a', {'id' : qfid, 'context' : {'val' : 100}})
@@ -1563,22 +1593,6 @@ The backslashes before the pipe character are required to avoid it to be
recognized as a command separator. The backslash before each space is
required for the set command.
- *cfilter-plugin* *:Cfilter* *:Lfilter*
-If you have too many matching messages, you can use the cfilter plugin to
-reduce the number of entries. Load the plugin with: >
- packadd cfilter
-
-Then you can use these command: >
- :Cfilter[!] /{pat}/
- :Lfilter[!] /{pat}/
-
-:Cfilter creates a new quickfix list from entries matching {pat} in the
-current quickfix list. Both the file name and the text of the entries are
-matched against {pat}. If ! is supplied, then entries not matching {pat} are
-used.
-
-:Lfilter does the same as :Cfilter but operates on the current location list.
-
=============================================================================
8. The directory stack *quickfix-directory-stack*
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 224f14a18b..4a47fd4b57 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -711,7 +711,6 @@ Short explanation of each option: *option-list*
'grepprg' 'gp' program to use for ":grep"
'guicursor' 'gcr' GUI: settings for cursor shape and blinking
'guifont' 'gfn' GUI: Name(s) of font(s) to be used
-'guifontset' 'gfs' GUI: Names of multi-byte fonts to be used
'guifontwide' 'gfw' list of font names for double-wide characters
'guioptions' 'go' GUI: Which components and options are used
'guitablabel' 'gtl' GUI: custom label for a tab page
@@ -1106,7 +1105,6 @@ Context-sensitive completion on the command-line:
------------------------------------------------------------------------------
*Q_st* Starting Vim
-|-vim| vim [options] start editing with an empty buffer
|-file| vim [options] {file} .. start editing one or more files
|--| vim [options] - read file from stdin
|-tag| vim [options] -t {tag} edit the file associated with {tag}
diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt
index b88e26cdff..0eef976819 100644
--- a/runtime/doc/spell.txt
+++ b/runtime/doc/spell.txt
@@ -187,6 +187,9 @@ When there is a line break right after a sentence the highlighting of the next
line may be postponed. Use |CTRL-L| when needed. Also see |set-spc-auto| for
how it can be set automatically when 'spelllang' is set.
+The 'spelloptions' option has a few more flags that influence the way spell
+checking works.
+
Vim counts the number of times a good word is encountered. This is used to
sort the suggestions: words that have been seen before get a small bonus,
words that have been seen often get a bigger bonus. The COMMON item in the
@@ -617,11 +620,12 @@ ask you where to write the file (there must be a writable directory in
'runtimepath' for this).
The plugin has a default place where to look for spell files, on the Vim ftp
-server. If you want to use another location or another protocol, set the
-g:spellfile_URL variable to the directory that holds the spell files. The
-|netrw| plugin is used for getting the file, look there for the specific
-syntax of the URL. Example: >
- let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'
+server. The protocol used is SSL (https://) for security. If you want to use
+another location or another protocol, set the g:spellfile_URL variable to the
+directory that holds the spell files. You can use http:// or ftp://, but you
+are taking a security risk then. The |netrw| plugin is used for getting the
+file, look there for the specific syntax of the URL. Example: >
+ let g:spellfile_URL = 'https://ftp.nluug.nl/vim/runtime/spell'
You may need to escape special characters.
The plugin will only ask about downloading a language once. If you want to
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 0ded6a9060..d0faeb9cb7 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -9,20 +9,20 @@ Starting Vim *starting*
Type |gO| to see the table of contents.
==============================================================================
-1. Vim arguments *vim-arguments*
+Nvim arguments *vim-arguments*
-Most often, Vim is started to edit a single file with the command
+Most often, Nvim is started to edit a single file with the command: >
- nvim filename *-vim*
+ nvim filename
-More generally, Vim is started with:
+More generally, Nvim is started with: >
nvim [option | filename] ..
Option arguments and file name arguments can be mixed, and any number of them
can be given. However, watch out for options that take an argument.
-The following items may be used to choose how to start editing:
+The following items decide how to start editing:
*-file* *---*
filename One or more file names. The first one will be the current
@@ -231,9 +231,8 @@ argument.
-b Binary mode. File I/O will only recognize <NL> to separate
lines. The 'expandtab' option will be reset. The 'textwidth'
option is set to 0. 'modeline' is reset. The 'binary' option
- is set. This is done after reading the init.vim/exrc files
- but before reading any file in the arglist. See also
- |edit-binary|.
+ is set. This is done after reading the |vimrc| but before
+ reading any file in the arglist. See also |edit-binary|.
*-l*
-l Lisp mode. Sets the 'lisp' and 'showmatch' options on.
@@ -398,7 +397,7 @@ argument.
primary listen address |v:servername| to {addr}. |serverstart()|
==============================================================================
-2. Initialization *initialization* *startup*
+Initialization *initialization* *startup*
At startup, Vim checks environment variables and files and sets values
accordingly. Vim proceeds in this order:
@@ -414,45 +413,47 @@ accordingly. Vim proceeds in this order:
The |-V| argument can be used to display or log what happens next,
useful for debugging the initializations.
-3. Execute Ex commands, from environment variables and/or files
- An environment variable (e.g. $VIMINIT) is read as one Ex command
- line, where multiple commands must be separated with '|' or <NL>.
+3. Wait for UI to connect.
+ Nvim started with |--embed| waits for the UI to connect before
+ proceeding to load user configuration.
+
+4. Load user config (execute Ex commands from files, environment, …).
+ $VIMINIT environment variable is read as one Ex command line (separate
+ multiple commands with '|' or <NL>).
*config* *init.vim* *vimrc* *exrc*
- A file that contains initialization commands is generically called
- a "vimrc" or config file. Each line in a vimrc file is executed as an
- Ex command line. See also |vimrc-intro| and |base-directories|.
+ A file containing init commands is generically called a "vimrc" or
+ "config". Each line in such a file is executed as an Ex command.
+ |vimrc-intro| |base-directories|
- The Nvim config file is named "init.vim", located at:
+ The Nvim config file is "init.vim", located at:
Unix ~/.config/nvim/init.vim
Windows ~/AppData/Local/nvim/init.vim
- Or if |$XDG_CONFIG_HOME| is defined:
+ or if |$XDG_CONFIG_HOME| is defined:
$XDG_CONFIG_HOME/nvim/init.vim
- If Nvim was started with "-u filename", the file "filename" is used.
- All following initializations until 4. are skipped. $MYVIMRC is not
- set.
+ If Nvim was started with "-u {file}" then {file} is used as the config
+ and all initializations until 5. are skipped. $MYVIMRC is not set.
"nvim -u NORC" can be used to skip these initializations without
reading a file. "nvim -u NONE" also skips plugins and syntax
highlighting. |-u|
- If Nvim was started with |-es|, all following initializations until 4.
- are skipped.
+ If Nvim was started with |-es| all initializations until 5. are
+ skipped.
*system-vimrc* *sysinit.vim*
a. The system vimrc file is read for initializations. If
nvim/sysinit.vim file exists in one of $XDG_CONFIG_DIRS, it will be
- used. Otherwise, the system vimrc file is used. The path of this file
- is shown with the ":version" command. Mostly it's "$VIM/sysinit.vim".
+ used. Otherwise the system vimrc file is used. The path of this file
+ is given by the |:version| command. Usually it's "$VIM/sysinit.vim".
*VIMINIT* *EXINIT* *$MYVIMRC*
- b. Four places are searched for initializations. The first that exists
- is used, the others are ignored. The $MYVIMRC environment variable is
- set to the file that was first found, unless $MYVIMRC was already set
- and when using VIMINIT.
- - Environment variable $VIMINIT, used as an Ex command line.
- - User |config| file: $XDG_CONFIG_HOME/nvim/init.vim.
- - Other config file: {xdg_config_dir}/nvim/init.vim where
- {xdg_config_dir} is one of the directories in $XDG_CONFIG_DIRS.
- - Environment variable $EXINIT, used as an Ex command line.
+ b. Locations searched for initializations, in order of preference:
+ - $VIMINIT environment variable (Ex command line).
+ - User |config|: $XDG_CONFIG_HOME/nvim/init.vim.
+ - Other config: {dir}/nvim/init.vim where {dir} is any directory
+ in $XDG_CONFIG_DIRS.
+ - $EXINIT environment variable (Ex command line).
+ |$MYVIMRC| is set to the first valid location unless it was already
+ set or when using $VIMINIT.
c. If the 'exrc' option is on (which is NOT the default), the current
directory is searched for two files. The first that exists is used,
@@ -460,7 +461,7 @@ accordingly. Vim proceeds in this order:
- The file ".nvimrc"
- The file ".exrc"
-4. Enable filetype and indent plugins.
+5. Enable filetype and indent plugins.
This does the same as the commands: >
:runtime! filetype.vim
:runtime! ftplugin.vim
@@ -468,13 +469,13 @@ accordingly. Vim proceeds in this order:
< Skipped if ":filetype … off" was called or if the "-u NONE" command
line argument was given.
-5. Enable syntax highlighting.
+6. Enable syntax highlighting.
This does the same as the command: >
:runtime! syntax/syntax.vim
< Skipped if ":syntax off" was called or if the "-u NONE" command
line argument was given.
-6. Load the plugin scripts. *load-plugins*
+7. Load the plugin scripts. *load-plugins*
This does the same as the command: >
:runtime! plugin/**/*.vim
< The result is that all directories in the 'runtimepath' option will be
@@ -503,26 +504,26 @@ accordingly. Vim proceeds in this order:
if packages have been found, but that should not add a directory
ending in "after".
-7. Set 'shellpipe' and 'shellredir'
+8. Set 'shellpipe' and 'shellredir'
The 'shellpipe' and 'shellredir' options are set according to the
value of the 'shell' option, unless they have been set before.
This means that Vim will figure out the values of 'shellpipe' and
'shellredir' for you, unless you have set them yourself.
-8. Set 'updatecount' to zero, if "-n" command argument used
+9. Set 'updatecount' to zero, if "-n" command argument used
-9. Set binary options
+10. Set binary options
If the "-b" flag was given to Vim, the options for binary editing will
be set now. See |-b|.
-10. Read the ShaDa file
+11. Read the ShaDa file
See |shada-file|.
-11. Read the quickfix file
+12. Read the quickfix file
If the "-q" flag was given to Vim, the quickfix file is read. If this
fails, Vim exits.
-12. Open all windows
+13. Open all windows
When the |-o| flag was given, windows will be opened (but not
displayed yet).
When the |-p| flag was given, tab pages will be created (but not
@@ -531,7 +532,7 @@ accordingly. Vim proceeds in this order:
If the "-q" flag was given to Vim, the first error is jumped to.
Buffers for all windows will be loaded.
-13. Execute startup commands
+14. Execute startup commands
If a "-t" flag was given to Vim, the tag is jumped to.
The commands given with the |-c| and |+cmd| arguments are executed.
If the 'insertmode' option is set, Insert mode is entered.
@@ -540,29 +541,6 @@ accordingly. Vim proceeds in this order:
The |VimEnter| autocommands are executed.
-Some hints on using initializations ~
-
-Standard setup:
-Create a vimrc file to set the default settings and mappings for all your edit
-sessions. Put it in a place so that it will be found by 3b:
- ~/.config/nvim/init.vim (Unix)
- ~/AppData/Local/nvim/init.vim (Win32)
-
-Local setup:
-Put all commands that you need for editing a specific directory only into a
-vimrc file and place it in that directory under the name ".nvimrc" ("_nvimrc"
-for Windows). NOTE: To make Vim look for these special files you
-have to turn on the option 'exrc'. See |trojan-horse| too.
-
-System setup:
-This only applies if you are managing a Unix system with several users and
-want to set the defaults for all users. Create a vimrc file with commands
-for default settings and mappings and put it in the place that is given with
-the ":version" command. NOTE: System vimrc file needs specific compilation
-options (one needs to define SYS_VIMRC_FILE macros). If :version command does
-not show anything like this, consider contacting the nvim package maintainer.
-
-
Saving the current state of Vim to a file ~
Whenever you have changed values of options or when you have created a
@@ -570,20 +548,6 @@ mapping, then you may want to save them in a vimrc file for later use. See
|save-settings| about saving the current state of settings to a file.
-Avoiding setup problems for Vi users ~
-
-Vi uses the variable EXINIT and the file "~/.exrc". So if you do not want to
-interfere with Vi, then use the variable VIMINIT and the file init.vim
-instead.
-
-
-MS-DOS line separators: ~
-
-On Windows systems Vim assumes that all the vimrc files have <CR> <NL> pairs
-as line separators. This will give problems if you have a file with only
-<NL>s and have a line like ":map xx yy^M". The trailing ^M will be ignored.
-
-
Avoiding trojan horses ~
*trojan-horse*
While reading the "vimrc" or the "exrc" file in the current directory, some
@@ -606,7 +570,7 @@ it possible for another user to create a nasty vimrc and make you the owner.
Be careful!
When using tag search commands, executing the search command (the last
part of the line in the tags file) is always done in secure mode. This works
-just like executing a command from a vimrc/exrc in the current directory.
+just like executing a command from a vimrc in the current directory.
If Vim startup is slow ~
@@ -620,27 +584,29 @@ moment (use the Vim argument "-i NONE", |-i|). Try reducing the number of
lines stored in a register with ":set shada='20,<50,s10". |shada-file|.
-Intro message ~
- *:intro*
-When Vim starts without a file name, an introductory message is displayed (for
-those who don't know what Vim is). It is removed as soon as the display is
-redrawn in any way. To see the message again, use the ":intro" command (if
-there is not enough room, you will see only part of it).
- To avoid the intro message on startup, add the 'I' flag to 'shortmess'.
+Troubleshooting broken configurations ~
+ *bisect*
+The extreme flexibility of editors like Vim and Emacs means that any plugin or
+setting can affect the entire editor in ways that are not initially obvious.
- *info-message*
-The |--help| and |--version| arguments cause Nvim to print a message and then
-exit. Normally the message is sent to stdout, thus can be redirected to a
-file with: >
+To find the cause of a problem in your config, you must "bisect" it:
+1. Remove or disable half of your `init.vim`.
+2. Restart Nvim.
+3. If the problem still occurs, goto 1.
+4. If the problem is gone, restore half of the removed lines.
+5. Continue narrowing your config in this way, until you find the setting or
+ plugin causing the issue.
- nvim --help >file
-From inside Nvim: >
-
- :read !nvim --help
+Intro message ~
+ *:intro*
+When Vim starts without a file name, an introductory message is displayed. It
+is removed as soon as the display is redrawn. To see the message again, use
+the ":intro" command. To avoid the intro message on startup, add the "I" flag
+to 'shortmess'.
==============================================================================
-3. $VIM and $VIMRUNTIME
+$VIM and $VIMRUNTIME
*$VIM*
The environment variable "$VIM" is used to locate various user files for Nvim,
such as the user startup script |init.vim|. This depends on the system, see
@@ -683,9 +649,9 @@ greps in the help files) you might be able to use this: >
VIMRUNTIME="$(nvim --clean --headless --cmd 'echo $VIMRUNTIME|q')"
==============================================================================
-4. Suspending *suspend*
+Suspending *suspend*
- *iconize* *iconise* *CTRL-Z* *v_CTRL-Z*
+ *CTRL-Z* *v_CTRL-Z*
CTRL-Z Suspend Nvim, like ":stop".
Works in Normal and in Visual mode. In Insert and
Command-line mode, the CTRL-Z is inserted as a normal
@@ -706,7 +672,7 @@ CTRL-Z Suspend Nvim, like ":stop".
In the GUI, suspending is implementation-defined.
==============================================================================
-5. Exiting *exiting*
+Exiting *exiting*
There are several ways to exit Vim:
- Close the last window with `:quit`. Only when there are no changes.
@@ -719,7 +685,7 @@ When using `:cquit` or when there was an error message Vim exits with exit
code 1. Errors can be avoided by using `:silent!` or with `:catch`.
==============================================================================
-6. Saving settings *save-settings*
+Saving settings *save-settings*
Mostly you will edit your vimrc files manually. This gives you the greatest
flexibility. There are a few commands to generate a vimrc file automatically.
@@ -776,7 +742,7 @@ these steps:
You need to escape special characters, esp. spaces.
==============================================================================
-7. Views and Sessions *views-sessions*
+Views and Sessions *views-sessions*
This is introduced in sections |21.4| and |21.5| of the user manual.
@@ -920,7 +886,7 @@ To automatically save and restore views for *.c files: >
au BufWinEnter *.c silent! loadview
==============================================================================
-8. The ShaDa file *shada* *shada-file*
+Shada ("shared data") file *shada* *shada-file*
If you exit Vim and later start it again, you would normally lose a lot of
information. The ShaDa file can be used to remember that information, which
@@ -1358,7 +1324,7 @@ file when reading and include:
complete MessagePack object.
==============================================================================
-9. Standard Paths *standard-path*
+Standard Paths *standard-path*
Nvim stores configuration and data in standard locations. Plugins are strongly
encouraged to follow this pattern also. Use |stdpath()| to get the paths.
@@ -1389,4 +1355,5 @@ debugging, plugins and RPC clients. >
Usually the file is ~/.local/share/nvim/log unless that path is inaccessible
or if $NVIM_LOG_FILE was set before |startup|.
+
vim:noet:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
new file mode 100644
index 0000000000..7f644486f7
--- /dev/null
+++ b/runtime/doc/treesitter.txt
@@ -0,0 +1,295 @@
+*treesitter.txt* Nvim
+
+
+ NVIM REFERENCE MANUAL
+
+
+Tree-sitter integration *treesitter*
+
+ Type |gO| to see the table of contents.
+
+------------------------------------------------------------------------------
+VIM.TREESITTER *lua-treesitter*
+
+Nvim integrates the tree-sitter library for incremental parsing of buffers.
+
+Currently Nvim does not provide the tree-sitter parsers, instead these must
+be built separately, for instance using the tree-sitter utility. The only
+exception is a C parser being included in official builds for testing
+purposes. Parsers are searched for as `parser/{lang}.*` in any 'runtimepath'
+directory. A parser can also be loaded manually using a full path: >
+
+ vim.treesitter.require_language("python", "/path/to/python.so")
+
+<Create a parser for a buffer and a given language (if another plugin uses the
+same buffer/language combination, it will be safely reused). Use >
+
+ parser = vim.treesitter.get_parser(bufnr, lang)
+
+<`bufnr=0` can be used for current buffer. `lang` will default to 'filetype' (this
+doesn't work yet for some filetypes like "cpp") Currently, the parser will be
+retained for the lifetime of a buffer but this is subject to change. A plugin
+should keep a reference to the parser object as long as it wants incremental
+updates.
+
+Parser files *treesitter-parsers*
+
+Parsers are the heart of tree-sitter. They are libraries that tree-sitter will
+search for in the `parser` runtime directory.
+
+For a parser to be available for a given language, there must be a file named
+`{lang}.so` within the parser directory.
+
+Parser methods *lua-treesitter-parser*
+
+tsparser:parse() *tsparser:parse()*
+Whenever you need to access the current syntax tree, parse the buffer: >
+
+ tstree = parser:parse()
+
+<This will return an immutable tree that represents the current state of the
+buffer. When the plugin wants to access the state after a (possible) edit
+it should call `parse()` again. If the buffer wasn't edited, the same tree will
+be returned again without extra work. If the buffer was parsed before,
+incremental parsing will be done of the changed parts.
+
+NB: to use the parser directly inside a |nvim_buf_attach| Lua callback, you must
+call `get_parser()` before you register your callback. But preferably parsing
+shouldn't be done directly in the change callback anyway as they will be very
+frequent. Rather a plugin that does any kind of analysis on a tree should use
+a timer to throttle too frequent updates.
+
+tsparser:set_included_ranges({ranges}) *tsparser:set_included_ranges()*
+ Changes the ranges the parser should consider. This is used for
+ language injection. {ranges} should be of the form (all zero-based): >
+ {
+ {start_node, end_node},
+ ...
+ }
+<
+ NOTE: `start_node` and `end_node` are both inclusive.
+
+Tree methods *lua-treesitter-tree*
+
+tstree:root() *tstree:root()*
+ Return the root node of this tree.
+
+
+Node methods *lua-treesitter-node*
+
+tsnode:parent() *tsnode:parent()*
+ Get the node's immediate parent.
+
+tsnode:iter_children() *tsnode:iter_children()*
+ Iterates over all the direct children of {tsnode}, regardless of
+ wether they are named or not.
+ Returns the child node plus the eventual field name corresponding to
+ this child node.
+
+tsnode:field({name}) *tsnode:field()*
+ Returns a table of the nodes corresponding to the {name} field.
+
+tsnode:child_count() *tsnode:child_count()*
+ Get the node's number of children.
+
+tsnode:child({index}) *tsnode:child()*
+ Get the node's child at the given {index}, where zero represents the
+ first child.
+
+tsnode:named_child_count() *tsnode:named_child_count()*
+ Get the node's number of named children.
+
+tsnode:named_child({index}) *tsnode:named_child()*
+ Get the node's named child at the given {index}, where zero represents
+ the first named child.
+
+tsnode:start() *tsnode:start()*
+ Get the node's start position. Return three values: the row, column
+ and total byte count (all zero-based).
+
+tsnode:end_() *tsnode:end_()*
+ Get the node's end position. Return three values: the row, column
+ and total byte count (all zero-based).
+
+tsnode:range() *tsnode:range()*
+ Get the range of the node. Return four values: the row, column
+ of the start position, then the row, column of the end position.
+
+tsnode:type() *tsnode:type()*
+ Get the node's type as a string.
+
+tsnode:symbol() *tsnode:symbol()*
+ Get the node's type as a numerical id.
+
+tsnode:named() *tsnode:named()*
+ Check if the node is named. Named nodes correspond to named rules in
+ the grammar, whereas anonymous nodes correspond to string literals
+ in the grammar.
+
+tsnode:missing() *tsnode:missing()*
+ Check if the node is missing. Missing nodes are inserted by the
+ parser in order to recover from certain kinds of syntax errors.
+
+tsnode:has_error() *tsnode:has_error()*
+ Check if the node is a syntax error or contains any syntax errors.
+
+tsnode:sexpr() *tsnode:sexpr()*
+ Get an S-expression representing the node as a string.
+
+tsnode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col})
+ *tsnode:descendant_for_range()*
+ Get the smallest node within this node that spans the given range of
+ (row, column) positions
+
+tsnode:named_descendant_for_range({start_row}, {start_col}, {end_row}, {end_col})
+ *tsnode:named_descendant_for_range()*
+ Get the smallest named node within this node that spans the given
+ range of (row, column) positions
+
+Query methods *lua-treesitter-query*
+
+Tree-sitter queries are supported, with some limitations. Currently, the only
+supported match predicate is `eq?` (both comparing a capture against a string
+and two captures against each other).
+
+vim.treesitter.parse_query({lang}, {query})
+ *vim.treesitter.parse_query()*
+ Parse {query} as a string. (If the query is in a file, the caller
+ should read the contents into a string before calling).
+
+query:iter_captures({node}, {bufnr}, {start_row}, {end_row})
+ *query:iter_captures()*
+ Iterate over all captures from all matches inside {node}.
+ {bufnr} is needed if the query contains predicates, then the caller
+ must ensure to use a freshly parsed tree consistent with the current
+ text of the buffer. {start_row} and {end_row} can be used to limit
+ matches inside a row range (this is typically used with root node
+ as the node, i e to get syntax highlight matches in the current
+ viewport)
+
+ The iterator returns two values, a numeric id identifying the capture
+ and the captured node. The following example shows how to get captures
+ by name:
+>
+ for id, node in query:iter_captures(tree:root(), bufnr, first, last) do
+ local name = query.captures[id] -- name of the capture in the query
+ -- typically useful info about the node:
+ local type = node:type() -- type of the captured node
+ local row1, col1, row2, col2 = node:range() -- range of the capture
+ ... use the info here ...
+ end
+<
+query:iter_matches({node}, {bufnr}, {start_row}, {end_row})
+ *query:iter_matches()*
+ Iterate over all matches within a node. The arguments are the same as
+ for |query:iter_captures()| but the iterated values are different:
+ an (1-based) index of the pattern in the query, and a table mapping
+ capture indices to nodes. If the query has more than one pattern
+ the capture table might be sparse, and e.g. `pairs` should be used and not
+ `ipairs`. Here an example iterating over all captures in
+ every match:
+>
+ for pattern, match in cquery:iter_matches(tree:root(), bufnr, first, last) do
+ for id,node in pairs(match) do
+ local name = query.captures[id]
+ -- `node` was captured by the `name` capture in the match
+ ... use the info here ...
+ end
+ end
+
+Treesitter Query Predicates *lua-treesitter-predicates*
+
+When writing queries for treesitter, one might use `predicates`, that is,
+special scheme nodes that are evaluted to verify things on a captured node for
+example, the |eq?| predicate : >
+ ((identifier) @foo (#eq? @foo "foo"))
+
+This will only match identifier corresponding to the `"foo"` text.
+Here is a list of built-in predicates :
+
+ `eq?` *ts-predicate-eq?*
+ This predicate will check text correspondance between nodes or
+ strings : >
+ ((identifier) @foo (#eq? @foo "foo"))
+ ((node1) @left (node2) @right (#eq? @left @right))
+<
+ `match?` *ts-predicate-match?*
+ `vim-match?` *ts-predicate-vim-match?*
+ This will match if the provived vim regex matches the text
+ corresponding to a node : >
+ ((idenfitier) @constant (#match? @constant "^[A-Z_]+$"))
+< Note: the `^` and `$` anchors will respectively match the
+ start and end of the node's text.
+
+ `lua-match?` *ts-predicate-lua-match?*
+ This will match the same way than |match?| but using lua
+ regexes.
+
+ `contains?` *ts-predicate-contains?*
+ Will check if any of the following arguments appears in the
+ text corresponding to the node : >
+ ((identifier) @foo (#contains? @foo "foo"))
+ ((identifier) @foo-bar (#contains @foo-bar "foo" "bar"))
+<
+ *lua-treesitter-not-predicate*
+Each predicate has a `not-` prefixed predicate that is just the negation of
+the predicate.
+
+ *vim.treesitter.query.add_predicate()*
+vim.treesitter.query.add_predicate({name}, {handler})
+
+This adds a predicate with the name {name} to be used in queries.
+{handler} should be a function whose signature will be : >
+ handler(match, pattern, bufnr, predicate)
+<
+ *vim.treesitter.query.list_predicates()*
+vim.treesitter.query.list_predicates()
+
+This lists the currently available predicates to use in queries.
+
+Treesitter syntax highlighting (WIP) *lua-treesitter-highlight*
+
+NOTE: This is a partially implemented feature, and not usable as a default
+solution yet. What is documented here is a temporary interface indented
+for those who want to experiment with this feature and contribute to
+its development.
+
+Highlights are defined in the same query format as in the tree-sitter highlight
+crate, which some limitations and additions. Set a highlight query for a
+buffer with this code: >
+
+ local query = [[
+ "for" @keyword
+ "if" @keyword
+ "return" @keyword
+
+ (string_literal) @string
+ (number_literal) @number
+ (comment) @comment
+
+ (preproc_function_def name: (identifier) @function)
+
+ ; ... more definitions
+ ]]
+
+ highlighter = vim.treesitter.TSHighlighter.new(query, bufnr, lang)
+ -- alternatively, to use the current buffer and its filetype:
+ -- highlighter = vim.treesitter.TSHighlighter.new(query)
+
+ -- Don't recreate the highlighter for the same buffer, instead
+ -- modify the query like this:
+ local query2 = [[ ... ]]
+ highlighter:set_query(query2)
+
+As mentioned above the supported predicate is currently only `eq?`. `match?`
+predicates behave like matching always fails. As an addition a capture which
+begin with an upper-case letter like `@WarningMsg` will map directly to this
+highlight group, if defined. Also if the predicate begins with upper-case and
+contains a dot only the part before the first will be interpreted as the
+highlight group. As an example, this warns of a binary expression with two
+identical identifiers, highlighting both as |hl-WarningMsg|: >
+
+ ((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right)
+ (eq? @WarningMsg.left @WarningMsg.right))
+
+ vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index 2817c1015b..e5c6b9b1b7 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -183,9 +183,9 @@ the editor.
'ambiwidth'
'emoji'
'guifont'
- 'guifontset'
'guifontwide'
'linespace'
+ 'mousefocus'
'pumblend'
'showtabline'
'termguicolors'
@@ -719,7 +719,7 @@ events, which the UI must handle.
kind
Name indicating the message kind:
- "" (empty) Unknown, report a |feature-request|
+ "" (empty) Unknown (consider a feature-request: |bugs|)
"confirm" |confirm()| or |:confirm| dialog
"confirm_sub" |:substitute| confirm dialog |:s_c|
"emsg" Error (|errors|, internal error, |:throw|, …)
diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt
index 9ebbd11ac7..c8fd7c3e35 100644
--- a/runtime/doc/usr_02.txt
+++ b/runtime/doc/usr_02.txt
@@ -652,7 +652,7 @@ Summary: *help-summary* >
22) Autocommand events can be found by their name: >
:help BufWinLeave
< To see all possible events: >
- :help autocommand-events
+ :help events
23) Command-line switches always start with "-". So for the help of the -f
command switch of Vim use: >
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 24b562543e..1fcb6611b4 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -13,7 +13,7 @@ the differences.
Type |gO| to see the table of contents.
==============================================================================
-1. Configuration *nvim-configuration*
+1. Configuration *nvim-config*
- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for configuration.
- Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files.
@@ -50,7 +50,7 @@ the differences.
- 'listchars' defaults to "tab:> ,trail:-,nbsp:+"
- 'nrformats' defaults to "bin,hex"
- 'ruler' is enabled
-- 'sessionoptions' excludes "options"
+- 'sessionoptions' includes "unix,slash", excludes "options"
- 'shortmess' includes "F", excludes "S"
- 'showcmd' is enabled
- 'sidescroll' defaults to 1
@@ -60,13 +60,14 @@ the differences.
- 'tags' defaults to "./tags;,tags"
- 'ttimeoutlen' defaults to 50
- 'ttyfast' is always set
+- 'viewoptions' includes "unix,slash"
- 'undodir' defaults to ~/.local/share/nvim/undo (|xdg|), auto-created
- 'viminfo' includes "!"
- 'wildmenu' is enabled
- 'wildoptions' defaults to "pum,tagfile"
-- The |man.vim| plugin is enabled, to provide the |:Man| command.
-- The |matchit| plugin is enabled. To disable it in your config: >
+- |man.vim| plugin is enabled, so |:Man| is available by default.
+- |matchit| plugin is enabled. To disable it in your config: >
:let loaded_matchit = 1
==============================================================================
@@ -172,6 +173,7 @@ Functions:
|msgpackdump()|, |msgpackparse()| provide msgpack de/serialization
|stdpath()|
|system()|, |systemlist()| can run {cmd} directly (without 'shell')
+ |tabpagenr()| "#" argument
Highlight groups:
|highlight-blend| controls blend level for a highlight group
@@ -186,18 +188,18 @@ Highlight groups:
|hl-TermCursorNC|
|hl-Whitespace| highlights 'listchars' whitespace
-Input:
+Input/Mappings:
+ |<Cmd>| pseudokey
+
ALT (|META|) chords always work (even in the |TUI|). Map |<M-| with any key:
<M-1>, <M-BS>, <M-Del>, <M-Ins>, <M-/>, <M-\>, <M-Space>, <M-Enter>, etc.
Case-sensitive: <M-a> and <M-A> are two different keycodes.
- ALT in insert-mode behaves like <Esc> if not mapped. |i_ALT|
-
-Mappings:
- |<Cmd>| pseudokey
+ ALT behaves like <Esc> if not mapped. |i_ALT| |v_ALT| |c_ALT|
Normal commands:
- "Outline": Type |gO| in |:Man| and |:help| pages to see a document outline.
+ |g<Tab>| goes to the last-accessed tabpage.
+ |gO| shows a filetype-defined "outline" of the current buffer.
Options:
'cpoptions' flags: |cpo-_|
@@ -406,7 +408,6 @@ Some legacy Vim features are not implemented:
- |if_lua|: Nvim Lua API is not compatible with Vim's "if_lua"
- *if_mzscheme*
-- *if_perl*
- |if_py|: *python-bindeval* *python-Function* are not supported
- *if_tcl*
@@ -449,6 +450,9 @@ Eval:
*js_decode()*
*v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead.
+Events:
+ *SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead.
+
Highlight groups:
*hl-StatusLineTerm* *hl-StatusLineTermNC* are unnecessary because Nvim
supports 'winhighlight' window-local highlights.
@@ -471,6 +475,7 @@ Options:
'encoding' ("utf-8" is always used)
'esckeys'
'guioptions' "t" flag was removed
+ *'guifontset'* *'gfs'* (Use 'guifont' instead.)
*'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.)
'highlight' (Names of builtin |highlight-groups| cannot be changed.)
*'imactivatefunc'* *'imaf'*
@@ -506,7 +511,6 @@ Test functions:
test_alloc_fail()
test_autochdir()
test_disable_char_avail()
- test_garbagecollect_now()
test_null_channel()
test_null_dict()
test_null_job()
diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt
index 0052382044..fd3d93ed98 100644
--- a/runtime/doc/visual.txt
+++ b/runtime/doc/visual.txt
@@ -159,7 +159,10 @@ If you want to highlight exactly the same area as the last time, you can use
*v_<Esc>*
<Esc> In Visual mode: Stop Visual mode.
-
+ *v_META* *v_ALT*
+ ALT (|META|) acts like <Esc> if the chord is not mapped.
+ For example <A-x> acts like <Esc>x if <A-x> does not have a
+ visual-mode mapping.
*v_CTRL-C*
CTRL-C In Visual mode: Stop Visual mode. When insert mode is
pending (the mode message shows
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index c0d656107c..7accc22b3d 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -180,7 +180,7 @@ au BufNewFile,BufRead *.at setf m4
au BufNewFile,BufRead *.ave setf ave
" Awk
-au BufNewFile,BufRead *.awk setf awk
+au BufNewFile,BufRead *.awk,*.gawk setf awk
" B
au BufNewFile,BufRead *.mch,*.ref,*.imp setf b
@@ -236,10 +236,10 @@ au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml
au BufNewFile,BufRead *bsd,*.bsdl setf bsdl
" Bazel (http://bazel.io)
-autocmd BufRead,BufNewFile *.bzl,WORKSPACE,BUILD.bazel setf bzl
+autocmd BufRead,BufNewFile *.bzl,*.bazel,WORKSPACE setf bzl
if has("fname_case")
" There is another check for BUILD further below.
- autocmd BufRead,BufNewFile BUILD setf bzl
+ autocmd BufRead,BufNewFile *.BUILD,BUILD setf bzl
endif
" C or lpc
@@ -313,7 +313,7 @@ au BufNewFile,BufRead *.css setf css
au BufNewFile,BufRead *.con setf cterm
" Changelog
-au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch
+au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch,*/debian/changelog
\ setf debchangelog
au BufNewFile,BufRead [cC]hange[lL]og
@@ -1089,6 +1089,9 @@ au BufNewFile,BufRead .netrc setf netrc
" Ninja file
au BufNewFile,BufRead *.ninja setf ninja
+" NPM RC file
+au BufNewFile,BufRead npmrc,.npmrc setf dosini
+
" Novell netware batch files
au BufNewFile,BufRead *.ncf setf ncf
@@ -1155,10 +1158,10 @@ au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
au BufNewFile,BufRead */etc/passwd,*/etc/passwd-,*/etc/passwd.edit,*/etc/shadow,*/etc/shadow-,*/etc/shadow.edit,*/var/backups/passwd.bak,*/var/backups/shadow.bak setf passwd
" Pascal (also *.p)
-au BufNewFile,BufRead *.pas setf pascal
+au BufNewFile,BufRead *.pas,*.pp setf pascal
-" Delphi project file
-au BufNewFile,BufRead *.dpr setf pascal
+" Delphi or Lazarus program file
+au BufNewFile,BufRead *.dpr,*.lpr setf pascal
" PDF
au BufNewFile,BufRead *.pdf setf pdf
@@ -1195,6 +1198,9 @@ au BufNewFile,BufRead *.pod6 setf pod6
" Also .ctp for Cake template file
au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php
+" PHP config
+au BufNewFile,BufRead php.ini,php.ini-* setf dosini
+
" Pike and Cmod
au BufNewFile,BufRead *.pike,*.pmod setf pike
au BufNewFile,BufRead *.cmod setf cmod
@@ -1726,7 +1732,7 @@ au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo
au BufNewFile,BufRead texmf.cnf setf texmf
" Tidy config
-au BufNewFile,BufRead .tidyrc,tidyrc setf tidy
+au BufNewFile,BufRead .tidyrc,tidyrc,tidy.conf setf tidy
" TF mud client
au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf
@@ -2035,7 +2041,7 @@ au BufNewFile,BufRead bzr_log.* setf bzr
" Bazel build file
if !has("fname_case")
- au BufNewFile,BufRead BUILD setf bzl
+ au BufNewFile,BufRead *.BUILD,BUILD setf bzl
endif
" BIND zone
diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim
index 277ba94e8b..fc1d9e068b 100644
--- a/runtime/ftplugin/markdown.vim
+++ b/runtime/ftplugin/markdown.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Markdown
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2016 Aug 29
+" Last Change: 2019 Dec 05
if exists("b:did_ftplugin")
finish
@@ -9,7 +9,7 @@ endif
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
-setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
+setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:
@@ -19,32 +19,56 @@ else
let b:undo_ftplugin = "setl cms< com< fo< flp<"
endif
-function! MarkdownFold()
+function! s:NotCodeBlock(lnum) abort
+ return synIDattr(synID(v:lnum, 1, 1), 'name') !=# 'markdownCode'
+endfunction
+
+function! MarkdownFold() abort
let line = getline(v:lnum)
- " Regular headers
- let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=')
- if depth > 0
- return ">" . depth
+ if line =~# '^#\+ ' && s:NotCodeBlock(v:lnum)
+ return ">" . match(line, ' ')
endif
- " Setext style headings
let nextline = getline(v:lnum + 1)
- if (line =~ '^.\+$') && (nextline =~ '^=\+$')
+ if (line =~ '^.\+$') && (nextline =~ '^=\+$') && s:NotCodeBlock(v:lnum + 1)
return ">1"
endif
- if (line =~ '^.\+$') && (nextline =~ '^-\+$')
+ if (line =~ '^.\+$') && (nextline =~ '^-\+$') && s:NotCodeBlock(v:lnum + 1)
return ">2"
endif
return "="
endfunction
+function! s:HashIndent(lnum) abort
+ let hash_header = matchstr(getline(a:lnum), '^#\{1,6}')
+ if len(hash_header)
+ return hash_header
+ else
+ let nextline = getline(a:lnum + 1)
+ if nextline =~# '^=\+\s*$'
+ return '#'
+ elseif nextline =~# '^-\+\s*$'
+ return '##'
+ endif
+ endif
+endfunction
+
+function! MarkdownFoldText() abort
+ let hash_indent = s:HashIndent(v:foldstart)
+ let title = substitute(getline(v:foldstart), '^#\+\s*', '', '')
+ let foldsize = (v:foldend - v:foldstart + 1)
+ let linecount = '['.foldsize.' lines]'
+ return hash_indent.' '.title.' '.linecount
+endfunction
+
if has("folding") && exists("g:markdown_folding")
setlocal foldexpr=MarkdownFold()
setlocal foldmethod=expr
- let b:undo_ftplugin .= " foldexpr< foldmethod<"
+ setlocal foldtext=MarkdownFoldText()
+ let b:undo_ftplugin .= " foldexpr< foldmethod< foldtext<"
endif
" vim:set sw=2:
diff --git a/runtime/ftplugin/typescript.vim b/runtime/ftplugin/typescript.vim
new file mode 100644
index 0000000000..f701ae96cd
--- /dev/null
+++ b/runtime/ftplugin/typescript.vim
@@ -0,0 +1,39 @@
+" Vim filetype plugin file
+" Language: TypeScript
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2019 Aug 30
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+" Set 'formatoptions' to break comment lines but not other lines,
+" and insert the comment leader when hitting <CR> or using "o".
+setlocal formatoptions-=t formatoptions+=croql
+
+" Set 'comments' to format dashed lists in comments.
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
+
+setlocal commentstring=//%s
+
+setlocal suffixesadd+=.ts,.d.ts,.tsx,.js,.jsx,.cjs,.mjs
+
+" Change the :browse e filter to primarily show TypeScript-related files.
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter="TypeScript Files (*.ts)\t*.ts\n" .
+ \ "TypeScript Declaration Files (*.d.ts)\t*.d.ts\n" .
+ \ "TSX Files (*.tsx)\t*.tsx\n" .
+ \ "JavaScript Files (*.js)\t*.js\n" .
+ \ "JavaScript Modules (*.es, *.cjs, *.mjs)\t*.es;*.cjs;*.mjs\n" .
+ \ "JSON Files (*.json)\t*.json\n" .
+ \ "All Files (*.*)\t*.*\n"
+endif
+
+let b:undo_ftplugin = "setl fo< com< cms< sua< | unlet! b:browsefilter"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/ftplugin/typescriptreact.vim b/runtime/ftplugin/typescriptreact.vim
new file mode 100644
index 0000000000..3bd6001a18
--- /dev/null
+++ b/runtime/ftplugin/typescriptreact.vim
@@ -0,0 +1,33 @@
+" Vim filetype plugin file
+" Language: TypeScript React
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2020 Aug 09
+
+let s:match_words = ""
+let s:undo_ftplugin = ""
+
+runtime! ftplugin/typescript.vim
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+if exists("b:match_words")
+ let s:match_words = b:match_words
+endif
+if exists("b:undo_ftplugin")
+ let s:undo_ftplugin = b:undo_ftplugin
+endif
+
+" Matchit configuration
+if exists("loaded_matchit")
+ let b:match_ignorecase = 0
+ let b:match_words = s:match_words .
+ \ '<:>,' .
+ \ '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,' .
+ \ '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>'
+endif
+
+let b:undo_ftplugin = "unlet! b:match_words b:match_ignorecase | " . s:undo_ftplugin
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/indent/typescript.vim b/runtime/indent/typescript.vim
index 69accaa054..b6b2cb5acf 100644
--- a/runtime/indent/typescript.vim
+++ b/runtime/indent/typescript.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: TypeScript
" Maintainer: See https://github.com/HerringtonDarkholme/yats.vim
-" Last Change: 2019 Jun 06
+" Last Change: 2019 Oct 18
" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org
" 0. Initialization {{{1
@@ -442,7 +442,7 @@ let &cpo = s:cpo_save
unlet s:cpo_save
function! Fixedgq(lnum, count)
- let l:tw = &tw ? &tw : 80;
+ let l:tw = &tw ? &tw : 80
let l:count = a:count
let l:first_char = indent(a:lnum) + 1
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua
index ce0a3de520..705b34dc99 100644
--- a/runtime/lua/vim/highlight.lua
+++ b/runtime/lua/vim/highlight.lua
@@ -14,7 +14,7 @@ function highlight.range(bufnr, ns, higroup, start, finish, rtype, inclusive)
inclusive = inclusive or false
-- sanity check
- if start[2] < 0 or finish[2] < start[2] then return end
+ if start[2] < 0 or finish[1] < start[1] then return end
local region = vim.region(bufnr, start, finish, rtype, inclusive)
for linenr, cols in pairs(region) do
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 6fe1d15b7e..1a0015e2db 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -25,13 +25,44 @@ local lsp = {
-- format_rpc_error = lsp_rpc.format_rpc_error;
}
+-- maps request name to the required resolved_capability in the client.
+lsp._request_name_to_capability = {
+ ['textDocument/hover'] = 'hover';
+ ['textDocument/signatureHelp'] = 'signature_help';
+ ['textDocument/definition'] = 'goto_definition';
+ ['textDocument/implementation'] = 'implementation';
+ ['textDocument/declaration'] = 'declaration';
+ ['textDocument/typeDefinition'] = 'type_definition';
+ ['textDocument/documentSymbol'] = 'document_symbol';
+ ['textDocument/workspaceSymbol'] = 'workspace_symbol';
+ ['textDocument/prepareCallHierarchy'] = 'call_hierarchy';
+ ['textDocument/rename'] = 'rename';
+ ['textDocument/codeAction'] = 'code_action';
+ ['workspace/executeCommand'] = 'execute_command';
+ ['textDocument/references'] = 'find_references';
+ ['textDocument/rangeFormatting'] = 'document_range_formatting';
+ ['textDocument/formatting'] = 'document_formatting';
+ ['textDocument/completion'] = 'completion';
+ ['textDocument/documentHighlight'] = 'document_highlight';
+}
+
-- TODO improve handling of scratch buffers with LSP attached.
+--@private
+--- Concatenates and writes a list of strings to the Vim error buffer.
+---
+--@param {...} (List of strings) List to write to the buffer
local function err_message(...)
nvim_err_writeln(table.concat(vim.tbl_flatten{...}))
nvim_command("redraw")
end
+--@private
+--- Returns the buffer number for the given {bufnr}.
+---
+--@param bufnr (number) Buffer number to resolve. Defaults to the current
+---buffer if not given.
+--@returns bufnr (number) Number of requested buffer
local function resolve_bufnr(bufnr)
validate { bufnr = { bufnr, 'n', true } }
if bufnr == nil or bufnr == 0 then
@@ -40,6 +71,21 @@ local function resolve_bufnr(bufnr)
return bufnr
end
+--@private
+--- callback called by the client when trying to call a method that's not
+--- supported in any of the servers registered for the current buffer.
+--@param method (string) name of the method
+function lsp._unsupported_method(method)
+ local msg = string.format("method %s is not supported by any of the servers registered for the current buffer", method)
+ log.warn(msg)
+ return lsp.rpc_response_error(protocol.ErrorCodes.MethodNotFound, msg)
+end
+
+--@private
+--- Checks whether a given path is a directory.
+---
+--@param filename (string) path to check
+--@returns true if {filename} exists and is a directory, false otherwise
local function is_dir(filename)
validate{filename={filename,'s'}}
local stat = uv.fs_stat(filename)
@@ -55,6 +101,10 @@ local valid_encodings = {
}
local client_index = 0
+--@private
+--- Returns a new, unused client id.
+---
+--@returns (number) client id
local function next_client_id()
client_index = client_index + 1
return client_index
@@ -64,6 +114,12 @@ local active_clients = {}
local all_buffer_active_clients = {}
local uninitialized_clients = {}
+--@private
+--- Invokes a callback for each LSP client attached to the buffer {bufnr}.
+---
+--@param bufnr (Number) of buffer
+--@param callback (function({client}, {client_id}, {bufnr}) Function to run on
+---each client attached to that buffer.
local function for_each_buffer_client(bufnr, callback)
validate {
callback = { callback, 'f' };
@@ -88,6 +144,11 @@ lsp.client_errors = tbl_extend("error", lsp_rpc.client_errors, vim.tbl_add_rever
ON_INIT_CALLBACK_ERROR = table.maxn(lsp_rpc.client_errors) + 1;
})
+--@private
+--- Normalizes {encoding} to valid LSP encoding names.
+---
+--@param encoding (string) Encoding to normalize
+--@returns (string) normalized encoding name
local function validate_encoding(encoding)
validate {
encoding = { encoding, 's' };
@@ -96,6 +157,13 @@ local function validate_encoding(encoding)
or error(string.format("Invalid offset encoding %q. Must be one of: 'utf-8', 'utf-16', 'utf-32'", encoding))
end
+--@internal
+--- Parses a command invocation into the command itself and its args. If there
+--- are no arguments, an empty table is returned as the second argument.
+---
+--@param input (List)
+--@returns (string) the command
+--@returns (list of strings) its arguments
function lsp._cmd_parts(input)
vim.validate{cmd={
input,
@@ -114,12 +182,27 @@ function lsp._cmd_parts(input)
return cmd, cmd_args
end
+--@private
+--- Augments a validator function with support for optional (nil) values.
+---
+--@param fn (function(v)) The original validator function; should return a
+---bool.
+--@returns (function(v)) The augmented function. Also returns true if {v} is
+---`nil`.
local function optional_validator(fn)
return function(v)
return v == nil or fn(v)
end
end
+--@private
+--- Validates a client configuration as given to |vim.lsp.start_client()|.
+---
+--@param config (table)
+--@returns (table) "Cleaned" config, containing only the command, its
+---arguments, and a valid encoding.
+---
+--@see |vim.lsp.start_client()|
local function validate_client_config(config)
validate {
config = { config, 't' };
@@ -148,6 +231,11 @@ local function validate_client_config(config)
}
end
+--@private
+--- Returns full text of buffer {bufnr} as a string.
+---
+--@param bufnr (number) Buffer handle, or 0 for current.
+--@returns Buffer text as string.
local function buf_get_full_text(bufnr)
local text = table.concat(nvim_buf_get_lines(bufnr, 0, -1, true), '\n')
if nvim_buf_get_option(bufnr, 'eol') then
@@ -156,6 +244,11 @@ local function buf_get_full_text(bufnr)
return text
end
+--@private
+--- Default handler for the 'textDocument/didOpen' LSP notification.
+---
+--@param bufnr (Number) Number of the buffer, or 0 for current
+--@param client Client object
local function text_document_did_open_handler(bufnr, client)
if not client.resolved_capabilities.text_document_open_close then
return
@@ -176,74 +269,90 @@ local function text_document_did_open_handler(bufnr, client)
util.buf_versions[bufnr] = params.textDocument.version
end
---- LSP client object.
+-- FIXME: DOC: Shouldn't need to use a dummy function
+--
+--- LSP client object. You can get an active client object via
+--- |vim.lsp.get_client_by_id()| or |vim.lsp.get_active_clients()|.
---
--- - Methods:
---
---- - request(method, params, [callback])
---- Send a request to the server. If callback is not specified, it will use
---- {client.callbacks} to try to find a callback. If one is not found there,
---- then an error will occur.
+--- - request(method, params, [callback], bufnr)
+--- Sends a request to the server.
--- This is a thin wrapper around {client.rpc.request} with some additional
--- checking.
---- Returns a boolean to indicate if the notification was successful. If it
---- is false, then it will always be false (the client has shutdown).
---- If it was successful, then it will return the request id as the second
---- result. You can use this with `notify("$/cancel", { id = request_id })`
---- to cancel the request. This helper is made automatically with
---- |vim.lsp.buf_request()|
---- Returns: status, [client_id]
+--- If {callback} is not specified, it will use {client.callbacks} to try to
+--- find a callback. If one is not found there, then an error will occur.
+--- Returns: {status}, {[client_id]}. {status} is a boolean indicating if
+--- the notification was successful. If it is `false`, then it will always
+--- be `false` (the client has shutdown).
+--- If {status} is `true`, the function returns {request_id} as the second
+--- result. You can use this with `client.cancel_request(request_id)`
+--- to cancel the request.
---
--- - notify(method, params)
---- This is just {client.rpc.notify}()
---- Returns a boolean to indicate if the notification was successful. If it
---- is false, then it will always be false (the client has shutdown).
---- Returns: status
+--- Sends a notification to an LSP server.
+--- Returns: a boolean to indicate if the notification was successful. If
+--- it is false, then it will always be false (the client has shutdown).
---
--- - cancel_request(id)
---- This is just {client.rpc.notify}("$/cancelRequest", { id = id })
---- Returns the same as `notify()`.
+--- Cancels a request with a given request id.
+--- Returns: same as `notify()`.
---
--- - stop([force])
---- Stop a client, optionally with force.
+--- Stops a client, optionally with force.
--- By default, it will just ask the server to shutdown without force.
--- If you request to stop a client which has previously been requested to
--- shutdown, it will automatically escalate and force shutdown.
---
--- - is_stopped()
---- Returns true if the client is fully stopped.
+--- Checks whether a client is stopped.
+--- Returns: true if the client is fully stopped.
+---
+--- - on_attach(bufnr)
+--- Runs the on_attach function from the client's config if it was defined.
---
--- - Members
---- - id (number): The id allocated to the client.
+--- - {id} (number): The id allocated to the client.
---
---- - name (string): If a name is specified on creation, that will be
+--- - {name} (string): If a name is specified on creation, that will be
--- used. Otherwise it is just the client id. This is used for
--- logs and messages.
---
---- - offset_encoding (string): The encoding used for communicating
---- with the server. You can modify this in the `on_init` method
+--- - {rpc} (table): RPC client object, for low level interaction with the
+--- client. See |vim.lsp.rpc.start()|.
+---
+--- - {offset_encoding} (string): The encoding used for communicating
+--- with the server. You can modify this in the `config`'s `on_init` method
--- before text is sent to the server.
---
---- - callbacks (table): The callbacks used by the client as
+--- - {callbacks} (table): The callbacks used by the client as
--- described in |lsp-callbacks|.
---
---- - config (table): copy of the table that was passed by the user
+--- - {config} (table): copy of the table that was passed by the user
--- to |vim.lsp.start_client()|.
---
---- - server_capabilities (table): Response from the server sent on
+--- - {server_capabilities} (table): Response from the server sent on
--- `initialize` describing the server's capabilities.
---
---- - resolved_capabilities (table): Normalized table of
+--- - {resolved_capabilities} (table): Normalized table of
--- capabilities that we have detected based on the initialize
--- response from the server in `server_capabilities`.
function lsp.client()
error()
end
+-- FIXME: DOC: Currently all methods on the `vim.lsp.client` object are
+-- documented twice: Here, and on the methods themselves (e.g.
+-- `client.request()`). This is a workaround for the vimdoc generator script
+-- not handling method names correctly. If you change the documentation on
+-- either, please make sure to update the other as well.
+--
--- Starts and initializes a client with the given configuration.
---
--- Parameters `cmd` and `root_dir` are required.
---
+--- The following parameters describe fields in the {config} table.
+---
--@param root_dir: (required, string) Directory where the LSP server will base
--- its rootUri on initialization.
---
@@ -271,8 +380,8 @@ end
---
--@param callbacks Map of language server method names to
--- `function(err, method, params, client_id)` handler. Invoked for:
---- - Notifications from the server, where `err` will always be `nil`.
---- - Requests initiated by the server. For these you can respond by returning
+--- - Notifications to the server, where `err` will always be `nil`.
+--- - Requests by the server. For these you can respond by returning
--- two values: `result, err` where err must be shaped like a RPC error,
--- i.e. `{ code, message, data? }`. Use |vim.lsp.rpc_response_error()| to
--- help with this.
@@ -297,7 +406,7 @@ end
--@param before_init Callback with parameters (initialize_params, config)
--- invoked before the LSP "initialize" phase, where `params` contains the
--- parameters being sent to the server and `config` is the config that was
---- passed to `start_client()`. You can use this to modify parameters before
+--- passed to |vim.lsp.start_client()|. You can use this to modify parameters before
--- they are sent.
---
--@param on_init Callback (client, initialize_result) invoked after LSP
@@ -319,9 +428,8 @@ end
--@param trace: "off" | "messages" | "verbose" | nil passed directly to the language
--- server in the initialize request. Invalid/empty values will default to "off"
---
---@returns Client id. |vim.lsp.get_client_by_id()| Note: client is only
---- available after it has been initialized, which may happen after a small
---- delay (or never if there is an error). Use `on_init` to do any actions once
+--@returns Client id. |vim.lsp.get_client_by_id()| Note: client may not be
+--- fully initialized. Use `on_init` to do any actions once
--- the client has been initialized.
function lsp.start_client(config)
local cleaned_config = validate_client_config(config)
@@ -335,10 +443,23 @@ function lsp.start_client(config)
local handlers = {}
+ --@private
+ --- Returns the callback associated with an LSP method. Returns the default
+ --- callback if the user hasn't set a custom one.
+ ---
+ --@param method (string) LSP method name
+ --@returns (fn) The callback for the given method, if defined, or the default
+ ---from |lsp-callbacks|
local function resolve_callback(method)
return callbacks[method] or default_callbacks[method]
end
+ --@private
+ --- Handles a notification sent by an LSP server by invoking the
+ --- corresponding callback.
+ ---
+ --@param method (string) LSP method name
+ --@param params (table) The parameters for that method.
function handlers.notification(method, params)
local _ = log.debug() and log.debug('notification', method, params)
local callback = resolve_callback(method)
@@ -348,6 +469,12 @@ function lsp.start_client(config)
end
end
+ --@private
+ --- Handles a request from an LSP server by invoking the corresponding
+ --- callback.
+ ---
+ --@param method (string) LSP method name
+ --@param params (table) The parameters for that method
function handlers.server_request(method, params)
local _ = log.debug() and log.debug('server_request', method, params)
local callback = resolve_callback(method)
@@ -359,6 +486,13 @@ function lsp.start_client(config)
return nil, lsp.rpc_response_error(protocol.ErrorCodes.MethodNotFound)
end
+ --@private
+ --- Invoked when the client operation throws an error.
+ ---
+ --@param code (number) Error code
+ --@param err (...) Other arguments may be passed depending on the error kind
+ --@see |vim.lsp.client_errors| for possible errors. Use
+ ---`vim.lsp.client_errors[code]` to get a human-friendly name.
function handlers.on_error(code, err)
local _ = log.error() and log.error(log_prefix, "on_error", { code = lsp.client_errors[code], err = err })
err_message(log_prefix, ': Error ', lsp.client_errors[code], ': ', vim.inspect(err))
@@ -371,6 +505,11 @@ function lsp.start_client(config)
end
end
+ --@private
+ --- Invoked on client exit.
+ ---
+ --@param code (number) exit code of the process
+ --@param signal (number) the signal used to terminate (if any)
function handlers.on_exit(code, signal)
active_clients[client_id] = nil
uninitialized_clients[client_id] = nil
@@ -411,6 +550,7 @@ function lsp.start_client(config)
-- initialize finishes.
uninitialized_clients[client_id] = client;
+ --@private
local function initialize()
local valid_traces = {
off = 'off'; messages = 'messages'; verbose = 'verbose';
@@ -466,6 +606,15 @@ function lsp.start_client(config)
-- These are the cleaned up capabilities we use for dynamically deciding
-- when to send certain events to clients.
client.resolved_capabilities = protocol.resolve_capabilities(client.server_capabilities)
+ client.supports_method = function(method)
+ local required_capability = lsp._request_name_to_capability[method]
+ -- if we don't know about the method, assume that the client supports it.
+ if not required_capability then
+ return true
+ end
+
+ return client.resolved_capabilities[required_capability]
+ end
if config.on_init then
local status, err = pcall(config.on_init, client, result)
if not status then
@@ -488,43 +637,57 @@ function lsp.start_client(config)
end)
end
- local function unsupported_method(method)
- local msg = "server doesn't support "..method
- local _ = log.warn() and log.warn(msg)
- err_message(msg)
- return lsp.rpc_response_error(protocol.ErrorCodes.MethodNotFound, msg)
- end
-
- --- Checks capabilities before rpc.request-ing.
+ --@private
+ --- Sends a request to the server.
+ ---
+ --- This is a thin wrapper around {client.rpc.request} with some additional
+ --- checks for capabilities and callback availability.
+ ---
+ --@param method (string) LSP method name.
+ --@param params (table) LSP request params.
+ --@param callback (function, optional) Response handler for this method.
+ ---If {callback} is not specified, it will use {client.callbacks} to try to
+ ---find a callback. If one is not found there, then an error will occur.
+ --@param bufnr (number) Buffer handle (0 for current).
+ --@returns ({status}, [request_id]): {status} is a bool indicating
+ ---whether the request was successful. If it is `false`, then it will
+ ---always be `false` (the client has shutdown). If it was
+ ---successful, then it will return {request_id} as the
+ ---second result. You can use this with `client.cancel_request(request_id)`
+ ---to cancel the-request.
+ --@see |vim.lsp.buf_request()|
function client.request(method, params, callback, bufnr)
+ -- FIXME: callback is optional, but bufnr is apparently not? Shouldn't that
+ -- require a `select('#', ...)` call?
if not callback then
callback = resolve_callback(method)
or error(string.format("not found: %q request callback for client %q.", method, client.name))
end
local _ = log.debug() and log.debug(log_prefix, "client.request", client_id, method, params, callback, bufnr)
- -- TODO keep these checks or just let it go anyway?
- if (not client.resolved_capabilities.hover and method == 'textDocument/hover')
- or (not client.resolved_capabilities.signature_help and method == 'textDocument/signatureHelp')
- or (not client.resolved_capabilities.goto_definition and method == 'textDocument/definition')
- or (not client.resolved_capabilities.implementation and method == 'textDocument/implementation')
- or (not client.resolved_capabilities.declaration and method == 'textDocument/declaration')
- or (not client.resolved_capabilities.type_definition and method == 'textDocument/typeDefinition')
- or (not client.resolved_capabilities.document_symbol and method == 'textDocument/documentSymbol')
- or (not client.resolved_capabilities.workspace_symbol and method == 'textDocument/workspaceSymbol')
- or (not client.resolved_capabilities.call_hierarchy and method == 'textDocument/prepareCallHierarchy')
- then
- callback(unsupported_method(method), method, nil, client_id, bufnr)
- return
- end
return rpc.request(method, params, function(err, result)
callback(err, method, result, client_id, bufnr)
end)
end
+ --@private
+ --- Sends a notification to an LSP server.
+ ---
+ --@param method (string) LSP method name.
+ --@param params (optional, table) LSP request params.
+ --@param bufnr (number) Buffer handle, or 0 for current.
+ --@returns {status} (bool) true if the notification was successful.
+ ---If it is false, then it will always be false
+ ---(the client has shutdown).
function client.notify(...)
return rpc.notify(...)
end
+ --@private
+ --- Cancels a request with a given request id.
+ ---
+ --@param id (number) id of request to cancel
+ --@returns true if any client returns true; false otherwise
+ --@see |vim.lsp.client.notify()|
function client.cancel_request(id)
validate{id = {id, 'n'}}
return rpc.notify("$/cancelRequest", { id = id })
@@ -533,6 +696,14 @@ function lsp.start_client(config)
-- Track this so that we can escalate automatically if we've alredy tried a
-- graceful shutdown
local tried_graceful_shutdown = false
+ --@private
+ --- Stops a client, optionally with force.
+ ---
+ ---By default, it will just ask the - server to shutdown without force. If
+ --- you request to stop a client which has previously been requested to
+ --- shutdown, it will automatically escalate and force shutdown.
+ ---
+ --@param force (bool, optional)
function client.stop(force)
local handle = rpc.handle
if handle:is_closing() then
@@ -554,10 +725,18 @@ function lsp.start_client(config)
end)
end
+ --@private
+ --- Checks whether a client is stopped.
+ ---
+ --@returns (bool) true if client is stopped or in the process of being
+ ---stopped; false otherwise
function client.is_stopped()
return rpc.handle:is_closing()
end
+ --@private
+ --- Runs the on_attach function from the client's config if it was defined.
+ --@param bufnr (number) Buffer number
function client._on_attach(bufnr)
text_document_did_open_handler(bufnr, client)
if config.on_attach then
@@ -571,6 +750,12 @@ function lsp.start_client(config)
return client_id
end
+--@private
+--- Memoizes a function. On first run, the function return value is saved and
+--- immediately returned on subsequent runs.
+---
+--@param fn (function) Function to run
+--@returns (function) Memoized function
local function once(fn)
local value
return function(...)
@@ -579,14 +764,21 @@ local function once(fn)
end
end
+--@private
+--@fn text_document_did_change_handler(_, bufnr, changedtick, firstline, lastline, new_lastline, old_byte_size, old_utf32_size, old_utf16_size)
+--- Notify all attached clients that a buffer has changed.
local text_document_did_change_handler
do
local encoding_index = { ["utf-8"] = 1; ["utf-16"] = 2; ["utf-32"] = 3; }
text_document_did_change_handler = function(_, bufnr, changedtick,
firstline, lastline, new_lastline, old_byte_size, old_utf32_size,
old_utf16_size)
- local _ = log.debug() and log.debug("on_lines", bufnr, changedtick, firstline,
- lastline, new_lastline, old_byte_size, old_utf32_size, old_utf16_size, nvim_buf_get_lines(bufnr, firstline, new_lastline, true))
+
+ local _ = log.debug() and log.debug(
+ string.format("on_lines bufnr: %s, changedtick: %s, firstline: %s, lastline: %s, new_lastline: %s, old_byte_size: %s, old_utf32_size: %s, old_utf16_size: %s",
+ bufnr, changedtick, firstline, lastline, new_lastline, old_byte_size, old_utf32_size, old_utf16_size),
+ nvim_buf_get_lines(bufnr, firstline, new_lastline, true)
+ )
-- Don't do anything if there are no clients attached.
if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then
@@ -730,14 +922,14 @@ function lsp.buf_is_attached(bufnr, client_id)
return (all_buffer_active_clients[bufnr] or {})[client_id] == true
end
---- Gets an active client by id, or nil if the id is invalid or the
---- client is not yet initialized.
----
+--- Gets a client by id, or nil if the id is invalid.
+--- The returned client may not yet be fully initialized.
+--
--@param client_id client id number
---
---@return |vim.lsp.client| object, or nil
+--@returns |vim.lsp.client| object, or nil
function lsp.get_client_by_id(client_id)
- return active_clients[client_id]
+ return active_clients[client_id] or uninitialized_clients[client_id]
end
--- Stops a client(s).
@@ -746,7 +938,7 @@ end
--- To stop all clients:
---
--- <pre>
---- vim.lsp.stop_client(lsp.get_active_clients())
+--- vim.lsp.stop_client(vim.lsp.get_active_clients())
--- </pre>
---
--- By default asks the server to shutdown, unless stop was requested
@@ -769,7 +961,7 @@ end
--- Gets all active clients.
---
---@return Table of |vim.lsp.client| objects
+--@returns Table of |vim.lsp.client| objects
function lsp.get_active_clients()
return vim.tbl_values(active_clients)
end
@@ -818,16 +1010,32 @@ function lsp.buf_request(bufnr, method, params, callback)
callback = { callback, 'f', true };
}
local client_request_ids = {}
- for_each_buffer_client(bufnr, function(client, client_id, resolved_bufnr)
- local request_success, request_id = client.request(method, params, callback, resolved_bufnr)
- -- This could only fail if the client shut down in the time since we looked
- -- it up and we did the request, which should be rare.
- if request_success then
- client_request_ids[client_id] = request_id
+ local method_supported = false
+ for_each_buffer_client(bufnr, function(client, client_id, resolved_bufnr)
+ if client.supports_method(method) then
+ method_supported = true
+ local request_success, request_id = client.request(method, params, callback, resolved_bufnr)
+
+ -- This could only fail if the client shut down in the time since we looked
+ -- it up and we did the request, which should be rare.
+ if request_success then
+ client_request_ids[client_id] = request_id
+ end
end
end)
+ -- if no clients support the given method, call the callback with the proper
+ -- error message.
+ if not method_supported then
+ local unsupported_err = lsp._unsupported_method(method)
+ local cb = callback or lsp.callbacks[method]
+ if cb then
+ cb(unsupported_err, method, bufnr)
+ end
+ return
+ end
+
local function _cancel_all_requests()
for client_id, request_id in pairs(client_request_ids) do
local client = active_clients[client_id]
@@ -904,7 +1112,7 @@ end
--@param findstart 0 or 1, decides behavior
--@param base If findstart=0, text to match against
---
---@return (number) Decided by `findstart`:
+--@returns (number) Decided by `findstart`:
--- - findstart=0: column where the completion starts, or -2 or -3
--- - findstart=1: list of matches (actually just calls |complete()|)
function lsp.omnifunc(findstart, base)
@@ -948,6 +1156,10 @@ function lsp.omnifunc(findstart, base)
return -2
end
+---Checks whether a client is stopped.
+---
+--@param client_id (Number)
+--@returns true if client is stopped, false otherwise.
function lsp.client_is_stopped(client_id)
return active_clients[client_id] == nil
end
@@ -992,12 +1204,17 @@ function lsp.set_log_level(level)
end
--- Gets the path of the logfile used by the LSP client.
+--@returns (String) Path to logfile.
function lsp.get_log_path()
return log.get_filename()
end
--- Define the LspDiagnostics signs if they're not defined already.
+-- Defines the LspDiagnostics signs if they're not defined already.
do
+ --@private
+ --- Defines a sign if it isn't already defined.
+ --@param name (String) Name of the sign
+ --@param properties (table) Properties to attach to the sign
local function define_default_sign(name, properties)
if vim.tbl_isempty(vim.fn.sign_getdefined(name)) then
vim.fn.sign_define(name, properties)
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 2e27617997..c015884f5b 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -1,20 +1,45 @@
local vim = vim
local validate = vim.validate
-local api = vim.api
local vfn = vim.fn
local util = require 'vim.lsp.util'
-local list_extend = vim.list_extend
local M = {}
+--@private
+--- Returns nil if {status} is false or nil, otherwise returns the rest of the
+--- arguments.
local function ok_or_nil(status, ...)
if not status then return end
return ...
end
+
+--@private
+--- Swallows errors.
+---
+--@param fn Function to run
+--@param ... Function arguments
+--@returns Result of `fn(...)` if there are no errors, otherwise nil.
+--- Returns nil if errors occur during {fn}, otherwise returns
local function npcall(fn, ...)
return ok_or_nil(pcall(fn, ...))
end
+--@private
+--- Sends an async request to all active clients attached to the current
+--- buffer.
+---
+--@param method (string) LSP method name
+--@param params (optional, table) Parameters to send to the server
+--@param callback (optional, functionnil) Handler
+-- `function(err, method, params, client_id)` for this request. Defaults
+-- to the client callback in `client.callbacks`. See |lsp-callbacks|.
+--
+--@returns 2-tuple:
+--- - Map of client-id:request-id pairs for all successful requests.
+--- - Function which can be used to cancel all the requests. You could instead
+--- iterate all clients and call their `cancel_request()` methods.
+---
+--@see |vim.lsp.buf_request()|
local function request(method, params, callback)
validate {
method = {method, 's'};
@@ -23,9 +48,10 @@ local function request(method, params, callback)
return vim.lsp.buf_request(0, method, params, callback)
end
---- Sends a notification through all clients associated with current buffer.
---
---@return `true` if server responds.
+--- Checks whether the language servers attached to the current buffer are
+--- ready.
+---
+--@returns `true` if server responds.
function M.server_ready()
return not not vim.lsp.buf_notify(0, "window/progress", {})
end
@@ -74,6 +100,12 @@ end
--- Retrieves the completion items at the current cursor position. Can only be
--- called in Insert mode.
+---
+--@param context (context support not yet implemented) Additional information
+--- about the context in which a completion was triggered (how it was triggered,
+--- and by which trigger character, if applicable)
+---
+--@see |vim.lsp.protocol.constants.CompletionTriggerKind|
function M.completion(context)
local params = util.make_position_params()
params.context = context
@@ -82,64 +114,59 @@ end
--- Formats the current buffer.
---
---- The optional {options} table can be used to specify FormattingOptions, a
---- list of which is available at
---- https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting.
+--@param options (optional, table) Can be used to specify FormattingOptions.
--- Some unspecified options will be automatically derived from the current
--- Neovim options.
+--
+--@see https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting
function M.formatting(options)
local params = util.make_formatting_params(options)
return request('textDocument/formatting', params)
end
---- Perform |vim.lsp.buf.formatting()| synchronously.
+--- Performs |vim.lsp.buf.formatting()| synchronously.
---
--- Useful for running on save, to make sure buffer is formatted prior to being
---- saved. {timeout_ms} is passed on to |vim.lsp.buf_request_sync()|.
+--- saved. {timeout_ms} is passed on to |vim.lsp.buf_request_sync()|. Example:
+---
+--- <pre>
+--- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]]
+--- </pre>
+---
+--@param options Table with valid `FormattingOptions` entries
+--@param timeout_ms (number) Request timeout
function M.formatting_sync(options, timeout_ms)
local params = util.make_formatting_params(options)
local result = vim.lsp.buf_request_sync(0, "textDocument/formatting", params, timeout_ms)
if not result then return end
result = result[1].result
+ if not result then return end
vim.lsp.util.apply_text_edits(result)
end
+--- Formats a given range.
+---
+--@param options Table with valid `FormattingOptions` entries.
+--@param start_pos ({number, number}, optional) mark-indexed position.
+---Defaults to the start of the last visual selection.
+--@param start_pos ({number, number}, optional) mark-indexed position.
+---Defaults to the end of the last visual selection.
function M.range_formatting(options, start_pos, end_pos)
- validate {
- options = {options, 't', true};
- start_pos = {start_pos, 't', true};
- end_pos = {end_pos, 't', true};
- }
+ validate { options = {options, 't', true} }
local sts = vim.bo.softtabstop;
options = vim.tbl_extend('keep', options or {}, {
tabSize = (sts > 0 and sts) or (sts < 0 and vim.bo.shiftwidth) or vim.bo.tabstop;
insertSpaces = vim.bo.expandtab;
})
- local A = list_extend({}, start_pos or api.nvim_buf_get_mark(0, '<'))
- local B = list_extend({}, end_pos or api.nvim_buf_get_mark(0, '>'))
- -- convert to 0-index
- A[1] = A[1] - 1
- B[1] = B[1] - 1
- -- account for encoding.
- if A[2] > 0 then
- A = {A[1], util.character_offset(0, A[1], A[2])}
- end
- if B[2] > 0 then
- B = {B[1], util.character_offset(0, B[1], B[2])}
- end
- local params = {
- textDocument = { uri = vim.uri_from_bufnr(0) };
- range = {
- start = { line = A[1]; character = A[2]; };
- ["end"] = { line = B[1]; character = B[2]; };
- };
- options = options;
- }
+ local params = util.make_given_range_params(start_pos, end_pos)
+ params.options = options
return request('textDocument/rangeFormatting', params)
end
---- Renames all references to the symbol under the cursor. If {new_name} is not
---- provided, the user will be prompted for a new name using |input()|.
+--- Renames all references to the symbol under the cursor.
+---
+--@param new_name (string) If not provided, the user will be prompted for a new
+---name using |input()|.
function M.rename(new_name)
-- TODO(ashkan) use prepareRename
-- * result: [`Range`](#range) \| `{ range: Range, placeholder: string }` \| `null` describing the range of the string to rename and optionally a placeholder text of the string content to be renamed. If `null` is returned then it is deemed that a 'textDocument/rename' request is not valid at the given position.
@@ -152,6 +179,8 @@ end
--- Lists all the references to the symbol under the cursor in the quickfix window.
---
+--@param context (table) Context for the request
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
function M.references(context)
validate { context = { context, 't', true } }
local params = util.make_position_params()
@@ -169,6 +198,7 @@ function M.document_symbol()
request('textDocument/documentSymbol', params)
end
+--@private
local function pick_call_hierarchy_item(call_hierarchy_items)
if not call_hierarchy_items then return end
if #call_hierarchy_items == 1 then
@@ -186,6 +216,9 @@ local function pick_call_hierarchy_item(call_hierarchy_items)
return choice
end
+--- Lists all the call sites of the symbol under the cursor in the
+--- |quickfix| window. If the symbol can resolve to multiple
+--- items, the user can pick one in the |inputlist|.
function M.incoming_calls()
local params = util.make_position_params()
request('textDocument/prepareCallHierarchy', params, function(_, _, result)
@@ -194,6 +227,9 @@ function M.incoming_calls()
end)
end
+--- Lists all the items that are called by the symbol under the
+--- cursor in the |quickfix| window. If the symbol can resolve to
+--- multiple items, the user can pick one in the |inputlist|.
function M.outgoing_calls()
local params = util.make_position_params()
request('textDocument/prepareCallHierarchy', params, function(_, _, result)
@@ -204,9 +240,11 @@ end
--- Lists all symbols in the current workspace in the quickfix window.
---
---- The list is filtered against the optional argument {query};
---- if the argument is omitted from the call, the user is prompted to enter a string on the command line.
---- An empty string means no filtering is done.
+--- The list is filtered against {query}; if the argument is omitted from the
+--- call, the user is prompted to enter a string on the command line. An empty
+--- string means no filtering is done.
+---
+--@param query (string, optional)
function M.workspace_symbol(query)
query = query or npcall(vfn.input, "Query: ")
local params = {query = query}
@@ -227,10 +265,17 @@ function M.document_highlight()
request('textDocument/documentHighlight', params)
end
+--- Removes document highlights from current buffer.
+---
function M.clear_references()
util.buf_clear_references()
end
+--- Selects a code action from the input list that is available at the current
+--- cursor position.
+--
+--@param context: (table, optional) Valid `CodeActionContext` object
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
function M.code_action(context)
validate { context = { context, 't', true } }
context = context or { diagnostics = util.get_line_diagnostics() }
@@ -239,6 +284,25 @@ function M.code_action(context)
request('textDocument/codeAction', params)
end
+--- Performs |vim.lsp.buf.code_action()| for a given range.
+---
+--@param context: (table, optional) Valid `CodeActionContext` object
+--@param start_pos ({number, number}, optional) mark-indexed position.
+---Defaults to the start of the last visual selection.
+--@param end_pos ({number, number}, optional) mark-indexed position.
+---Defaults to the end of the last visual selection.
+function M.range_code_action(context, start_pos, end_pos)
+ validate { context = { context, 't', true } }
+ context = context or { diagnostics = util.get_line_diagnostics() }
+ local params = util.make_given_range_params(start_pos, end_pos)
+ params.context = context
+ request('textDocument/codeAction', params)
+end
+
+--- Executes an LSP server command.
+---
+--@param command A valid `ExecuteCommandParams` object
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
function M.execute_command(command)
validate {
command = { command.command, 's' },
diff --git a/runtime/lua/vim/lsp/callbacks.lua b/runtime/lua/vim/lsp/callbacks.lua
index 1ed58995d0..3270d1d2a9 100644
--- a/runtime/lua/vim/lsp/callbacks.lua
+++ b/runtime/lua/vim/lsp/callbacks.lua
@@ -7,17 +7,24 @@ local buf = require 'vim.lsp.buf'
local M = {}
+-- FIXME: DOC: Expose in vimdocs
+
+--@private
+--- Writes to error buffer.
+--@param ... (table of strings) Will be concatenated before being written
local function err_message(...)
api.nvim_err_writeln(table.concat(vim.tbl_flatten{...}))
api.nvim_command("redraw")
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
M['workspace/executeCommand'] = function(err, _)
if err then
error("Could not execute code action: "..err.message)
end
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
M['textDocument/codeAction'] = function(_, _, actions)
if actions == nil or vim.tbl_isempty(actions) then
print("No code actions available")
@@ -51,6 +58,7 @@ M['textDocument/codeAction'] = function(_, _, actions)
end
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
M['workspace/applyEdit'] = function(_, _, workspace_edit)
if not workspace_edit then return end
-- TODO(ashkan) Do something more with label?
@@ -64,6 +72,7 @@ M['workspace/applyEdit'] = function(_, _, workspace_edit)
}
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_publishDiagnostics
M['textDocument/publishDiagnostics'] = function(_, _, result)
if not result then return end
local uri = result.uri
@@ -73,18 +82,6 @@ M['textDocument/publishDiagnostics'] = function(_, _, result)
return
end
- -- Unloaded buffers should not handle diagnostics.
- -- When the buffer is loaded, we'll call on_attach, which sends textDocument/didOpen.
- -- This should trigger another publish of the diagnostics.
- --
- -- In particular, this stops a ton of spam when first starting a server for current
- -- unloaded buffers.
- if not api.nvim_buf_is_loaded(bufnr) then
- return
- end
-
- util.buf_clear_diagnostics(bufnr)
-
-- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic
-- The diagnostic's severity. Can be omitted. If omitted it is up to the
-- client to interpret diagnostics as error, warning, info or hint.
@@ -95,13 +92,30 @@ M['textDocument/publishDiagnostics'] = function(_, _, result)
end
end
+ util.buf_clear_diagnostics(bufnr)
+
+ -- Always save the diagnostics, even if the buf is not loaded.
+ -- Language servers may report compile or build errors via diagnostics
+ -- Users should be able to find these, even if they're in files which
+ -- are not loaded.
util.buf_diagnostics_save_positions(bufnr, result.diagnostics)
+
+ -- Unloaded buffers should not handle diagnostics.
+ -- When the buffer is loaded, we'll call on_attach, which sends textDocument/didOpen.
+ -- This should trigger another publish of the diagnostics.
+ --
+ -- In particular, this stops a ton of spam when first starting a server for current
+ -- unloaded buffers.
+ if not api.nvim_buf_is_loaded(bufnr) then
+ return
+ end
util.buf_diagnostics_underline(bufnr, result.diagnostics)
util.buf_diagnostics_virtual_text(bufnr, result.diagnostics)
util.buf_diagnostics_signs(bufnr, result.diagnostics)
vim.api.nvim_command("doautocmd User LspDiagnosticsChanged")
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
M['textDocument/references'] = function(_, _, result)
if not result then return end
util.set_qflist(util.locations_to_items(result))
@@ -109,6 +123,13 @@ M['textDocument/references'] = function(_, _, result)
api.nvim_command("wincmd p")
end
+--@private
+--- Prints given list of symbols to the quickfix list.
+--@param _ (not used)
+--@param _ (not used)
+--@param result (list of Symbols) LSP method name
+--@param result (table) result of LSP method; a location or a list of locations.
+---(`textDocument/definition` can return `Location` or `Location[]`
local symbol_callback = function(_, _, result, _, bufnr)
if not result or vim.tbl_isempty(result) then return end
@@ -116,24 +137,30 @@ local symbol_callback = function(_, _, result, _, bufnr)
api.nvim_command("copen")
api.nvim_command("wincmd p")
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
M['textDocument/documentSymbol'] = symbol_callback
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_symbol
M['workspace/symbol'] = symbol_callback
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename
M['textDocument/rename'] = function(_, _, result)
if not result then return end
util.apply_workspace_edit(result)
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rangeFormatting
M['textDocument/rangeFormatting'] = function(_, _, result)
if not result then return end
util.apply_text_edits(result)
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
M['textDocument/formatting'] = function(_, _, result)
if not result then return end
util.apply_text_edits(result)
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
M['textDocument/completion'] = function(_, _, result)
if vim.tbl_isempty(result or {}) then return end
local row, col = unpack(api.nvim_win_get_cursor(0))
@@ -146,6 +173,7 @@ M['textDocument/completion'] = function(_, _, result)
vim.fn.complete(textMatch+1, matches)
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
M['textDocument/hover'] = function(_, method, result)
util.focusable_float(method, function()
if not (result and result.contents) then
@@ -166,6 +194,12 @@ M['textDocument/hover'] = function(_, method, result)
end)
end
+--@private
+--- Jumps to a location. Used as a callback for multiple LSP methods.
+--@param _ (not used)
+--@param method (string) LSP method name
+--@param result (table) result of LSP method; a location or a list of locations.
+---(`textDocument/definition` can return `Location` or `Location[]`
local function location_callback(_, method, result)
if result == nil or vim.tbl_isempty(result) then
local _ = log.info() and log.info(method, 'No location found')
@@ -188,35 +222,49 @@ local function location_callback(_, method, result)
end
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration
M['textDocument/declaration'] = location_callback
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition
M['textDocument/definition'] = location_callback
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition
M['textDocument/typeDefinition'] = location_callback
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation
M['textDocument/implementation'] = location_callback
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
M['textDocument/signatureHelp'] = function(_, method, result)
+ -- When use `autocmd CompleteDone <silent><buffer> lua vim.lsp.buf.signature_help()` to call signatureHelp callback
+ -- If the completion item doesn't have signatures It will make noise. Change to use `print` that can use `<silent>` to ignore
+ if not (result and result.signatures and result.signatures[1]) then
+ print('No signature help available')
+ return
+ end
+ local lines = util.convert_signature_help_to_markdown_lines(result)
+ lines = util.trim_empty_lines(lines)
+ if vim.tbl_isempty(lines) then
+ print('No signature help available')
+ return
+ end
util.focusable_preview(method, function()
- if not (result and result.signatures and result.signatures[1]) then
- return { 'No signature available' }
- end
- -- TODO show popup when signatures is empty?
- local lines = util.convert_signature_help_to_markdown_lines(result)
- lines = util.trim_empty_lines(lines)
- if vim.tbl_isempty(lines) then
- return { 'No signature available' }
- end
return lines, util.try_trim_markdown_code_blocks(lines)
end)
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight
M['textDocument/documentHighlight'] = function(_, _, result, _)
if not result then return end
local bufnr = api.nvim_get_current_buf()
util.buf_highlight_references(bufnr, result)
end
--- direction is "from" for incoming calls and "to" for outgoing calls
+--@private
+---
+--- Displays call hierarchy in the quickfix window.
+---
+--@param direction `"from"` for incoming calls and `"to"` for outgoing calls
+--@returns `CallHierarchyIncomingCall[]` if {direction} is `"from"`,
+--@returns `CallHierarchyOutgoingCall[]` if {direction} is `"to"`,
local make_call_hierarchy_callback = function(direction)
- -- result is a CallHierarchy{Incoming,Outgoing}Call[]
return function(_, _, result)
if not result then return end
local items = {}
@@ -237,10 +285,13 @@ local make_call_hierarchy_callback = function(direction)
end
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy/incomingCalls
M['callHierarchy/incomingCalls'] = make_call_hierarchy_callback('from')
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy/outgoingCalls
M['callHierarchy/outgoingCalls'] = make_call_hierarchy_callback('to')
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window/logMessage
M['window/logMessage'] = function(_, _, result, client_id)
local message_type = result.type
local message = result.message
@@ -261,6 +312,7 @@ M['window/logMessage'] = function(_, _, result, client_id)
return result
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window/showMessage
M['window/showMessage'] = function(_, _, result, client_id)
local message_type = result.type
local message = result.message
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua
index 696ce43a59..587a65cd96 100644
--- a/runtime/lua/vim/lsp/log.lua
+++ b/runtime/lua/vim/lsp/log.lua
@@ -2,6 +2,9 @@
local log = {}
+-- FIXME: DOC
+-- Should be exposed in the vim docs.
+--
-- Log level dictionary with reverse lookup as well.
--
-- Can be used to lookup the number from the name or the name from the number.
@@ -21,12 +24,14 @@ local log_date_format = "%FT%H:%M:%S%z"
do
local path_sep = vim.loop.os_uname().sysname == "Windows" and "\\" or "/"
+ --@private
local function path_join(...)
return table.concat(vim.tbl_flatten{...}, path_sep)
end
local logfilename = path_join(vim.fn.stdpath('data'), 'lsp.log')
- --- Return the log filename.
+ --- Returns the log filename.
+ --@returns (string) log filename
function log.get_filename()
return logfilename
end
@@ -36,6 +41,9 @@ do
for level, levelnr in pairs(log.levels) do
-- Also export the log level on the root object.
log[level] = levelnr
+ -- FIXME: DOC
+ -- Should be exposed in the vim docs.
+ --
-- Set the lowercase name as the main use function.
-- If called without arguments, it will check whether the log level is
-- greater than or equal to this one. When called with arguments, it will
@@ -74,6 +82,8 @@ end
-- interfere with iterating the levels
vim.tbl_add_reverse_lookup(log.levels)
+--- Sets the current log level.
+--@param level (string or number) One of `vim.lsp.log.levels`
function log.set_level(level)
if type(level) == 'string' then
current_log_level = assert(log.levels[level:upper()], string.format("Invalid log level: %q", level))
@@ -84,8 +94,9 @@ function log.set_level(level)
end
end
--- Return whether the level is sufficient for logging.
--- @param level number log level
+--- Checks whether the level is sufficient for logging.
+--@param level number log level
+--@returns (bool) true if would log, false if not
function log.should_log(level)
return level >= current_log_level
end
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index ef5e08680e..2773f59b45 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -2,6 +2,11 @@
local protocol = {}
+--@private
+--- Returns {a} if it is not nil, otherwise returns {b}.
+---
+--@param a
+--@param b
local function ifnil(a, b)
if a == nil then return b end
return a
@@ -9,12 +14,14 @@ end
--[=[
--- Useful for interfacing with:
--- https://github.com/microsoft/language-server-protocol/raw/gh-pages/_specifications/specification-3-14.md
+--@private
+--- Useful for interfacing with:
+--- https://github.com/microsoft/language-server-protocol/raw/gh-pages/_specifications/specification-3-14.md
function transform_schema_comments()
nvim.command [[silent! '<,'>g/\/\*\*\|\*\/\|^$/d]]
nvim.command [[silent! '<,'>s/^\(\s*\) \* \=\(.*\)/\1--\2/]]
end
+--@private
function transform_schema_to_table()
transform_schema_comments()
nvim.command [[silent! '<,'>s/: \S\+//]]
@@ -696,6 +703,10 @@ function protocol.make_client_capabilities()
};
hierarchicalDocumentSymbolSupport = true;
};
+ rename = {
+ dynamicRegistration = false;
+ prepareSupport = true;
+ };
};
workspace = {
symbol = {
@@ -907,6 +918,7 @@ function protocol.resolve_capabilities(server_capabilities)
return nil, string.format("Invalid type for textDocumentSync: %q", type(textDocumentSync))
end
end
+ general_properties.completion = server_capabilities.completionProvider ~= nil
general_properties.hover = server_capabilities.hoverProvider or false
general_properties.goto_definition = server_capabilities.definitionProvider or false
general_properties.find_references = server_capabilities.referencesProvider or false
@@ -916,6 +928,15 @@ function protocol.resolve_capabilities(server_capabilities)
general_properties.document_formatting = server_capabilities.documentFormattingProvider or false
general_properties.document_range_formatting = server_capabilities.documentRangeFormattingProvider or false
general_properties.call_hierarchy = server_capabilities.callHierarchyProvider or false
+ general_properties.execute_command = server_capabilities.executeCommandProvider ~= nil
+
+ if server_capabilities.renameProvider == nil then
+ general_properties.rename = false
+ elseif type(server_capabilities.renameProvider) == 'boolean' then
+ general_properties.rename = server_capabilities.renameProvider
+ else
+ general_properties.rename = true
+ end
if server_capabilities.codeActionProvider == nil then
general_properties.code_action = false
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 81c92bfe05..749a51fecc 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -5,6 +5,11 @@ local protocol = require('vim.lsp.protocol')
local validate, schedule, schedule_wrap = vim.validate, vim.schedule, vim.schedule_wrap
-- TODO replace with a better implementation.
+--@private
+--- Encodes to JSON.
+---
+--@param data (table) Data to encode
+--@returns (string) Encoded object
local function json_encode(data)
local status, result = pcall(vim.fn.json_encode, data)
if status then
@@ -13,6 +18,11 @@ local function json_encode(data)
return nil, result
end
end
+--@private
+--- Decodes from JSON.
+---
+--@param data (string) Data to decode
+--@returns (table) Decoded JSON object
local function json_decode(data)
local status, result = pcall(vim.fn.json_decode, data)
if status then
@@ -22,17 +32,26 @@ local function json_decode(data)
end
end
+--@private
+--- Checks whether a given path exists and is a directory.
+--@param filename (string) path to check
+--@returns (bool)
local function is_dir(filename)
local stat = vim.loop.fs_stat(filename)
return stat and stat.type == 'directory' or false
end
local NIL = vim.NIL
+--@private
+--- Returns its argument, but converts `vim.NIL` to Lua `nil`.
+--@param v (any) Argument
+--@returns (any)
local function convert_NIL(v)
if v == NIL then return nil end
return v
end
+--@private
--- Merges current process env with the given env and returns the result as
--- a list of "k=v" strings.
---
@@ -42,6 +61,8 @@ end
--- in: { PRODUCTION="false", PATH="/usr/bin/", PORT=123, HOST="0.0.0.0", }
--- out: { "PRODUCTION=false", "PATH=/usr/bin/", "PORT=123", "HOST=0.0.0.0", }
--- </pre>
+--@param env (table) table of environment variable assignments
+--@returns (table) list of `"k=v"` strings
local function env_merge(env)
if env == nil then
return env
@@ -56,6 +77,11 @@ local function env_merge(env)
return final_env
end
+--@private
+--- Embeds the given string into a table and correctly computes `Content-Length`.
+---
+--@param encoded_message (string)
+--@returns (table) table containing encoded message and `Content-Length` attribute
local function format_message_with_content_length(encoded_message)
return table.concat {
'Content-Length: '; tostring(#encoded_message); '\r\n\r\n';
@@ -63,8 +89,11 @@ local function format_message_with_content_length(encoded_message)
}
end
---- Parse an LSP Message's header
--- @param header: The header to parse.
+--@private
+--- Parses an LSP Message's header
+---
+--@param header: The header to parse.
+--@returns Parsed headers
local function parse_headers(header)
if type(header) ~= 'string' then
return nil
@@ -92,6 +121,8 @@ end
-- case insensitive pattern.
local header_start_pattern = ("content"):gsub("%w", function(c) return "["..c..c:upper().."]" end)
+--@private
+--- The actual workhorse.
local function request_parser_loop()
local buffer = ''
while true do
@@ -138,6 +169,10 @@ local client_errors = vim.tbl_add_reverse_lookup {
SERVER_RESULT_CALLBACK_ERROR = 7;
}
+--- Constructs an error message from an LSP error object.
+---
+--@param err (table) The error object
+--@returns (string) The formatted error message
local function format_rpc_error(err)
validate {
err = { err, 't' };
@@ -182,23 +217,69 @@ local function rpc_response_error(code, message, data)
end
local default_handlers = {}
+--@private
+--- Default handler for notifications sent to an LSP server.
+---
+--@param method (string) The invoked LSP method
+--@param params (table): Parameters for the invoked LSP method
function default_handlers.notification(method, params)
local _ = log.debug() and log.debug('notification', method, params)
end
+--@private
+--- Default handler for requests sent to an LSP server.
+---
+--@param method (string) The invoked LSP method
+--@param params (table): Parameters for the invoked LSP method
+--@returns `nil` and `vim.lsp.protocol.ErrorCodes.MethodNotFound`.
function default_handlers.server_request(method, params)
local _ = log.debug() and log.debug('server_request', method, params)
return nil, rpc_response_error(protocol.ErrorCodes.MethodNotFound)
end
+--@private
+--- Default handler for when a client exits.
+---
+--@param code (number): Exit code
+--@param signal (number): Number describing the signal used to terminate (if
+---any)
function default_handlers.on_exit(code, signal)
- local _ = log.info() and log.info("client exit", { code = code, signal = signal })
+ local _ = log.info() and log.info("client_exit", { code = code, signal = signal })
end
+--@private
+--- Default handler for client errors.
+---
+--@param code (number): Error code
+--@param err (any): Details about the error
+---any)
function default_handlers.on_error(code, err)
local _ = log.error() and log.error('client_error:', client_errors[code], err)
end
---- Create and start an RPC client.
--- @param cmd [
-local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_params)
+--- Starts an LSP server process and create an LSP RPC client object to
+--- interact with it.
+---
+--@param cmd (string) Command to start the LSP server.
+--@param cmd_args (table) List of additional string arguments to pass to {cmd}.
+--@param handlers (table, optional) Handlers for LSP message types. Valid
+---handler names are:
+--- - `"notification"`
+--- - `"server_request"`
+--- - `"on_error"`
+--- - `"on_exit"`
+--@param extra_spawn_params (table, optional) Additional context for the LSP
+--- server process. May contain:
+--- - {cwd} (string) Working directory for the LSP server process
+--- - {env} (table) Additional environment variables for LSP server process
+--@returns Client RPC object.
+---
+--@returns Methods:
+--- - `notify()` |vim.lsp.rpc.notify()|
+--- - `request()` |vim.lsp.rpc.request()|
+---
+--@returns Members:
+--- - {pid} (number) The LSP server's PID.
+--- - {handle} A handle for low-level interaction with the LSP server process
+--- |vim.loop|.
+local function start(cmd, cmd_args, handlers, extra_spawn_params)
local _ = log.info() and log.info("Starting RPC client", {cmd = cmd, args = cmd_args, extra = extra_spawn_params})
validate {
cmd = { cmd, 's' };
@@ -242,6 +323,11 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
local handle, pid
do
+ --@private
+ --- Callback for |vim.loop.spawn()| Closes all streams and runs the
+ --- `on_exit` handler.
+ --@param code (number) Exit code
+ --@param signal (number) Signal that was used to terminate (if any)
local function onexit(code, signal)
stdin:close()
stdout:close()
@@ -265,6 +351,12 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
handle, pid = uv.spawn(cmd, spawn_params, onexit)
end
+ --@private
+ --- Encodes {payload} into a JSON-RPC message and sends it to the remote
+ --- process.
+ ---
+ --@param payload (table) Converted into a JSON string, see |json_encode()|
+ --@returns true if the payload could be scheduled, false if the main event-loop is in the process of closing.
local function encode_and_send(payload)
local _ = log.debug() and log.debug("rpc.send.payload", payload)
if handle:is_closing() then return false end
@@ -276,8 +368,14 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
return true
end
- local function send_notification(method, params)
- local _ = log.debug() and log.debug("rpc.notify", method, params)
+ -- FIXME: DOC: Should be placed on the RPC client object returned by
+ -- `start()`
+ --
+ --- Sends a notification to the LSP server.
+ --@param method (string) The invoked LSP method
+ --@param params (table): Parameters for the invoked LSP method
+ --@returns (bool) `true` if notification could be sent, `false` if not
+ local function notify(method, params)
return encode_and_send {
jsonrpc = "2.0";
method = method;
@@ -285,6 +383,8 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
}
end
+ --@private
+ --- sends an error object to the remote LSP process.
local function send_response(request_id, err, result)
return encode_and_send {
id = request_id;
@@ -294,7 +394,16 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
}
end
- local function send_request(method, params, callback)
+ -- FIXME: DOC: Should be placed on the RPC client object returned by
+ -- `start()`
+ --
+ --- Sends a request to the LSP server and runs {callback} upon response.
+ ---
+ --@param method (string) The invoked LSP method
+ --@param params (table) Parameters for the invoked LSP method
+ --@param callback (function) Callback to invoke
+ --@returns (bool, number) `(true, message_id)` if request could be sent, `false` if not
+ local function request(method, params, callback)
validate {
callback = { callback, 'f' };
}
@@ -320,11 +429,13 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
end
end)
+ --@private
local function on_error(errkind, ...)
assert(client_errors[errkind])
-- TODO what to do if this fails?
pcall(handlers.on_error, errkind, ...)
end
+ --@private
local function pcall_handler(errkind, status, head, ...)
if not status then
on_error(errkind, head, ...)
@@ -332,6 +443,7 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
end
return status, head, ...
end
+ --@private
local function try_call(errkind, fn, ...)
return pcall_handler(errkind, pcall(fn, ...))
end
@@ -340,6 +452,7 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
-- time and log them. This would require storing the timestamp. I could call
-- them with an error then, perhaps.
+ --@private
local function handle_body(body)
local decoded, err = json_decode(body)
if not decoded then
@@ -381,10 +494,13 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
decoded.error = convert_NIL(decoded.error)
decoded.result = convert_NIL(decoded.result)
- -- Do not surface RequestCancelled to users, it is RPC-internal.
- if decoded.error
- and decoded.error.code == protocol.ErrorCodes.RequestCancelled then
- local _ = log.debug() and log.debug("Received cancellation ack", decoded)
+ -- Do not surface RequestCancelled or ContentModified to users, it is RPC-internal.
+ if decoded.error then
+ if decoded.error.code == protocol.ErrorCodes.RequestCancelled then
+ local _ = log.debug() and log.debug("Received cancellation ack", decoded)
+ elseif decoded.error.code == protocol.ErrorCodes.ContentModified then
+ local _ = log.debug() and log.debug("Received content modified ack", decoded)
+ end
local result_id = tonumber(decoded.id)
-- Clear any callback since this is cancelled now.
-- This is safe to do assuming that these conditions hold:
@@ -458,13 +574,13 @@ local function create_and_start_client(cmd, cmd_args, handlers, extra_spawn_para
return {
pid = pid;
handle = handle;
- request = send_request;
- notify = send_notification;
+ request = request;
+ notify = notify
}
end
return {
- start = create_and_start_client;
+ start = start;
rpc_response_error = rpc_response_error;
format_rpc_error = format_rpc_error;
client_errors = client_errors;
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 33fca29ecd..775932c7fd 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -7,6 +7,7 @@ local highlight = require 'vim.highlight'
local M = {}
+-- FIXME: DOC: Expose in vimdocs
--- Diagnostics received from the server via `textDocument/publishDiagnostics`
-- by buffer.
--
@@ -33,18 +34,30 @@ local M = {}
M.diagnostics_by_buf = {}
local split = vim.split
+--@private
local function split_lines(value)
return split(value, '\n', true)
end
+--@private
local function ok_or_nil(status, ...)
if not status then return end
return ...
end
+--@private
local function npcall(fn, ...)
return ok_or_nil(pcall(fn, ...))
end
+--- Replaces text in a range with new text.
+---
+--- CAUTION: Changes in-place!
+---
+--@param lines (table) Original list of strings
+--@param A (table) Start position; a 2-tuple of {line, col} numbers
+--@param B (table) End position; a 2-tuple of {line, col} numbers
+--@param new_lines A list of strings to replace the original
+--@returns (table) The modified {lines} object
function M.set_lines(lines, A, B, new_lines)
-- 0-indexing to 1-indexing
local i_0 = A[1] + 1
@@ -78,6 +91,7 @@ function M.set_lines(lines, A, B, new_lines)
return lines
end
+--@private
local function sort_by_key(fn)
return function(a,b)
local ka, kb = fn(a), fn(b)
@@ -91,13 +105,15 @@ local function sort_by_key(fn)
return false
end
end
+--@private
local edit_sort_key = sort_by_key(function(e)
return {e.A[1], e.A[2], e.i}
end)
+--@private
--- Position is a https://microsoft.github.io/language-server-protocol/specifications/specification-current/#position
--- Returns a zero-indexed column, since set_lines() does the conversion to
--- 1-indexed
+--- Returns a zero-indexed column, since set_lines() does the conversion to
+--- 1-indexed
local function get_line_byte_from_position(bufnr, position)
-- LSP's line and characters are 0-indexed
-- Vim's line and columns are 1-indexed
@@ -114,6 +130,9 @@ local function get_line_byte_from_position(bufnr, position)
return col
end
+--- Applies a list of text edits to a buffer.
+--@param text_edits (table) list of `TextEdit` objects
+--@param buf_nr (number) Buffer id
function M.apply_text_edits(text_edits, bufnr)
if not next(text_edits) then return end
if not api.nvim_buf_is_loaded(bufnr) then
@@ -168,20 +187,30 @@ end
-- function M.glob_to_regex(glob)
-- end
--- textDocument/completion response returns one of CompletionItem[], CompletionList or null.
--- https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
+--- Can be used to extract the completion items from a
+--- `textDocument/completion` request, which may return one of
+--- `CompletionItem[]`, `CompletionList` or null.
+--@param result (table) The result of a `textDocument/completion` request
+--@returns (table) List of completion items
+--@see https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
function M.extract_completion_items(result)
if type(result) == 'table' and result.items then
+ -- result is a `CompletionList`
return result.items
elseif result ~= nil then
+ -- result is `CompletionItem[]`
return result
else
+ -- result is `null`
return {}
end
end
---- Apply the TextDocumentEdit response.
--- @params TextDocumentEdit [table] see https://microsoft.github.io/language-server-protocol/specification
+--- Applies a `TextDocumentEdit`, which is a list of changes to a single
+-- document.
+---
+--@param text_document_edit (table) a `TextDocumentEdit` object
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit
function M.apply_text_document_edit(text_document_edit)
local text_document = text_document_edit.textDocument
local bufnr = vim.uri_to_bufnr(text_document.uri)
@@ -195,6 +224,13 @@ function M.apply_text_document_edit(text_document_edit)
M.apply_text_edits(text_document_edit.edits, bufnr)
end
+--@private
+--- Recursively parses snippets in a completion entry.
+---
+--@param input (string) Snippet text to parse for snippets
+--@param inner (bool) Whether this function is being called recursively
+--@returns 2-tuple of strings: The first is the parsed result, the second is the
+---unparsed rest of the input
local function parse_snippet_rec(input, inner)
local res = ""
@@ -248,25 +284,30 @@ local function parse_snippet_rec(input, inner)
return res, input
end
--- Parse completion entries, consuming snippet tokens
+--- Parses snippets in a completion entry.
+---
+--@param input (string) unparsed snippet
+--@returns (string) parsed snippet
function M.parse_snippet(input)
local res, _ = parse_snippet_rec(input, false)
return res
end
--- Sort by CompletionItem.sortText
--- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
+--@private
+--- Sorts by CompletionItem.sortText.
+---
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
local function sort_completion_items(items)
- if items[1] and items[1].sortText then
- table.sort(items, function(a, b) return a.sortText < b.sortText
- end)
- end
+ table.sort(items, function(a, b)
+ return (a.sortText or a.label) < (b.sortText or b.label)
+ end)
end
--- Returns text that should be inserted when selecting completion item. The precedence is as follows:
--- textEdit.newText > insertText > label
--- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
+--@private
+--- Returns text that should be inserted when selecting completion item. The
+--- precedence is as follows: textEdit.newText > insertText > label
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
local function get_completion_word(item)
if item.textEdit ~= nil and item.textEdit.newText ~= nil then
if protocol.InsertTextFormat[item.insertTextFormat] == "PlainText" then
@@ -284,8 +325,10 @@ local function get_completion_word(item)
return item.label
end
--- Some language servers return complementary candidates whose prefixes do not match are also returned.
--- So we exclude completion candidates whose prefix does not match.
+--@private
+--- Some language servers return complementary candidates whose prefixes do not
+--- match are also returned. So we exclude completion candidates whose prefix
+--- does not match.
local function remove_unmatch_completion_items(items, prefix)
return vim.tbl_filter(function(item)
local word = get_completion_word(item)
@@ -293,16 +336,26 @@ local function remove_unmatch_completion_items(items, prefix)
end, items)
end
--- Acording to LSP spec, if the client set "completionItemKind.valueSet",
--- the client must handle it properly even if it receives a value outside the specification.
--- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
+--- Acording to LSP spec, if the client set `completionItemKind.valueSet`,
+--- the client must handle it properly even if it receives a value outside the
+--- specification.
+---
+--@param completion_item_kind (`vim.lsp.protocol.completionItemKind`)
+--@returns (`vim.lsp.protocol.completionItemKind`)
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
function M._get_completion_item_kind_name(completion_item_kind)
return protocol.CompletionItemKind[completion_item_kind] or "Unknown"
end
---- Getting vim complete-items with incomplete flag.
--- @params CompletionItem[], CompletionList or nil (https://microsoft.github.io/language-server-protocol/specification#textDocument_completion)
--- @return { matches = complete-items table, incomplete = boolean }
+--- Turns the result of a `textDocument/completion` request into vim-compatible
+--- |complete-items|.
+---
+--@param result The result of a `textDocument/completion` call, e.g. from
+---|vim.lsp.buf.completion()|, which may be one of `CompletionItem[]`,
+--- `CompletionList` or `null`
+--@param prefix (string) the prefix to filter the completion items
+--@returns { matches = complete-items table, incomplete = bool }
+--@see |complete-items|
function M.text_document_completion_list_to_complete_items(result, prefix)
local items = M.extract_completion_items(result)
if vim.tbl_isempty(items) then
@@ -350,7 +403,10 @@ function M.text_document_completion_list_to_complete_items(result, prefix)
return matches
end
--- @params WorkspaceEdit [table] see https://microsoft.github.io/language-server-protocol/specification
+--- Applies a `WorkspaceEdit`.
+---
+--@param workspace_edit (table) `WorkspaceEdit`
+-- @see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
function M.apply_workspace_edit(workspace_edit)
if workspace_edit.documentChanges then
for _, change in ipairs(workspace_edit.documentChanges) do
@@ -375,9 +431,15 @@ function M.apply_workspace_edit(workspace_edit)
end
end
---- Convert any of MarkedString | MarkedString[] | MarkupContent into markdown text lines
--- see https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_hover
--- Useful for textDocument/hover, textDocument/signatureHelp, and potentially others.
+--- Converts any of `MarkedString` | `MarkedString[]` | `MarkupContent` into
+--- a list of lines containing valid markdown. Useful to populate the hover
+--- window for `textDocument/hover`, for parsing the result of
+--- `textDocument/signatureHelp`, and potentially others.
+---
+--@param input (`MarkedString` | `MarkedString[]` | `MarkupContent`)
+--@param contents (table, optional, default `{}`) List of strings to extend with converted lines
+--@returns {contents}, extended with lines of converted markdown.
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
function M.convert_input_to_markdown_lines(input, contents)
contents = contents or {}
-- MarkedString variation 1
@@ -416,8 +478,11 @@ function M.convert_input_to_markdown_lines(input, contents)
return contents
end
---- Convert SignatureHelp response to markdown lines.
--- https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_signatureHelp
+--- Converts `textDocument/SignatureHelp` response to markdown lines.
+---
+--@param signature_help Response of `textDocument/SignatureHelp`
+--@returns list of lines of converted markdown.
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
function M.convert_signature_help_to_markdown_lines(signature_help)
if not signature_help.signatures then
return
@@ -427,7 +492,10 @@ function M.convert_signature_help_to_markdown_lines(signature_help)
--=== 0`. Whenever possible implementors should make an active decision about
--the active signature and shouldn't rely on a default value.
local contents = {}
- local active_signature = signature_help.activeSignature or 0
+ local active_signature = signature_help.activeSignature
+ if active_signature == vim.NIL or active_signature == nil then
+ active_signature = 0
+ end
-- If the activeSignature is not inside the valid range, then clip it.
if active_signature >= #signature_help.signatures then
active_signature = 0
@@ -440,13 +508,13 @@ function M.convert_signature_help_to_markdown_lines(signature_help)
if signature.documentation then
M.convert_input_to_markdown_lines(signature.documentation, contents)
end
- if signature_help.parameters then
+ if signature.parameters and #signature.parameters > 0 then
local active_parameter = signature_help.activeParameter or 0
-- If the activeParameter is not inside the valid range, then clip it.
- if active_parameter >= #signature_help.parameters then
+ if active_parameter >= #signature.parameters then
active_parameter = 0
end
- local parameter = signature.parameters and signature.parameters[active_parameter]
+ local parameter = signature.parameters[active_parameter + 1]
if parameter then
--[=[
--Represents a parameter of a callable-signature. A parameter can
@@ -467,14 +535,21 @@ function M.convert_signature_help_to_markdown_lines(signature_help)
}
--]=]
-- TODO highlight parameter
- if parameter.documentation then
- M.convert_input_help_to_markdown_lines(parameter.documentation, contents)
+ if parameter.documentation and parameter.documentation ~= vim.NIL then
+ M.convert_input_to_markdown_lines(parameter.documentation, contents)
end
end
end
return contents
end
+--- Creates a table with sensible default options for a floating window. The
+--- table can be passed to |nvim_open_win()|.
+---
+--@param width (number) window width (in character cells)
+--@param height (number) window height (in character cells)
+--@param opts (table, optional)
+--@returns (table) Options
function M.make_floating_popup_options(width, height, opts)
validate {
opts = { opts, 't', true };
@@ -520,6 +595,10 @@ function M.make_floating_popup_options(width, height, opts)
}
end
+--- Jumps to a location.
+---
+--@param location (`Location`|`LocationLink`)
+--@returns `true` if the jump succeeded
function M.jump_to_location(location)
-- location may be Location or LocationLink
local uri = location.uri or location.targetUri
@@ -543,14 +622,14 @@ function M.jump_to_location(location)
return true
end
---- Preview a location in a floating windows
+--- Previews a location in a floating window
---
--- behavior depends on type of location:
--- - for Location, range is shown (e.g., function definition)
--- - for LocationLink, targetRange is shown (e.g., body of function definition)
---
---@param location a single Location or LocationLink
---@return bufnr,winnr buffer and window number of floating window or nil
+--@param location a single `Location` or `LocationLink`
+--@returns (bufnr,winnr) buffer and window number of floating window or nil
function M.preview_location(location)
-- location may be LocationLink or Location (more useful for the former)
local uri = location.targetUri or location.uri
@@ -565,6 +644,7 @@ function M.preview_location(location)
return M.open_floating_preview(contents, filetype)
end
+--@private
local function find_window_by_var(name, value)
for _, win in ipairs(api.nvim_list_wins()) do
if npcall(api.nvim_win_get_var, win, name) == value then
@@ -573,19 +653,25 @@ local function find_window_by_var(name, value)
end
end
--- Check if a window with `unique_name` tagged is associated with the current
--- buffer. If not, make a new preview.
---
--- fn()'s return bufnr, winnr
--- case that a new floating window should be created.
+--- Enters/leaves the focusable window associated with the current buffer via the
+--window - variable `unique_name`. If no such window exists, run the function
+--{fn}.
+---
+--@param unique_name (string) Window variable
+--@param fn (function) should return create a new window and return a tuple of
+---({focusable_buffer_id}, {window_id}). if {focusable_buffer_id} is a valid
+---buffer id, the newly created window will be the new focus associated with
+---the current buffer via the tag `unique_name`.
+--@returns (pbufnr, pwinnr) if `fn()` has created a new window; nil otherwise
function M.focusable_float(unique_name, fn)
+ -- Go back to previous window if we are in a focusable one
if npcall(api.nvim_win_get_var, 0, unique_name) then
return api.nvim_command("wincmd p")
end
local bufnr = api.nvim_get_current_buf()
do
local win = find_window_by_var(unique_name, bufnr)
- if win then
+ if win and api.nvim_win_is_valid(win) and not vim.fn.pumvisible() then
api.nvim_set_current_win(win)
api.nvim_command("stopinsert")
return
@@ -598,18 +684,21 @@ function M.focusable_float(unique_name, fn)
end
end
--- Check if a window with `unique_name` tagged is associated with the current
--- buffer. If not, make a new preview.
---
--- fn()'s return values will be passed directly to open_floating_preview in the
--- case that a new floating window should be created.
+--- Focuses/unfocuses the floating preview window associated with the current
+--- buffer via the window variable `unique_name`. If no such preview window
+--- exists, makes a new one.
+---
+--@param unique_name (string) Window variable
+--@param fn (function) The return values of this function will be passed
+---directly to |vim.lsp.util.open_floating_preview()|, in the case that a new
+---floating window should be created
function M.focusable_preview(unique_name, fn)
return M.focusable_float(unique_name, function()
return M.open_floating_preview(fn())
end)
end
---- Trim empty lines from input and pad left and right with spaces
+--- Trims empty lines from input and pad left and right with spaces
---
--@param contents table of lines to trim and pad
--@param opts dictionary with optional fields
@@ -617,7 +706,7 @@ end
-- - pad_right number of columns to pad contents at right (default 1)
-- - pad_top number of lines to pad contents at top (default 0)
-- - pad_bottom number of lines to pad contents at bottom (default 0)
---@return contents table of trimmed and padded lines
+--@returns contents table of trimmed and padded lines
function M._trim_and_pad(contents, opts)
validate {
contents = { contents, 't' };
@@ -645,12 +734,13 @@ end
---- Convert markdown into syntax highlighted regions by stripping the code
+-- TODO: refactor to separate stripping/converting and make use of open_floating_preview
+--
+--- Converts markdown into syntax highlighted regions by stripping the code
--- blocks and converting them into highlighted code.
--- This will by default insert a blank line separator after those code block
--- regions to improve readability.
---- The result is shown in a floating preview
---- TODO: refactor to separate stripping/converting and make use of open_floating_preview
+--- The result is shown in a floating preview.
---
--@param contents table of lines to show in window
--@param opts dictionary with optional fields
@@ -664,7 +754,7 @@ end
-- - pad_top number of lines to pad contents at top
-- - pad_bottom number of lines to pad contents at bottom
-- - separator insert separator after code block
---@return width,height size of float
+--@returns width,height size of float
function M.fancy_floating_markdown(contents, opts)
validate {
contents = { contents, 't' };
@@ -713,13 +803,14 @@ function M.fancy_floating_markdown(contents, opts)
local width, height = M._make_floating_popup_size(stripped, opts)
-- Insert blank line separator after code block
- local insert_separator = opts.separator or true
+ local insert_separator = opts.separator
+ if insert_separator == nil then insert_separator = true end
if insert_separator then
for i, h in ipairs(highlights) do
h.start = h.start + i - 1
h.finish = h.finish + i - 1
if h.finish + 1 <= #stripped then
- table.insert(stripped, h.finish + 1, string.rep("─", width))
+ table.insert(stripped, h.finish + 1, string.rep("─", math.min(width, opts.wrap_at or width)))
height = height + 1
end
end
@@ -738,6 +829,7 @@ function M.fancy_floating_markdown(contents, opts)
vim.cmd("ownsyntax markdown")
local idx = 1
+ --@private
local function apply_syntax_to_region(ft, start, finish)
if ft == '' then return end
local name = ft..idx
@@ -763,11 +855,17 @@ function M.fancy_floating_markdown(contents, opts)
return bufnr, winnr
end
+--- Creates autocommands to close a preview window when events happen.
+---
+--@param events (table) list of events
+--@param winnr (number) window id of preview window
+--@see |autocmd-events|
function M.close_preview_autocmd(events, winnr)
api.nvim_command("autocmd "..table.concat(events, ',').." <buffer> ++once lua pcall(vim.api.nvim_win_close, "..winnr..", true)")
end
---- Compute size of float needed to show contents (with optional wrapping)
+--@internal
+--- Computes size of float needed to show contents (with optional wrapping)
---
--@param contents table of lines to show in window
--@param opts dictionary with optional fields
@@ -776,7 +874,7 @@ end
-- - wrap_at character to wrap at for computing height
-- - max_width maximal width of floating window
-- - max_height maximal height of floating window
---@return width,height size of float
+--@returns width,height size of float
function M._make_floating_popup_size(contents, opts)
validate {
contents = { contents, 't' };
@@ -827,7 +925,7 @@ function M._make_floating_popup_size(contents, opts)
return width, height
end
---- Show contents in a floating window
+--- Shows contents in a floating window.
---
--@param contents table of lines to show in window
--@param filetype string of filetype to set for opened buffer
@@ -841,7 +939,8 @@ end
-- - pad_right number of columns to pad contents at right
-- - pad_top number of lines to pad contents at top
-- - pad_bottom number of lines to pad contents at bottom
---@return bufnr,winnr buffer and window number of floating window or nil
+--@returns bufnr,winnr buffer and window number of the newly created floating
+---preview window
function M.open_floating_preview(contents, filetype, opts)
validate {
contents = { contents, 't' };
@@ -912,6 +1011,9 @@ do
severity_floating_highlights[severity] = floating_highlight_name
end
+ --- Clears diagnostics for a buffer.
+ ---
+ --@param bufnr (number) buffer id
function M.buf_clear_diagnostics(bufnr)
validate { bufnr = {bufnr, 'n', true} }
bufnr = bufnr == 0 and api.nvim_get_current_buf() or bufnr
@@ -923,10 +1025,18 @@ do
api.nvim_buf_clear_namespace(bufnr, diagnostic_ns, 0, -1)
end
+ --- Gets the name of a severity's highlight group.
+ ---
+ --@param severity A member of `vim.lsp.protocol.DiagnosticSeverity`
+ --@returns (string) Highlight group name
function M.get_severity_highlight_name(severity)
return severity_highlights[severity]
end
+ --- Gets list of diagnostics for the current line.
+ ---
+ --@returns (table) list of `Diagnostic` tables
+ --@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic
function M.get_line_diagnostics()
local bufnr = api.nvim_get_current_buf()
local linenr = api.nvim_win_get_cursor(0)[1] - 1
@@ -941,6 +1051,8 @@ do
return diagnostics_by_line[linenr] or {}
end
+ --- Displays the diagnostics for the current line in a floating hover
+ --- window.
function M.show_line_diagnostics()
-- local marks = api.nvim_buf_get_extmarks(bufnr, diagnostic_ns, {line, 0}, {line, -1}, {})
-- if #marks == 0 then
@@ -977,10 +1089,10 @@ do
return popup_bufnr, winnr
end
- --- Saves the diagnostics (Diagnostic[]) into diagnostics_by_buf
+ --- Saves diagnostics into vim.lsp.util.diagnostics_by_buf[{bufnr}].
---
- --@param bufnr bufnr for which the diagnostics are for.
- --@param diagnostics Diagnostics[] received from the language server.
+ --@param bufnr (number) buffer id for which the diagnostics are for
+ --@param diagnostics list of `Diagnostic`s received from the LSP server
function M.buf_diagnostics_save_positions(bufnr, diagnostics)
validate {
bufnr = {bufnr, 'n', true};
@@ -1000,6 +1112,10 @@ do
M.diagnostics_by_buf[bufnr] = diagnostics
end
+ --- Highlights a list of diagnostics in a buffer by underlining them.
+ ---
+ --@param bufnr (number) buffer id
+ --@param diagnostics (list of `Diagnostic`s)
function M.buf_diagnostics_underline(bufnr, diagnostics)
for _, diagnostic in ipairs(diagnostics) do
local start = diagnostic.range["start"]
@@ -1020,11 +1136,18 @@ do
end
end
+ --- Removes document highlights from a buffer.
+ ---
+ --@param bufnr buffer id
function M.buf_clear_references(bufnr)
validate { bufnr = {bufnr, 'n', true} }
api.nvim_buf_clear_namespace(bufnr, reference_ns, 0, -1)
end
+ --- Shows a list of document highlights for a certain buffer.
+ ---
+ --@param bufnr buffer id
+ --@param references List of `DocumentHighlight` objects to highlight
function M.buf_highlight_references(bufnr, references)
validate { bufnr = {bufnr, 'n', true} }
for _, reference in ipairs(references) do
@@ -1040,11 +1163,19 @@ do
end
end
+ --- Groups a list of diagnostics by line.
+ ---
+ --@param diagnostics (table) list of `Diagnostic`s
+ --@returns (table) dictionary mapping lines to lists of diagnostics valid on
+ ---those lines
+ --@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#diagnostic
function M.diagnostics_group_by_line(diagnostics)
if not diagnostics then return end
local diagnostics_by_line = {}
for _, diagnostic in ipairs(diagnostics) do
local start = diagnostic.range.start
+ -- TODO: Are diagnostics only valid for a single line? I don't understand
+ -- why this would be okay otherwise
local line_diagnostics = diagnostics_by_line[start.line]
if not line_diagnostics then
line_diagnostics = {}
@@ -1055,6 +1186,11 @@ do
return diagnostics_by_line
end
+ --- Given a list of diagnostics, sets the corresponding virtual text for a
+ --- buffer.
+ ---
+ --@param bufnr buffer id
+ --@param diagnostics (table) list of `Diagnostic`s
function M.buf_diagnostics_virtual_text(bufnr, diagnostics)
if not diagnostics then
return
@@ -1093,8 +1229,7 @@ do
--- </pre>
---
--@param kind Diagnostic severity kind: See |vim.lsp.protocol.DiagnosticSeverity|
- ---
- --@return Count of diagnostics
+ --@returns Count of diagnostics
function M.buf_diagnostics_count(kind)
local bufnr = vim.api.nvim_get_current_buf()
local diagnostics = M.diagnostics_by_buf[bufnr]
@@ -1115,7 +1250,7 @@ do
[protocol.DiagnosticSeverity.Hint] = "LspDiagnosticsHintSign";
}
- --- Place signs for each diagnostic in the sign column.
+ --- Places signs for each diagnostic in the sign column.
---
--- Sign characters can be customized with the following commands:
---
@@ -1136,8 +1271,11 @@ local position_sort = sort_by_key(function(v)
return {v.start.line, v.start.character}
end)
--- Returns the items with the byte position calculated correctly and in sorted
--- order.
+--- Returns the items with the byte position calculated correctly and in sorted
+--- order, for display in quickfix and location lists.
+---
+--@param locations (table) list of `Location`s or `LocationLink`s
+--@returns (table) list of items
function M.locations_to_items(locations)
local items = {}
local grouped = setmetatable({}, {
@@ -1180,6 +1318,10 @@ function M.locations_to_items(locations)
return items
end
+--- Fills current window's location list with given list of items.
+--- Can be obtained with e.g. |vim.lsp.util.locations_to_items()|.
+---
+--@param items (table) list of items
function M.set_loclist(items)
vim.fn.setloclist(0, {}, ' ', {
title = 'Language Server';
@@ -1187,6 +1329,10 @@ function M.set_loclist(items)
})
end
+--- Fills quickfix list with given list of items.
+--- Can be obtained with e.g. |vim.lsp.util.locations_to_items()|.
+---
+--@param items (table) list of items
function M.set_qflist(items)
vim.fn.setqflist({}, ' ', {
title = 'Language Server';
@@ -1201,10 +1347,11 @@ function M._get_symbol_kind_name(symbol_kind)
return protocol.SymbolKind[symbol_kind] or "Unknown"
end
---- Convert symbols to quickfix list items
+--- Converts symbols to quickfix list items.
---
--@param symbols DocumentSymbol[] or SymbolInformation[]
function M.symbols_to_items(symbols, bufnr)
+ --@private
local function _symbols_to_items(_symbols, _items, _bufnr)
for _, symbol in ipairs(_symbols) do
if symbol.location then -- SymbolInformation type
@@ -1239,7 +1386,9 @@ function M.symbols_to_items(symbols, bufnr)
return _symbols_to_items(symbols, {}, bufnr)
end
--- Remove empty lines from the beginning and end.
+--- Removes empty lines from the beginning and end.
+--@param lines (table) list of lines to trim
+--@returns (table) trimmed list of lines
function M.trim_empty_lines(lines)
local start = 1
for i = 1, #lines do
@@ -1258,11 +1407,13 @@ function M.trim_empty_lines(lines)
return vim.list_extend({}, lines, start, finish)
end
--- Accepts markdown lines and tries to reduce it to a filetype if it is
--- just a single code block.
--- Note: This modifies the input.
---
--- Returns: filetype or 'markdown' if it was unchanged.
+--- Accepts markdown lines and tries to reduce them to a filetype if they
+--- comprise just a single code block.
+---
+--- CAUTION: Modifies the input in-place!
+---
+--@param lines (table) list of lines
+--@returns (string) filetype or 'markdown' if it was unchanged.
function M.try_trim_markdown_code_blocks(lines)
local language_id = lines[1]:match("^```(.*)")
if language_id then
@@ -1285,14 +1436,22 @@ function M.try_trim_markdown_code_blocks(lines)
end
local str_utfindex = vim.str_utfindex
+--@private
local function make_position_param()
local row, col = unpack(api.nvim_win_get_cursor(0))
row = row - 1
local line = api.nvim_buf_get_lines(0, row, row+1, true)[1]
+ if not line then
+ return { line = 0; character = 0; }
+ end
col = str_utfindex(line, col)
return { line = row; character = col; }
end
+--- Creates a `TextDocumentPositionParams` object for the current buffer and cursor position.
+---
+--@returns `TextDocumentPositionParams` object
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
function M.make_position_params()
return {
textDocument = M.make_text_document_params();
@@ -1300,19 +1459,65 @@ function M.make_position_params()
}
end
+--- Using the current position in the current buffer, creates an object that
+--- can be used as a building block for several LSP requests, such as
+--- `textDocument/codeAction`, `textDocument/colorPresentation`,
+--- `textDocument/rangeFormatting`.
+---
+--@returns { textDocument = { uri = `current_file_uri` }, range = { start =
+---`current_position`, end = `current_position` } }
function M.make_range_params()
local position = make_position_param()
return {
- textDocument = { uri = vim.uri_from_bufnr(0) },
+ textDocument = M.make_text_document_params(),
range = { start = position; ["end"] = position; }
}
end
+--- Using the given range in the current buffer, creates an object that
+--- is similar to |vim.lsp.util.make_range_params()|.
+---
+--@param start_pos ({number, number}, optional) mark-indexed position.
+---Defaults to the start of the last visual selection.
+--@param end_pos ({number, number}, optional) mark-indexed position.
+---Defaults to the end of the last visual selection.
+--@returns { textDocument = { uri = `current_file_uri` }, range = { start =
+---`start_position`, end = `end_position` } }
+function M.make_given_range_params(start_pos, end_pos)
+ validate {
+ start_pos = {start_pos, 't', true};
+ end_pos = {end_pos, 't', true};
+ }
+ local A = list_extend({}, start_pos or api.nvim_buf_get_mark(0, '<'))
+ local B = list_extend({}, end_pos or api.nvim_buf_get_mark(0, '>'))
+ -- convert to 0-index
+ A[1] = A[1] - 1
+ B[1] = B[1] - 1
+ -- account for encoding.
+ if A[2] > 0 then
+ A = {A[1], M.character_offset(0, A[1], A[2])}
+ end
+ if B[2] > 0 then
+ B = {B[1], M.character_offset(0, B[1], B[2])}
+ end
+ return {
+ textDocument = M.make_text_document_params(),
+ range = {
+ start = {line = A[1], character = A[2]},
+ ['end'] = {line = B[1], character = B[2]}
+ }
+ }
+end
+
+--- Creates a `TextDocumentIdentifier` object for the current buffer.
+---
+--@returns `TextDocumentIdentifier`
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
function M.make_text_document_params()
return { uri = vim.uri_from_bufnr(0) }
end
---- Get visual width of tabstop.
+--- Returns visual width of tabstop.
---
--@see |softtabstop|
--@param bufnr (optional, number): Buffer handle, defaults to current
@@ -1324,6 +1529,11 @@ function M.get_effective_tabstop(bufnr)
return (sts > 0 and sts) or (sts < 0 and bo.shiftwidth) or bo.tabstop
end
+--- Creates a `FormattingOptions` object for the current buffer and cursor position.
+---
+--@param options Table with valid `FormattingOptions` entries
+--@returns `FormattingOptions object
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
function M.make_formatting_params(options)
validate { options = {options, 't', true} }
options = vim.tbl_extend('keep', options or {}, {
@@ -1336,9 +1546,12 @@ function M.make_formatting_params(options)
}
end
--- @param buf buffer handle or 0 for current.
--- @param row 0-indexed line
--- @param col 0-indexed byte offset in line
+--- Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer.
+---
+--@param buf buffer id (0 for current)
+--@param row 0-indexed line
+--@param col 0-indexed byte offset in line
+--@returns (number, number) UTF-32 and UTF-16 index of the character in line {row} column {col} in buffer {buf}
function M.character_offset(buf, row, col)
local line = api.nvim_buf_get_lines(buf, row, row+1, true)[1]
-- If the col is past the EOL, use the line length.
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index 6e427665f2..995c52e8ed 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -190,10 +190,10 @@ function vim.tbl_contains(t, value)
return false
end
--- Returns true if the table is empty, and contains no indexed or keyed values.
---
---@see From https://github.com/premake/premake-core/blob/master/src/base/table.lua
---
+--- Checks if a table is empty.
+---
+--@see https://github.com/premake/premake-core/blob/master/src/base/table.lua
+---
--@param t Table to check
function vim.tbl_isempty(t)
assert(type(t) == 'table', string.format("Expected table, got %s", type(t)))
@@ -347,13 +347,11 @@ function vim.tbl_flatten(t)
return result
end
---- Determine whether a Lua table can be treated as an array.
+--- Tests if a Lua table can be treated as an array.
---
---- An empty table `{}` will default to being treated as an array.
---- Use `vim.emtpy_dict()` to create a table treated as an
---- empty dict. Empty tables returned by `rpcrequest()` and
---- `vim.fn` functions can be checked using this function
---- whether they represent empty API arrays and vimL lists.
+--- Empty table `{}` is assumed to be an array, unless it was created by
+--- |vim.empty_dict()| or returned as a dict-like |API| or Vimscript result,
+--- for example from |rpcrequest()| or |vim.fn|.
---
--@param t Table
--@returns `true` if array-like table, else `false`.
@@ -479,48 +477,77 @@ end
--- 2. (arg_value, fn, msg)
--- - arg_value: argument value
--- - fn: any function accepting one argument, returns true if and
---- only if the argument is valid
+--- only if the argument is valid. Can optionally return an additional
+--- informative error message as the second returned value.
--- - msg: (optional) error string if validation fails
function vim.validate(opt) end -- luacheck: no unused
-vim.validate = (function()
+
+do
local type_names = {
- t='table', s='string', n='number', b='boolean', f='function', c='callable',
- ['table']='table', ['string']='string', ['number']='number',
- ['boolean']='boolean', ['function']='function', ['callable']='callable',
- ['nil']='nil', ['thread']='thread', ['userdata']='userdata',
+ ['table'] = 'table', t = 'table',
+ ['string'] = 'string', s = 'string',
+ ['number'] = 'number', n = 'number',
+ ['boolean'] = 'boolean', b = 'boolean',
+ ['function'] = 'function', f = 'function',
+ ['callable'] = 'callable', c = 'callable',
+ ['nil'] = 'nil',
+ ['thread'] = 'thread',
+ ['userdata'] = 'userdata',
}
- local function _type_name(t)
- local tname = type_names[t]
- if tname == nil then
- error(string.format('invalid type name: %s', tostring(t)))
- end
- return tname
- end
+
local function _is_type(val, t)
return t == 'callable' and vim.is_callable(val) or type(val) == t
end
- return function(opt)
- assert(type(opt) == 'table', string.format('opt: expected table, got %s', type(opt)))
+ local function is_valid(opt)
+ if type(opt) ~= 'table' then
+ return false, string.format('opt: expected table, got %s', type(opt))
+ end
+
for param_name, spec in pairs(opt) do
- assert(type(spec) == 'table', string.format('%s: expected table, got %s', param_name, type(spec)))
+ if type(spec) ~= 'table' then
+ return false, string.format('opt[%s]: expected table, got %s', param_name, type(spec))
+ end
local val = spec[1] -- Argument value.
local t = spec[2] -- Type name, or callable.
local optional = (true == spec[3])
- if not vim.is_callable(t) then -- Check type name.
- if (not optional or val ~= nil) and not _is_type(val, _type_name(t)) then
- error(string.format("%s: expected %s, got %s", param_name, _type_name(t), type(val)))
+ if type(t) == 'string' then
+ local t_name = type_names[t]
+ if not t_name then
+ return false, string.format('invalid type name: %s', t)
+ end
+
+ if (not optional or val ~= nil) and not _is_type(val, t_name) then
+ return false, string.format("%s: expected %s, got %s", param_name, t_name, type(val))
end
- elseif not t(val) then -- Check user-provided validation function.
- error(string.format("%s: expected %s, got %s", param_name, (spec[3] or '?'), val))
+ elseif vim.is_callable(t) then
+ -- Check user-provided validation function.
+ local valid, optional_message = t(val)
+ if not valid then
+ local error_message = string.format("%s: expected %s, got %s", param_name, (spec[3] or '?'), val)
+ if optional_message ~= nil then
+ error_message = error_message .. string.format(". Info: %s", optional_message)
+ end
+
+ return false, error_message
+ end
+ else
+ return false, string.format("invalid type name: %s", tostring(t))
end
end
- return true
+
+ return true, nil
end
-end)()
+ function vim.validate(opt)
+ local ok, err_msg = is_valid(opt)
+ if not ok then
+ error(debug.traceback(err_msg, 2), 2)
+ end
+ end
+end
--- Returns true if object `f` can be called as a function.
---
--@param f Any object
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 927456708c..0de3388356 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -1,4 +1,6 @@
local a = vim.api
+local query = require'vim.treesitter.query'
+local language = require'vim.treesitter.language'
-- TODO(bfredl): currently we retain parsers for the lifetime of the buffer.
-- Consider use weak references to release parser if all plugins are done with
@@ -8,12 +10,20 @@ local parsers = {}
local Parser = {}
Parser.__index = Parser
+--- Parses the buffer if needed and returns a tree.
+--
+-- Calling this will call the on_changedtree callbacks if the tree has changed.
+--
+-- @returns An up to date tree
+-- @returns If the tree changed with this call, the changed ranges
function Parser:parse()
if self.valid then
return self.tree
end
local changes
- self.tree, changes = self._parser:parse_buf(self.bufnr)
+
+ self.tree, changes = self._parser:parse(self:input_source())
+
self.valid = true
if not vim.tbl_isempty(changes) then
@@ -25,61 +35,86 @@ function Parser:parse()
return self.tree, changes
end
-function Parser:_on_lines(bufnr, changed_tick, start_row, old_stop_row, stop_row, old_byte_size)
- local start_byte = a.nvim_buf_get_offset(bufnr,start_row)
- local stop_byte = a.nvim_buf_get_offset(bufnr,stop_row)
- local old_stop_byte = start_byte + old_byte_size
- self._parser:edit(start_byte,old_stop_byte,stop_byte,
- start_row,0,old_stop_row,0,stop_row,0)
+function Parser:input_source()
+ return self.bufnr or self.str
+end
+
+function Parser:_on_bytes(bufnr, changed_tick,
+ start_row, start_col, start_byte,
+ old_row, old_col, old_byte,
+ new_row, new_col, new_byte)
+ local old_end_col = old_col + ((old_row == 0) and start_col or 0)
+ local new_end_col = new_col + ((new_row == 0) and start_col or 0)
+ self._parser:edit(start_byte,start_byte+old_byte,start_byte+new_byte,
+ start_row, start_col,
+ start_row+old_row, old_end_col,
+ start_row+new_row, new_end_col)
self.valid = false
- for _, cb in ipairs(self.lines_cbs) do
- cb(bufnr, changed_tick, start_row, old_stop_row, stop_row, old_byte_size)
+ for _, cb in ipairs(self.bytes_cbs) do
+ cb(bufnr, changed_tick,
+ start_row, start_col, start_byte,
+ old_row, old_col, old_byte,
+ new_row, new_col, new_byte)
end
end
+--- Registers callbacks for the parser
+-- @param cbs An `nvim_buf_attach`-like table argument with the following keys :
+-- `on_bytes` : see `nvim_buf_attach`, but this will be called _after_ the parsers callback.
+-- `on_changedtree` : a callback that will be called everytime the tree has syntactical changes.
+-- it will only be passed one argument, that is a table of the ranges (as node ranges) that
+-- changed.
+function Parser:register_cbs(cbs)
+ if not cbs then return end
+
+ if cbs.on_changedtree then
+ table.insert(self.changedtree_cbs, cbs.on_changedtree)
+ end
+
+ if cbs.on_bytes then
+ table.insert(self.bytes_cbs, cbs.on_bytes)
+ end
+end
+
+--- Sets the included ranges for the current parser
+--
+-- @param ranges A table of nodes that will be used as the ranges the parser should include.
function Parser:set_included_ranges(ranges)
self._parser:set_included_ranges(ranges)
-- The buffer will need to be parsed again later
self.valid = false
end
-local M = {
- parse_query = vim._ts_parse_query,
-}
+--- Gets the included ranges for the parsers
+function Parser:included_ranges()
+ return self._parser:included_ranges()
+end
+
+local M = vim.tbl_extend("error", query, language)
setmetatable(M, {
__index = function (t, k)
if k == "TSHighlighter" then
- t[k] = require'vim.tshighlighter'
+ a.nvim_err_writeln("vim.TSHighlighter is deprecated, please use vim.treesitter.highlighter")
+ t[k] = require'vim.treesitter.highlighter'
+ return t[k]
+ elseif k == "highlighter" then
+ t[k] = require'vim.treesitter.highlighter'
return t[k]
end
end
})
-function M.require_language(lang, path)
- if vim._ts_has_language(lang) then
- return true
- end
- if path == nil then
- local fname = 'parser/' .. lang .. '.*'
- local paths = a.nvim_get_runtime_file(fname, false)
- if #paths == 0 then
- -- TODO(bfredl): help tag?
- error("no parser for '"..lang.."' language")
- end
- path = paths[1]
- end
- vim._ts_add_language(path, lang)
-end
-
-function M.inspect_language(lang)
- M.require_language(lang)
- return vim._ts_inspect_language(lang)
-end
-
-function M.create_parser(bufnr, lang, id)
- M.require_language(lang)
+--- Creates a new parser.
+--
+-- It is not recommended to use this, use vim.treesitter.get_parser() instead.
+--
+-- @param bufnr The buffer the parser will be tied to
+-- @param lang The language of the parser.
+-- @param id The id the parser will have
+function M._create_parser(bufnr, lang, id)
+ language.require_language(lang)
if bufnr == 0 then
bufnr = a.nvim_get_current_buf()
end
@@ -89,12 +124,12 @@ function M.create_parser(bufnr, lang, id)
local self = setmetatable({bufnr=bufnr, lang=lang, valid=false}, Parser)
self._parser = vim._create_ts_parser(lang)
self.changedtree_cbs = {}
- self.lines_cbs = {}
+ self.bytes_cbs = {}
self:parse()
-- TODO(bfredl): use weakref to self, so that the parser is free'd is no plugin is
-- using it.
- local function lines_cb(_, ...)
- return self:_on_lines(...)
+ local function bytes_cb(_, ...)
+ return self:_on_bytes(...)
end
local detach_cb = nil
if id ~= nil then
@@ -104,157 +139,50 @@ function M.create_parser(bufnr, lang, id)
end
end
end
- a.nvim_buf_attach(self.bufnr, false, {on_lines=lines_cb, on_detach=detach_cb})
+ a.nvim_buf_attach(self.bufnr, false, {on_bytes=bytes_cb, on_detach=detach_cb})
return self
end
-function M.get_parser(bufnr, ft, buf_attach_cbs)
+--- Gets the parser for this bufnr / ft combination.
+--
+-- If needed this will create the parser.
+-- Unconditionnally attach the provided callback
+--
+-- @param bufnr The buffer the parser should be tied to
+-- @param ft The filetype of this parser
+-- @param buf_attach_cbs See Parser:register_cbs
+--
+-- @returns The parser
+function M.get_parser(bufnr, lang, buf_attach_cbs)
if bufnr == nil or bufnr == 0 then
bufnr = a.nvim_get_current_buf()
end
- if ft == nil then
- ft = a.nvim_buf_get_option(bufnr, "filetype")
+ if lang == nil then
+ lang = a.nvim_buf_get_option(bufnr, "filetype")
end
- local id = tostring(bufnr)..'_'..ft
+ local id = tostring(bufnr)..'_'..lang
if parsers[id] == nil then
- parsers[id] = M.create_parser(bufnr, ft, id)
- end
-
- if buf_attach_cbs and buf_attach_cbs.on_changedtree then
- table.insert(parsers[id].changedtree_cbs, buf_attach_cbs.on_changedtree)
+ parsers[id] = M._create_parser(bufnr, lang, id)
end
- if buf_attach_cbs and buf_attach_cbs.on_lines then
- table.insert(parsers[id].lines_cbs, buf_attach_cbs.on_lines)
- end
+ parsers[id]:register_cbs(buf_attach_cbs)
return parsers[id]
end
--- query: pattern matching on trees
--- predicate matching is implemented in lua
-local Query = {}
-Query.__index = Query
+function M.get_string_parser(str, lang)
+ vim.validate {
+ str = { str, 'string' },
+ lang = { lang, 'string' }
+ }
+ language.require_language(lang)
-local magic_prefixes = {['\\v']=true, ['\\m']=true, ['\\M']=true, ['\\V']=true}
-local function check_magic(str)
- if string.len(str) < 2 or magic_prefixes[string.sub(str,1,2)] then
- return str
- end
- return '\\v'..str
-end
+ local self = setmetatable({str=str, lang=lang, valid=false}, Parser)
+ self._parser = vim._create_ts_parser(lang)
+ self:parse()
-function M.parse_query(lang, query)
- M.require_language(lang)
- local self = setmetatable({}, Query)
- self.query = vim._ts_parse_query(lang, vim.fn.escape(query,'\\'))
- self.info = self.query:inspect()
- self.captures = self.info.captures
- self.regexes = {}
- for id,preds in pairs(self.info.patterns) do
- local regexes = {}
- for i, pred in ipairs(preds) do
- if (pred[1] == "match?" and type(pred[2]) == "number"
- and type(pred[3]) == "string") then
- regexes[i] = vim.regex(check_magic(pred[3]))
- end
- end
- if next(regexes) then
- self.regexes[id] = regexes
- end
- end
return self
end
-local function get_node_text(node, bufnr)
- local start_row, start_col, end_row, end_col = node:range()
- if start_row ~= end_row then
- return nil
- end
- local line = a.nvim_buf_get_lines(bufnr, start_row, start_row+1, true)[1]
- return string.sub(line, start_col+1, end_col)
-end
-
-function Query:match_preds(match, pattern, bufnr)
- local preds = self.info.patterns[pattern]
- if not preds then
- return true
- end
- local regexes = self.regexes[pattern]
- for i, pred in pairs(preds) do
- -- Here we only want to return if a predicate DOES NOT match, and
- -- continue on the other case. This way unknown predicates will not be considered,
- -- which allows some testing and easier user extensibility (#12173).
- -- Also, tree-sitter strips the leading # from predicates for us.
- if pred[1] == "eq?" then
- local node = match[pred[2]]
- local node_text = get_node_text(node, bufnr)
-
- local str
- if type(pred[3]) == "string" then
- -- (#eq? @aa "foo")
- str = pred[3]
- else
- -- (#eq? @aa @bb)
- str = get_node_text(match[pred[3]], bufnr)
- end
-
- if node_text ~= str or str == nil then
- return false
- end
- elseif pred[1] == "match?" then
- if not regexes or not regexes[i] then
- return false
- end
- local node = match[pred[2]]
- local start_row, start_col, end_row, end_col = node:range()
- if start_row ~= end_row then
- return false
- end
- if not regexes[i]:match_line(bufnr, start_row, start_col, end_col) then
- return false
- end
- end
- end
- return true
-end
-
-function Query:iter_captures(node, bufnr, start, stop)
- if bufnr == 0 then
- bufnr = vim.api.nvim_get_current_buf()
- end
- local raw_iter = node:_rawquery(self.query,true,start,stop)
- local function iter()
- local capture, captured_node, match = raw_iter()
- if match ~= nil then
- local active = self:match_preds(match, match.pattern, bufnr)
- match.active = active
- if not active then
- return iter() -- tail call: try next match
- end
- end
- return capture, captured_node
- end
- return iter
-end
-
-function Query:iter_matches(node, bufnr, start, stop)
- if bufnr == 0 then
- bufnr = vim.api.nvim_get_current_buf()
- end
- local raw_iter = node:_rawquery(self.query,false,start,stop)
- local function iter()
- local pattern, match = raw_iter()
- if match ~= nil then
- local active = self:match_preds(match, pattern, bufnr)
- if not active then
- return iter() -- tail call: try next match
- end
- end
- return pattern, match
- end
- return iter
-end
-
return M
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
new file mode 100644
index 0000000000..decde08019
--- /dev/null
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -0,0 +1,210 @@
+local a = vim.api
+
+-- support reload for quick experimentation
+local TSHighlighter = rawget(vim.treesitter, 'TSHighlighter') or {}
+TSHighlighter.__index = TSHighlighter
+
+TSHighlighter.active = TSHighlighter.active or {}
+
+local ns = a.nvim_create_namespace("treesitter/highlighter")
+
+-- These are conventions defined by nvim-treesitter, though it
+-- needs to be user extensible also.
+TSHighlighter.hl_map = {
+ ["error"] = "Error",
+
+-- Miscs
+ ["comment"] = "Comment",
+ ["punctuation.delimiter"] = "Delimiter",
+ ["punctuation.bracket"] = "Delimiter",
+ ["punctuation.special"] = "Delimiter",
+
+-- Constants
+ ["constant"] = "Constant",
+ ["constant.builtin"] = "Special",
+ ["constant.macro"] = "Define",
+ ["string"] = "String",
+ ["string.regex"] = "String",
+ ["string.escape"] = "SpecialChar",
+ ["character"] = "Character",
+ ["number"] = "Number",
+ ["boolean"] = "Boolean",
+ ["float"] = "Float",
+
+-- Functions
+ ["function"] = "Function",
+ ["function.special"] = "Function",
+ ["function.builtin"] = "Special",
+ ["function.macro"] = "Macro",
+ ["parameter"] = "Identifier",
+ ["method"] = "Function",
+ ["field"] = "Identifier",
+ ["property"] = "Identifier",
+ ["constructor"] = "Special",
+
+-- Keywords
+ ["conditional"] = "Conditional",
+ ["repeat"] = "Repeat",
+ ["label"] = "Label",
+ ["operator"] = "Operator",
+ ["keyword"] = "Keyword",
+ ["exception"] = "Exception",
+
+ ["type"] = "Type",
+ ["type.builtin"] = "Type",
+ ["structure"] = "Structure",
+ ["include"] = "Include",
+}
+
+function TSHighlighter.new(parser, query)
+ local self = setmetatable({}, TSHighlighter)
+
+ self.parser = parser
+ parser:register_cbs {
+ on_changedtree = function(...) self:on_changedtree(...) end
+ }
+
+ self:set_query(query)
+ self.edit_count = 0
+ self.redraw_count = 0
+ self.line_count = {}
+ self.root = self.parser:parse():root()
+ a.nvim_buf_set_option(self.buf, "syntax", "")
+
+ -- TODO(bfredl): can has multiple highlighters per buffer????
+ if not TSHighlighter.active[parser.bufnr] then
+ TSHighlighter.active[parser.bufnr] = {}
+ end
+
+ TSHighlighter.active[parser.bufnr][parser.lang] = self
+
+ -- Tricky: if syntax hasn't been enabled, we need to reload color scheme
+ -- but use synload.vim rather than syntax.vim to not enable
+ -- syntax FileType autocmds. Later on we should integrate with the
+ -- `:syntax` and `set syntax=...` machinery properly.
+ if vim.g.syntax_on ~= 1 then
+ vim.api.nvim_command("runtime! syntax/synload.vim")
+ end
+ return self
+end
+
+local function is_highlight_name(capture_name)
+ local firstc = string.sub(capture_name, 1, 1)
+ return firstc ~= string.lower(firstc)
+end
+
+function TSHighlighter:get_hl_from_capture(capture)
+
+ local name = self.query.captures[capture]
+
+ if is_highlight_name(name) then
+ -- From "Normal.left" only keep "Normal"
+ return vim.split(name, '.', true)[1]
+ else
+ -- Default to false to avoid recomputing
+ local hl = TSHighlighter.hl_map[name]
+ return hl and a.nvim_get_hl_id_by_name(hl) or 0
+ end
+end
+
+function TSHighlighter:on_changedtree(changes)
+ for _, ch in ipairs(changes or {}) do
+ a.nvim__buf_redraw_range(self.buf, ch[1], ch[3]+1)
+ end
+end
+
+function TSHighlighter:set_query(query)
+ if type(query) == "string" then
+ query = vim.treesitter.parse_query(self.parser.lang, query)
+ end
+
+ self.query = query
+
+ self.hl_cache = setmetatable({}, {
+ __index = function(table, capture)
+ local hl = self:get_hl_from_capture(capture)
+ rawset(table, capture, hl)
+
+ return hl
+ end
+ })
+
+ a.nvim__buf_redraw_range(self.parser.bufnr, 0, a.nvim_buf_line_count(self.parser.bufnr))
+end
+
+local function iter_active_tshl(buf, fn)
+ for _, hl in pairs(TSHighlighter.active[buf] or {}) do
+ fn(hl)
+ end
+end
+
+local function on_line_impl(self, buf, line)
+ if self.root == nil then
+ return -- parser bought the farm already
+ end
+
+ if self.iter == nil then
+ self.iter = self.query:iter_captures(self.root,buf,line,self.botline)
+ end
+ while line >= self.nextrow do
+ local capture, node = self.iter()
+ if capture == nil then
+ break
+ end
+ local start_row, start_col, end_row, end_col = node:range()
+ local hl = self.hl_cache[capture]
+ if hl and end_row >= line then
+ a.nvim_buf_set_extmark(buf, ns, start_row, start_col,
+ { end_line = end_row, end_col = end_col,
+ hl_group = hl,
+ ephemeral = true
+ })
+ end
+ if start_row > line then
+ self.nextrow = start_row
+ end
+ end
+end
+
+function TSHighlighter._on_line(_, _win, buf, line, highlighter)
+ -- on_line is only called when this is non-nil
+ if highlighter then
+ on_line_impl(highlighter, buf, line)
+ else
+ iter_active_tshl(buf, function(self)
+ on_line_impl(self, buf, line)
+ end)
+ end
+end
+
+function TSHighlighter._on_buf(_, buf)
+ iter_active_tshl(buf, function(self)
+ if self then
+ local tree = self.parser:parse()
+ self.root = (tree and tree:root()) or nil
+ end
+ end)
+end
+
+function TSHighlighter._on_win(_, _win, buf, _topline, botline)
+ iter_active_tshl(buf, function(self)
+ if not self then
+ return false
+ end
+
+ self.iter = nil
+ self.nextrow = 0
+ self.botline = botline
+ self.redraw_count = self.redraw_count + 1
+ return true
+ end)
+ return true
+end
+
+a.nvim_set_decoration_provider(ns, {
+ on_buf = TSHighlighter._on_buf;
+ on_win = TSHighlighter._on_win;
+ on_line = TSHighlighter._on_line;
+})
+
+return TSHighlighter
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
new file mode 100644
index 0000000000..a7e36a0b89
--- /dev/null
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -0,0 +1,37 @@
+local a = vim.api
+
+local M = {}
+
+--- Asserts that the provided language is installed, and optionnaly provide a path for the parser
+--
+-- Parsers are searched in the `parser` runtime directory.
+--
+-- @param lang The language the parser should parse
+-- @param path Optionnal path the parser is located at
+function M.require_language(lang, path)
+ if vim._ts_has_language(lang) then
+ return true
+ end
+ if path == nil then
+ local fname = 'parser/' .. lang .. '.*'
+ local paths = a.nvim_get_runtime_file(fname, false)
+ if #paths == 0 then
+ -- TODO(bfredl): help tag?
+ error("no parser for '"..lang.."' language, see :help treesitter-parsers")
+ end
+ path = paths[1]
+ end
+ vim._ts_add_language(path, lang)
+end
+
+--- Inspects the provided language.
+--
+-- Inspecting provides some useful informations on the language like node names, ...
+--
+-- @param lang The language.
+function M.inspect_language(lang)
+ M.require_language(lang)
+ return vim._ts_inspect_language(lang)
+end
+
+return M
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
new file mode 100644
index 0000000000..2903c5905c
--- /dev/null
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -0,0 +1,335 @@
+local a = vim.api
+local language = require'vim.treesitter.language'
+
+-- query: pattern matching on trees
+-- predicate matching is implemented in lua
+local Query = {}
+Query.__index = Query
+
+local M = {}
+
+-- Filter the runtime query files, the spec is like regular runtime files but in the new `queries`
+-- directory. They resemble ftplugins, that is that you can override queries by adding things in the
+-- `queries` directory, and extend using the `after/queries` directory.
+local function filter_files(file_list)
+ local main = nil
+ local after = {}
+
+ for _, fname in ipairs(file_list) do
+ -- Only get the name of the directory containing the queries directory
+ if vim.fn.fnamemodify(fname, ":p:h:h:h:t") == "after" then
+ table.insert(after, fname)
+ -- The first one is the one with most priority
+ elseif not main then
+ main = fname
+ end
+ end
+
+ return { main, unpack(after) }
+end
+
+local function runtime_query_path(lang, query_name)
+ return string.format('queries/%s/%s.scm', lang, query_name)
+end
+
+local function filtered_runtime_queries(lang, query_name)
+ return filter_files(a.nvim_get_runtime_file(runtime_query_path(lang, query_name), true) or {})
+end
+
+local function get_query_files(lang, query_name, is_included)
+ local lang_files = filtered_runtime_queries(lang, query_name)
+ local query_files = lang_files
+
+ if #query_files == 0 then return {} end
+
+ local base_langs = {}
+
+ -- Now get the base languages by looking at the first line of every file
+ -- The syntax is the folowing :
+ -- ;+ inherits: ({language},)*{language}
+ --
+ -- {language} ::= {lang} | ({lang})
+ local MODELINE_FORMAT = "^;+%s*inherits%s*:?%s*([a-z_,()]+)%s*$"
+
+ for _, file in ipairs(query_files) do
+ local modeline = vim.fn.readfile(file, "", 1)
+
+ if #modeline == 1 then
+ local langlist = modeline[1]:match(MODELINE_FORMAT)
+
+ if langlist then
+ for _, incllang in ipairs(vim.split(langlist, ',', true)) do
+ local is_optional = incllang:match("%(.*%)")
+
+ if is_optional then
+ if not is_included then
+ table.insert(base_langs, incllang:sub(2, #incllang - 1))
+ end
+ else
+ table.insert(base_langs, incllang)
+ end
+ end
+ end
+ end
+ end
+
+ for _, base_lang in ipairs(base_langs) do
+ local base_files = get_query_files(base_lang, query_name, true)
+ vim.list_extend(query_files, base_files)
+ end
+
+ return query_files
+end
+
+local function read_query_files(filenames)
+ local contents = {}
+
+ for _,filename in ipairs(filenames) do
+ vim.list_extend(contents, vim.fn.readfile(filename))
+ end
+
+ return table.concat(contents, '\n')
+end
+
+--- Returns the runtime query {query_name} for {lang}.
+--
+-- @param lang The language to use for the query
+-- @param query_name The name of the query (i.e. "highlights")
+--
+-- @return The corresponding query, parsed.
+function M.get_query(lang, query_name)
+ local query_files = get_query_files(lang, query_name)
+ local query_string = read_query_files(query_files)
+
+ if #query_string > 0 then
+ return M.parse_query(lang, query_string)
+ end
+end
+
+--- Parses a query.
+--
+-- @param language The language
+-- @param query A string containing the query (s-expr syntax)
+--
+-- @returns The query
+function M.parse_query(lang, query)
+ language.require_language(lang)
+ local self = setmetatable({}, Query)
+ self.query = vim._ts_parse_query(lang, query)
+ self.info = self.query:inspect()
+ self.captures = self.info.captures
+ return self
+end
+
+-- TODO(vigoux): support multiline nodes too
+
+--- Gets the text corresponding to a given node
+-- @param node the node
+-- @param bufnr the buffer from which the node in extracted.
+function M.get_node_text(node, source)
+ local start_row, start_col, start_byte = node:start()
+ local end_row, end_col, end_byte = node:end_()
+
+ if type(source) == "number" then
+ if start_row ~= end_row then
+ return nil
+ end
+ local line = a.nvim_buf_get_lines(source, start_row, start_row+1, true)[1]
+ return string.sub(line, start_col+1, end_col)
+ elseif type(source) == "string" then
+ return source:sub(start_byte+1, end_byte)
+ end
+end
+
+-- Predicate handler receive the following arguments
+-- (match, pattern, bufnr, predicate)
+local predicate_handlers = {
+ ["eq?"] = function(match, _, source, predicate)
+ local node = match[predicate[2]]
+ local node_text = M.get_node_text(node, source)
+
+ local str
+ if type(predicate[3]) == "string" then
+ -- (#eq? @aa "foo")
+ str = predicate[3]
+ else
+ -- (#eq? @aa @bb)
+ str = M.get_node_text(match[predicate[3]], source)
+ end
+
+ if node_text ~= str or str == nil then
+ return false
+ end
+
+ return true
+ end,
+
+ ["lua-match?"] = function(match, _, source, predicate)
+ local node = match[predicate[2]]
+ local regex = predicate[3]
+ local start_row, _, end_row, _ = node:range()
+ if start_row ~= end_row then
+ return false
+ end
+
+ return string.find(M.get_node_text(node, source), regex)
+ end,
+
+ ["match?"] = (function()
+ local magic_prefixes = {['\\v']=true, ['\\m']=true, ['\\M']=true, ['\\V']=true}
+ local function check_magic(str)
+ if string.len(str) < 2 or magic_prefixes[string.sub(str,1,2)] then
+ return str
+ end
+ return '\\v'..str
+ end
+
+ local compiled_vim_regexes = setmetatable({}, {
+ __index = function(t, pattern)
+ local res = vim.regex(check_magic(vim.fn.escape(pattern, '\\')))
+ rawset(t, pattern, res)
+ return res
+ end
+ })
+
+ return function(match, _, source, pred)
+ local node = match[pred[2]]
+ local start_row, start_col, end_row, end_col = node:range()
+ if start_row ~= end_row then
+ return false
+ end
+
+ local regex = compiled_vim_regexes[pred[3]]
+ return regex:match_line(source, start_row, start_col, end_col)
+ end
+ end)(),
+
+ ["contains?"] = function(match, _, source, predicate)
+ local node = match[predicate[2]]
+ local node_text = M.get_node_text(node, source)
+
+ for i=3,#predicate do
+ if string.find(node_text, predicate[i], 1, true) then
+ return true
+ end
+ end
+
+ return false
+ end
+}
+
+-- As we provide lua-match? also expose vim-match?
+predicate_handlers["vim-match?"] = predicate_handlers["match?"]
+
+--- Adds a new predicates to be used in queries
+--
+-- @param name the name of the predicate, without leading #
+-- @param handler the handler function to be used
+-- signature will be (match, pattern, bufnr, predicate)
+function M.add_predicate(name, handler, force)
+ if predicate_handlers[name] and not force then
+ a.nvim_err_writeln(string.format("Overriding %s", name))
+ end
+
+ predicate_handlers[name] = handler
+end
+
+--- Returns the list of currently supported predicates
+function M.list_predicates()
+ return vim.tbl_keys(predicate_handlers)
+end
+
+local function xor(x, y)
+ return (x or y) and not (x and y)
+end
+
+function Query:match_preds(match, pattern, source)
+ local preds = self.info.patterns[pattern]
+
+ for _, pred in pairs(preds or {}) do
+ -- Here we only want to return if a predicate DOES NOT match, and
+ -- continue on the other case. This way unknown predicates will not be considered,
+ -- which allows some testing and easier user extensibility (#12173).
+ -- Also, tree-sitter strips the leading # from predicates for us.
+ local pred_name
+ local is_not
+ if string.sub(pred[1], 1, 4) == "not-" then
+ pred_name = string.sub(pred[1], 5)
+ is_not = true
+ else
+ pred_name = pred[1]
+ is_not = false
+ end
+
+ local handler = predicate_handlers[pred_name]
+
+ if not handler then
+ a.nvim_err_writeln(string.format("No handler for %s", pred[1]))
+ return false
+ end
+
+ local pred_matches = handler(match, pattern, source, pred)
+
+ if not xor(is_not, pred_matches) then
+ return false
+ end
+ end
+ return true
+end
+
+--- Iterates of the captures of self on a given range.
+--
+-- @param node The node under witch the search will occur
+-- @param buffer The source buffer to search
+-- @param start The starting line of the search
+-- @param stop The stoping line of the search (end-exclusive)
+--
+-- @returns The matching capture id
+-- @returns The captured node
+function Query:iter_captures(node, source, start, stop)
+ if type(source) == "number" and source == 0 then
+ source = vim.api.nvim_get_current_buf()
+ end
+ local raw_iter = node:_rawquery(self.query, true, start, stop)
+ local function iter()
+ local capture, captured_node, match = raw_iter()
+ if match ~= nil then
+ local active = self:match_preds(match, match.pattern, source)
+ match.active = active
+ if not active then
+ return iter() -- tail call: try next match
+ end
+ end
+ return capture, captured_node
+ end
+ return iter
+end
+
+--- Iterates of the matches of self on a given range.
+--
+-- @param node The node under witch the search will occur
+-- @param buffer The source buffer to search
+-- @param start The starting line of the search
+-- @param stop The stoping line of the search (end-exclusive)
+--
+-- @returns The matching pattern id
+-- @returns The matching match
+function Query:iter_matches(node, source, start, stop)
+ if type(source) == "number" and source == 0 then
+ source = vim.api.nvim_get_current_buf()
+ end
+ local raw_iter = node:_rawquery(self.query, false, start, stop)
+ local function iter()
+ local pattern, match = raw_iter()
+ if match ~= nil then
+ local active = self:match_preds(match, pattern, source)
+ if not active then
+ return iter() -- tail call: try next match
+ end
+ end
+ return pattern, match
+ end
+ return iter
+end
+
+return M
diff --git a/runtime/lua/vim/tshighlighter.lua b/runtime/lua/vim/tshighlighter.lua
deleted file mode 100644
index 6465751ae8..0000000000
--- a/runtime/lua/vim/tshighlighter.lua
+++ /dev/null
@@ -1,116 +0,0 @@
-local a = vim.api
-
--- support reload for quick experimentation
-local TSHighlighter = rawget(vim.treesitter, 'TSHighlighter') or {}
-TSHighlighter.__index = TSHighlighter
-local ts_hs_ns = a.nvim_create_namespace("treesitter_hl")
-
--- These are conventions defined by tree-sitter, though it
--- needs to be user extensible also.
--- TODO(bfredl): this is very much incomplete, we will need to
--- go through a few tree-sitter provided queries and decide
--- on translations that makes the most sense.
-TSHighlighter.hl_map = {
- keyword="Keyword",
- string="String",
- type="Type",
- comment="Comment",
- constant="Constant",
- operator="Operator",
- number="Number",
- label="Label",
- ["function"]="Function",
- ["function.special"]="Function",
-}
-
-function TSHighlighter.new(query, bufnr, ft)
- local self = setmetatable({}, TSHighlighter)
- self.parser = vim.treesitter.get_parser(
- bufnr,
- ft,
- {
- on_changedtree = function(...) self:on_changedtree(...) end,
- on_lines = function() self.root = self.parser:parse():root() end
- }
- )
-
- self.buf = self.parser.bufnr
-
- local tree = self.parser:parse()
- self.root = tree:root()
- self:set_query(query)
- self.edit_count = 0
- self.redraw_count = 0
- self.line_count = {}
- a.nvim_buf_set_option(self.buf, "syntax", "")
-
- -- Tricky: if syntax hasn't been enabled, we need to reload color scheme
- -- but use synload.vim rather than syntax.vim to not enable
- -- syntax FileType autocmds. Later on we should integrate with the
- -- `:syntax` and `set syntax=...` machinery properly.
- if vim.g.syntax_on ~= 1 then
- vim.api.nvim_command("runtime! syntax/synload.vim")
- end
- return self
-end
-
-local function is_highlight_name(capture_name)
- local firstc = string.sub(capture_name, 1, 1)
- return firstc ~= string.lower(firstc)
-end
-
-function TSHighlighter:get_hl_from_capture(capture)
-
- local name = self.query.captures[capture]
-
- if is_highlight_name(name) then
- -- From "Normal.left" only keep "Normal"
- return vim.split(name, '.', true)[1]
- else
- -- Default to false to avoid recomputing
- return TSHighlighter.hl_map[name]
- end
-end
-
-function TSHighlighter:set_query(query)
- if type(query) == "string" then
- query = vim.treesitter.parse_query(self.parser.lang, query)
- end
- self.query = query
-
- self.hl_cache = setmetatable({}, {
- __index = function(table, capture)
- local hl = self:get_hl_from_capture(capture)
- rawset(table, capture, hl)
-
- return hl
- end
- })
-
- self:on_changedtree({{self.root:range()}})
-end
-
-function TSHighlighter:on_changedtree(changes)
- -- Get a fresh root
- self.root = self.parser.tree:root()
-
- for _, ch in ipairs(changes or {}) do
- -- Try to be as exact as possible
- local changed_node = self.root:descendant_for_range(ch[1], ch[2], ch[3], ch[4])
-
- a.nvim_buf_clear_namespace(self.buf, ts_hs_ns, ch[1], ch[3])
-
- for capture, node in self.query:iter_captures(changed_node, self.buf, ch[1], ch[3] + 1) do
- local start_row, start_col, end_row, end_col = node:range()
- local hl = self.hl_cache[capture]
- if hl then
- a.nvim__buf_add_decoration(self.buf, ts_hs_ns, hl,
- start_row, start_col,
- end_row, end_col,
- {})
- end
- end
- end
-end
-
-return TSHighlighter
diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua
index 9c3535c676..f1a12c72ec 100644
--- a/runtime/lua/vim/uri.lua
+++ b/runtime/lua/vim/uri.lua
@@ -7,6 +7,9 @@
local uri_decode
do
local schar = string.char
+
+ --- Convert hex to char
+ --@private
local function hex_to_char(hex)
return schar(tonumber(hex, 16))
end
@@ -34,6 +37,8 @@ do
else
tohex = function(b) return string.format("%02x", b) end
end
+
+ --@private
local function percent_encode_char(char)
return "%"..tohex(sbyte(char), 2)
end
@@ -45,10 +50,14 @@ do
end
+--@private
local function is_windows_file_uri(uri)
return uri:match('^file:///[a-zA-Z]:') ~= nil
end
+--- Get a URI from a file path.
+--@param path (string): Path to file
+--@return URI
local function uri_from_fname(path)
local volume_path, fname = path:match("^([a-zA-Z]:)(.*)")
local is_windows = volume_path ~= nil
@@ -67,6 +76,9 @@ end
local URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9+-.]*)://.*'
+--- Get a URI from a bufnr
+--@param bufnr (number): Buffer number
+--@return URI
local function uri_from_bufnr(bufnr)
local fname = vim.api.nvim_buf_get_name(bufnr)
local scheme = fname:match(URI_SCHEME_PATTERN)
@@ -77,6 +89,9 @@ local function uri_from_bufnr(bufnr)
end
end
+--- Get a filename from a URI
+--@param uri (string): The URI
+--@return Filename
local function uri_to_fname(uri)
local scheme = assert(uri:match(URI_SCHEME_PATTERN), 'URI must contain a scheme: ' .. uri)
if scheme ~= 'file' then
@@ -93,7 +108,10 @@ local function uri_to_fname(uri)
return uri
end
--- Return or create a buffer for a uri.
+--- Return or create a buffer for a uri.
+--@param uri (string): The URI
+--@return bufnr.
+--@note Creates buffer but does not load it
local function uri_to_bufnr(uri)
local scheme = assert(uri:match(URI_SCHEME_PATTERN), 'URI must contain a scheme: ' .. uri)
if scheme == 'file' then
diff --git a/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim b/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim
index 7a6464fc98..fe4455fe2e 100644
--- a/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim
+++ b/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim
@@ -1,15 +1,17 @@
" cfilter.vim: Plugin to filter entries from a quickfix/location list
-" Last Change: May 12, 2018
-" Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
-" Version: 1.0
+" Last Change: Aug 23, 2018
+" Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
+" Version: 1.1
"
" Commands to filter the quickfix list:
-" :Cfilter[!] {pat}
+" :Cfilter[!] /{pat}/
" Create a new quickfix list from entries matching {pat} in the current
" quickfix list. Both the file name and the text of the entries are
" matched against {pat}. If ! is supplied, then entries not matching
-" {pat} are used.
-" :Lfilter[!] {pat}
+" {pat} are used. The pattern can be optionally enclosed using one of
+" the following characters: ', ", /. If the pattern is empty, then the
+" last used search pattern is used.
+" :Lfilter[!] /{pat}/
" Same as :Cfilter but operates on the current location list.
"
if exists("loaded_cfilter")
@@ -17,7 +19,7 @@ if exists("loaded_cfilter")
endif
let loaded_cfilter = 1
-func s:Qf_filter(qf, pat, bang)
+func s:Qf_filter(qf, searchpat, bang)
if a:qf
let Xgetlist = function('getqflist')
let Xsetlist = function('setqflist')
@@ -28,14 +30,31 @@ func s:Qf_filter(qf, pat, bang)
let cmd = ':Lfilter' . a:bang
endif
+ let firstchar = a:searchpat[0]
+ let lastchar = a:searchpat[-1:]
+ if firstchar == lastchar &&
+ \ (firstchar == '/' || firstchar == '"' || firstchar == "'")
+ let pat = a:searchpat[1:-2]
+ if pat == ''
+ " Use the last search pattern
+ let pat = @/
+ endif
+ else
+ let pat = a:searchpat
+ endif
+
+ if pat == ''
+ return
+ endif
+
if a:bang == '!'
- let cond = 'v:val.text !~# a:pat && bufname(v:val.bufnr) !~# a:pat'
+ let cond = 'v:val.text !~# pat && bufname(v:val.bufnr) !~# pat'
else
- let cond = 'v:val.text =~# a:pat || bufname(v:val.bufnr) =~# a:pat'
+ let cond = 'v:val.text =~# pat || bufname(v:val.bufnr) =~# pat'
endif
let items = filter(Xgetlist(), cond)
- let title = cmd . ' ' . a:pat
+ let title = cmd . ' /' . pat . '/'
call Xsetlist([], ' ', {'title' : title, 'items' : items})
endfunc
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
new file mode 100644
index 0000000000..96b43cf0d0
--- /dev/null
+++ b/runtime/queries/c/highlights.scm
@@ -0,0 +1,151 @@
+(identifier) @variable
+
+[
+ "const"
+ "default"
+ "enum"
+ "extern"
+ "inline"
+ "return"
+ "sizeof"
+ "static"
+ "struct"
+ "typedef"
+ "union"
+ "volatile"
+ "goto"
+] @keyword
+
+[
+ "while"
+ "for"
+ "do"
+ "continue"
+ "break"
+] @repeat
+
+[
+ "if"
+ "else"
+ "case"
+ "switch"
+] @conditional
+
+"#define" @constant.macro
+[
+ "#if"
+ "#ifdef"
+ "#ifndef"
+ "#else"
+ "#elif"
+ "#endif"
+ (preproc_directive)
+] @keyword
+
+"#include" @include
+
+[
+ "="
+
+ "-"
+ "*"
+ "/"
+ "+"
+ "%"
+
+ "~"
+ "|"
+ "&"
+ "^"
+ "<<"
+ ">>"
+
+ "->"
+
+ "<"
+ "<="
+ ">="
+ ">"
+ "=="
+ "!="
+
+ "!"
+ "&&"
+ "||"
+
+ "-="
+ "+="
+ "*="
+ "/="
+ "%="
+ "|="
+ "&="
+ "^="
+ "--"
+ "++"
+] @operator
+
+[
+ (true)
+ (false)
+] @boolean
+
+[ "." ";" ":" "," ] @punctuation.delimiter
+
+(conditional_expression [ "?" ":" ] @conditional)
+
+
+[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
+
+(string_literal) @string
+(system_lib_string) @string
+
+(null) @constant.builtin
+(number_literal) @number
+(char_literal) @number
+
+(call_expression
+ function: (identifier) @function)
+(call_expression
+ function: (field_expression
+ field: (field_identifier) @function))
+(function_declarator
+ declarator: (identifier) @function)
+(preproc_function_def
+ name: (identifier) @function.macro)
+[
+ (preproc_arg)
+ (preproc_defined)
+] @function.macro
+; TODO (preproc_arg) @embedded
+
+(field_identifier) @property
+(statement_identifier) @label
+
+[
+(type_identifier)
+(primitive_type)
+(sized_type_specifier)
+(type_descriptor)
+ ] @type
+
+(declaration type: [(identifier) (type_identifier)] @type)
+(cast_expression type: [(identifier) (type_identifier)] @type)
+(sizeof_expression value: (parenthesized_expression (identifier) @type))
+
+((identifier) @constant
+ (#match? @constant "^[A-Z][A-Z0-9_]+$"))
+
+(comment) @comment
+
+;; Parameters
+(parameter_declaration
+ declarator: (identifier) @parameter)
+
+(parameter_declaration
+ declarator: (pointer_declarator) @parameter)
+
+(preproc_params
+ (identifier)) @parameter
+
+(ERROR) @error
diff --git a/runtime/syntax/markdown.vim b/runtime/syntax/markdown.vim
index 1955a7443e..17b61c2fa4 100644
--- a/runtime/syntax/markdown.vim
+++ b/runtime/syntax/markdown.vim
@@ -2,7 +2,7 @@
" Language: Markdown
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.markdown
-" Last Change: 2016 Aug 29
+" Last Change: 2020 Jan 14
if exists("b:current_syntax")
finish
@@ -18,37 +18,46 @@ unlet! b:current_syntax
if !exists('g:markdown_fenced_languages')
let g:markdown_fenced_languages = []
endif
+let s:done_include = {}
for s:type in map(copy(g:markdown_fenced_languages),'matchstr(v:val,"[^=]*$")')
+ if has_key(s:done_include, matchstr(s:type,'[^.]*'))
+ continue
+ endif
if s:type =~ '\.'
let b:{matchstr(s:type,'[^.]*')}_subtype = matchstr(s:type,'\.\zs.*')
endif
exe 'syn include @markdownHighlight'.substitute(s:type,'\.','','g').' syntax/'.matchstr(s:type,'[^.]*').'.vim'
unlet! b:current_syntax
+ let s:done_include[matchstr(s:type,'[^.]*')] = 1
endfor
unlet! s:type
+unlet! s:done_include
-syn sync minlines=10
+if !exists('g:markdown_minlines')
+ let g:markdown_minlines = 50
+endif
+execute 'syn sync minlines=' . g:markdown_minlines
syn case ignore
-syn match markdownValid '[<>]\c[a-z/$!]\@!'
-syn match markdownValid '&\%(#\=\w*;\)\@!'
+syn match markdownValid '[<>]\c[a-z/$!]\@!' transparent contains=NONE
+syn match markdownValid '&\%(#\=\w*;\)\@!' transparent contains=NONE
syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock,htmlSpecialChar
syn cluster markdownBlock contains=markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6,markdownBlockquote,markdownListMarker,markdownOrderedListMarker,markdownCodeBlock,markdownRule
-syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop,markdownError
+syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop,markdownError,markdownValid
syn match markdownH1 "^.\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink
syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink
syn match markdownHeadingRule "^[=-]\+$" contained
-syn region markdownH1 matchgroup=markdownHeadingDelimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH1 matchgroup=markdownH1Delimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH2 matchgroup=markdownH2Delimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH3 matchgroup=markdownH3Delimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH4 matchgroup=markdownH4Delimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH5 matchgroup=markdownH5Delimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH6 matchgroup=markdownH6Delimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock
@@ -70,31 +79,40 @@ syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained
-syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
+syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\%(\_[^][]\|\[\_[^][]*\]\)*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
-let s:concealends = has('conceal') ? ' concealends' : ''
-exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends
-exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends
-exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
-exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
-exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart' . s:concealends
-exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart' . s:concealends
+let s:concealends = ''
+if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
+ let s:concealends = ' concealends'
+endif
+exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends
+exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\w\@<!_\S\@=" end="\S\@<=_\w\@!" skip="\\_" contains=markdownLineStart,@Spell' . s:concealends
+exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" skip="\\\*" contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
+exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\w\@<!__\S\@=" end="\S\@<=__\w\@!" skip="\\_" contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
+exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends
+exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\w\@<!___\S\@=" end="\S\@<=___\w\@!" skip="\\_" contains=markdownLineStart,@Spell' . s:concealends
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
-syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend
+syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend
syn match markdownFootnote "\[^[^\]]\+\]"
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
if main_syntax ==# 'markdown'
+ let s:done_include = {}
for s:type in g:markdown_fenced_languages
- exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
+ if has_key(s:done_include, matchstr(s:type,'[^.]*'))
+ continue
+ endif
+ exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*````*\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*````*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') . s:concealends
+ let s:done_include[matchstr(s:type,'[^.]*')] = 1
endfor
unlet! s:type
+ unlet! s:done_include
endif
syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]"
@@ -107,6 +125,12 @@ hi def link markdownH4 htmlH4
hi def link markdownH5 htmlH5
hi def link markdownH6 htmlH6
hi def link markdownHeadingRule markdownRule
+hi def link markdownH1Delimiter markdownHeadingDelimiter
+hi def link markdownH2Delimiter markdownHeadingDelimiter
+hi def link markdownH3Delimiter markdownHeadingDelimiter
+hi def link markdownH4Delimiter markdownHeadingDelimiter
+hi def link markdownH5Delimiter markdownHeadingDelimiter
+hi def link markdownH6Delimiter markdownHeadingDelimiter
hi def link markdownHeadingDelimiter Delimiter
hi def link markdownOrderedListMarker markdownListMarker
hi def link markdownListMarker htmlTagName
diff --git a/runtime/syntax/resolv.vim b/runtime/syntax/resolv.vim
index a879116a5f..9a2dec51ce 100644
--- a/runtime/syntax/resolv.vim
+++ b/runtime/syntax/resolv.vim
@@ -2,12 +2,19 @@
" Language: resolver configuration file
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
" URL: https://raw.github.com/rid9/vim-resolv/master/resolv.vim
-" Last Change: 2013 May 21
-" Version: 1.0
+" Last Change: 2020 Mar 10
+" Version: 1.4
"
" Credits:
" David Necas (Yeti) <yeti@physics.muni.cz>
" Stefano Zacchiroli <zack@debian.org>
+" DJ Lucas <dj@linuxfromscratch.org>
+"
+" Changelog:
+" - 1.4: Added IPv6 support for sortlist.
+" - 1.3: Added IPv6 support for IPv4 dot-decimal notation.
+" - 1.2: Added new options.
+" - 1.1: Added IPv6 support.
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -29,11 +36,47 @@ syn match resolvIP contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}/ contains=@resolvIPClu
syn match resolvIPNetmask contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?/ contains=resolvOperator,@resolvIPCluster
syn match resolvHostname contained /\w\{-}\.[-0-9A-Za-z_\.]*/
-" Particular
+" Nameserver IPv4
syn match resolvIPNameserver contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\s\|$\)\)\+/ contains=@resolvIPCluster
+
+" Nameserver IPv6
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{6}\%(\x\{1,4}:\x\{1,4}\)\>/
+syn match resolvIPNameserver contained /\s\@<=::\%(\x\{1,4}:\)\{,6}\x\{1,4}\>/
+syn match resolvIPNameserver contained /\s\@<=::\%(\x\{1,4}:\)\{,5}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,5}\x\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,4}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,4}\x\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,3}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,3}\x\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,2}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,2}\x\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,1}\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{5}:\%(\d\{1,4}\.\)\{3}\d\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{6}:\x\{1,4}\>/
+syn match resolvIPNameserver contained /\<\%(\x\{1,4}:\)\{1,7}:\%(\s\|;\|$\)\@=/
+
+" Search hostname
syn match resolvHostnameSearch contained /\%(\%([-0-9A-Za-z_]\+\.\)*[-0-9A-Za-z_]\+\.\?\%(\s\|$\)\)\+/
+
+" Sortlist IPv4
syn match resolvIPNetmaskSortList contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?\%(\s\|$\)\)\+/ contains=resolvOperator,@resolvIPCluster
+" Sortlist IPv6
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{6}\%(\x\{1,4}:\x\{1,4}\)\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\s\@<=::\%(\x\{1,4}:\)\{,6}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\s\@<=::\%(\x\{1,4}:\)\{,5}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,5}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1}:\%(\x\{1,4}:\)\{,4}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,4}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{2}:\%(\x\{1,4}:\)\{,3}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,3}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{3}:\%(\x\{1,4}:\)\{,2}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,2}\x\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{4}:\%(\x\{1,4}:\)\{,1}\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{5}:\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{6}:\x\{1,4}\%(\/\d\{1,3}\)\?\>/
+syn match resolvIPNetmaskSortList contained /\<\%(\x\{1,4}:\)\{1,7}:\%(\s\|;\|$\)\@=\%(\/\d\{1,3}\)\?/
+
" Identifiers
syn match resolvNameserver /^\s*nameserver\>/ nextgroup=resolvIPNameserver skipwhite
syn match resolvLwserver /^\s*lwserver\>/ nextgroup=resolvIPNameserver skipwhite
@@ -43,13 +86,12 @@ syn match resolvSortList /^\s*sortlist\>/ nextgroup=resolvIPNetmaskSortList skip
syn match resolvOptions /^\s*options\>/ nextgroup=resolvOption skipwhite
" Options
-syn match resolvOption /\<\%(debug\|no_tld_query\|rotate\|no-check-names\|inet6\)\>/ contained nextgroup=resolvOption skipwhite
+syn match resolvOption /\<\%(debug\|no_tld_query\|no-tld-query\|rotate\|no-check-names\|inet6\|ip6-bytestring\|\%(no-\)\?ip6-dotint\|edns0\|single-request\%(-reopen\)\?\|use-vc\)\>/ contained nextgroup=resolvOption skipwhite
syn match resolvOption /\<\%(ndots\|timeout\|attempts\):\d\+\>/ contained contains=resolvOperator nextgroup=resolvOption skipwhite
" Additional errors
syn match resolvError /^search .\{257,}/
-
hi def link resolvIP Number
hi def link resolvIPNetmask Number
hi def link resolvHostname String
@@ -72,7 +114,6 @@ hi def link resolvError Error
hi def link resolvIPError Error
hi def link resolvIPSpecial Special
-
let b:current_syntax = "resolv"
" vim: ts=8 ft=vim
diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim
index b3a8f96b6b..ec0f7b99bd 100644
--- a/runtime/syntax/tex.vim
+++ b/runtime/syntax/tex.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: TeX
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
-" Last Change: Jun 07, 2020
-" Version: 118
+" Last Change: Jun 29, 2020
+" Version: 119
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
" Notes: {{{1
@@ -147,6 +147,11 @@ if exists("g:tex_nospell") && g:tex_nospell
else
let s:tex_nospell = 0
endif
+if exists("g:tex_matchcheck")
+ let s:tex_matchcheck= g:tex_matchcheck
+else
+ let s:tex_matchcheck= '[({[]'
+endif
if exists("g:tex_excludematcher")
let s:tex_excludematcher= g:tex_excludematcher
else
@@ -205,27 +210,41 @@ if !exists("g:tex_no_math")
endif
endif
-" Try to flag {} and () mismatches: {{{1
+" Try to flag {}, [], and () mismatches: {{{1
if s:tex_fast =~# 'm'
if !s:tex_no_error
- syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError
- syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell
- syn region texMatcherNM matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup,texError
- syn region texMatcherNM matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchNMGroup,texError,@NoSpell
+ if s:tex_matchcheck =~ '{'
+ syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError
+ syn region texMatcherNM matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup,texError
+ endif
+ if s:tex_matchcheck =~ '\['
+ syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell
+ syn region texMatcherNM matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchNMGroup,texError,@NoSpell
+ endif
else
- syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup
- syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup
- syn region texMatcherNM matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup
- syn region texMatcherNM matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchNMGroup
+ if s:tex_matchcheck =~ '{'
+ syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup
+ syn region texMatcherNM matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchNMGroup
+ endif
+ if s:tex_matchcheck =~ '\['
+ syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup
+ syn region texMatcherNM matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchNMGroup
+ endif
endif
- if !s:tex_nospell
- syn region texParen start="(" end=")" transparent contains=@texMatchGroup,@Spell
- else
- syn region texParen start="(" end=")" transparent contains=@texMatchGroup
+ if s:tex_matchcheck =~ '('
+ if !s:tex_nospell
+ syn region texParen start="(" end=")" transparent contains=@texMatchGroup,@Spell
+ else
+ syn region texParen start="(" end=")" transparent contains=@texMatchGroup
+ endif
endif
endif
if !s:tex_no_error
- syn match texError "[}\])]"
+ if s:tex_matchcheck =~ '('
+ syn match texError "[}\]]"
+ else
+ syn match texError "[}\])]"
+ endif
endif
if s:tex_fast =~# 'M'
if !exists("g:tex_no_math")
@@ -756,7 +775,7 @@ if has("conceal") && &enc == 'utf-8'
\ ['ldots' , '…'],
\ ['le' , '≤'],
\ ['left|' , '|'],
- \ ['left\|' , '‖'],
+ \ ['left\\|' , '‖'],
\ ['left(' , '('],
\ ['left\[' , '['],
\ ['left\\{' , '{'],
diff --git a/runtime/syntax/typescript.vim b/runtime/syntax/typescript.vim
index bc382610a9..767ba56d42 100644
--- a/runtime/syntax/typescript.vim
+++ b/runtime/syntax/typescript.vim
@@ -1,10 +1,13 @@
" Vim syntax file
" Language: TypeScript
-" Maintainer: Bram Moolenaar
-" Last Change: 2019 Jun 07
+" Maintainer: Bram Moolenaar, Herrington Darkholme
+" Last Change: 2019 Nov 30
" Based On: Herrington Darkholme's yats.vim
-" Changes: See https:github.com/HerringtonDarkholme/yats.vim
-" Credits: See yats.vim
+" 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)
" This is the same syntax that is in yats.vim, but:
" - flattened into one file
@@ -21,6 +24,7 @@ endif
let s:cpo_save = &cpo
set cpo&vim
+" this region is NOT used in TypeScriptReact
" nextgroup doesn't contain objectLiteral, let outer region contains it
syntax region typescriptTypeCast matchgroup=typescriptTypeBrackets
\ start=/< \@!/ end=/>/
@@ -28,2045 +32,11 @@ syntax region typescriptTypeCast matchgroup=typescriptTypeBrackets
\ nextgroup=@typescriptExpression
\ contained skipwhite oneline
-" runtime syntax/common.vim
-" NOTE: this results in accurate highlighting, but can be slow.
-syntax sync fromstart
+"""""""""""""""""""""""""""""""""""""""""""""""""""
+" Source the part common with typescriptreact.vim
+source <sfile>:h/typescriptcommon.vim
-"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
-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
-
-"runtime syntax/basic/literal.vim
-"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
-" <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48>
-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
-
-
-" runtime syntax/basic/object.vim
-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
-
-"runtime syntax/basic/symbols.vim
-" + - ^ ~
-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
-
-"" runtime syntax/basic/reserved.vim
-
-"runtime syntax/basic/keyword.vim
-"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
-
-"runtime syntax/basic/doc.vim
-"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*<reference\s\+.*\/>$+
- \ contains=typescriptString
-syntax match typescriptRef +///\s*<amd-dependency\s\+.*\/>$+
- \ contains=typescriptString
-syntax match typescriptRef +///\s*<amd-module\s\+.*\/>$+
- \ contains=typescriptString
-
-"JSDoc
-syntax case ignore
-
-syntax region typescriptDocComment matchgroup=typescriptComment
- \ start="/\*\*" end="\*/"
- \ contains=typescriptDocNotation,typescriptCommentTodo,@Spell
- \ fold keepend
-syntax match typescriptDocNotation contained /@/ nextgroup=typescriptDocTags
-
-syntax keyword typescriptDocTags contained constant constructor constructs function ignore inner private public readonly static
-syntax keyword typescriptDocTags contained const dict expose inheritDoc interface nosideeffects override protected struct internal
-syntax keyword typescriptDocTags contained example global
-
-" syntax keyword typescriptDocTags contained 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
-
-"runtime syntax/basic/type.vim
-" Types
-syntax match typescriptOptionalMark /?/ contained
-
-syntax region typescriptTypeParameters matchgroup=typescriptTypeBrackets
- \ start=/</ end=/>/
- \ 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<T> {} // ClassBlock
-" func<T>() // FuncCallArg
-syntax region typescriptTypeArguments matchgroup=typescriptTypeBrackets
- \ start=/\></ end=/>/
- \ 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=/</ end=/>/
- \ 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=/</ end=/>/
- \ 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
-
-" extension
-if get(g:, 'yats_host_keyword', 1)
- "runtime syntax/yats.vim
- "runtime syntax/yats/typescript.vim
- 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
- hi def link typescriptGlobal Structure
- 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
- hi def link typescriptGlobalMethod Structure
-
- "runtime syntax/yats/es6-number.vim
- 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
- hi def link typescriptNumberStaticProp Keyword
- syntax keyword typescriptNumberStaticMethod contained isFinite isInteger isNaN isSafeInteger nextgroup=typescriptFuncCallArg
- syntax keyword typescriptNumberStaticMethod contained parseFloat parseInt nextgroup=typescriptFuncCallArg
- hi def link typescriptNumberStaticMethod Keyword
- syntax keyword typescriptNumberMethod contained toExponential toFixed toLocaleString nextgroup=typescriptFuncCallArg
- syntax keyword typescriptNumberMethod contained toPrecision toSource toString valueOf nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptNumberMethod
- hi def link typescriptNumberMethod Keyword
-
- "runtime syntax/yats/es6-string.vim
- 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
- hi def link typescriptStringStaticMethod Keyword
- 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
- hi def link typescriptStringMethod Keyword
-
- "runtime syntax/yats/es6-array.vim
- 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
- hi def link typescriptArrayStaticMethod Keyword
- 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
- hi def link typescriptArrayMethod Keyword
-
- "runtime syntax/yats/es6-object.vim
- 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
- hi def link typescriptObjectStaticMethod Keyword
- 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
- hi def link typescriptObjectMethod Keyword
-
- "runtime syntax/yats/es6-symbol.vim
- 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
- hi def link typescriptSymbolStaticProp Keyword
- syntax keyword typescriptSymbolStaticMethod contained for keyFor nextgroup=typescriptFuncCallArg
- hi def link typescriptSymbolStaticMethod Keyword
-
- "runtime syntax/yats/es6-function.vim
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function
- syntax keyword typescriptFunctionMethod contained apply bind call nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptFunctionMethod
- hi def link typescriptFunctionMethod Keyword
-
- "runtime syntax/yats/es6-math.vim
- 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
- hi def link typescriptMathStaticProp Keyword
- 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
- hi def link typescriptMathStaticMethod Keyword
-
- "runtime syntax/yats/es6-date.vim
- 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
- hi def link typescriptDateStaticMethod Keyword
- 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
- hi def link typescriptDateMethod Keyword
-
- "runtime syntax/yats/es6-json.vim
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName JSON nextgroup=typescriptGlobalJSONDot,typescriptFuncCallArg
- syntax match typescriptGlobalJSONDot /\./ contained nextgroup=typescriptJSONStaticMethod,typescriptProp
- syntax keyword typescriptJSONStaticMethod contained parse stringify nextgroup=typescriptFuncCallArg
- hi def link typescriptJSONStaticMethod Keyword
-
- "runtime syntax/yats/es6-regexp.vim
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName RegExp nextgroup=typescriptGlobalRegExpDot,typescriptFuncCallArg
- syntax match typescriptGlobalRegExpDot /\./ contained nextgroup=typescriptRegExpStaticProp,typescriptProp
- syntax keyword typescriptRegExpStaticProp contained lastIndex
- hi def link typescriptRegExpStaticProp Keyword
- syntax keyword typescriptRegExpProp contained global ignoreCase multiline source sticky
- syntax cluster props add=typescriptRegExpProp
- hi def link typescriptRegExpProp Keyword
- syntax keyword typescriptRegExpMethod contained exec test nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptRegExpMethod
- hi def link typescriptRegExpMethod Keyword
-
- "runtime syntax/yats/es6-map.vim
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Map WeakMap
- syntax keyword typescriptES6MapProp contained size
- syntax cluster props add=typescriptES6MapProp
- hi def link typescriptES6MapProp Keyword
- 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
- hi def link typescriptES6MapMethod Keyword
-
- "runtime syntax/yats/es6-set.vim
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Set WeakSet
- syntax keyword typescriptES6SetProp contained size
- syntax cluster props add=typescriptES6SetProp
- hi def link typescriptES6SetProp Keyword
- syntax keyword typescriptES6SetMethod contained add clear delete entries forEach has nextgroup=typescriptFuncCallArg
- syntax keyword typescriptES6SetMethod contained values nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptES6SetMethod
- hi def link typescriptES6SetMethod Keyword
-
- "runtime syntax/yats/es6-proxy.vim
- 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
- hi def link typescriptProxyAPI Keyword
-
- "runtime syntax/yats/es6-promise.vim
- 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
- hi def link typescriptPromiseStaticMethod Keyword
- syntax keyword typescriptPromiseMethod contained then catch finally nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptPromiseMethod
- hi def link typescriptPromiseMethod Keyword
-
- "runtime syntax/yats/es6-reflect.vim
- 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
- hi def link typescriptReflectMethod Keyword
-
- "runtime syntax/yats/ecma-402.vim
- 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
- hi def link typescriptIntlMethod Keyword
-
- "runtime syntax/yats/node.vim
- 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
- hi def link typescriptNodeGlobal Structure
-
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName describe it test
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName before after
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName beforeEach afterEach
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName beforeAll afterAll
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName expect assert
-
- "runtime syntax/yats/web.vim
- 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
- hi def link typescriptBOM Structure
-
- "runtime syntax/yats/web-window.vim
- 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
- hi def link typescriptBOMWindowProp Structure
- 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
- hi def link typescriptBOMWindowMethod Structure
- 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
- hi def link typescriptBOMWindowEvent Keyword
- syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName DOMParser
- syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName QueryInterface
- syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName XMLSerializer
- hi def link typescriptBOMWindowCons Structure
-
- "runtime syntax/yats/web-navigator.vim
- 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
- hi def link typescriptBOMNavigatorProp Keyword
- 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
- hi def link typescriptBOMNavigatorMethod Keyword
- syntax keyword typescriptServiceWorkerMethod contained register nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptServiceWorkerMethod
- hi def link typescriptServiceWorkerMethod Keyword
-
- "runtime syntax/yats/web-location.vim
- 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
- hi def link typescriptBOMLocationProp Keyword
- syntax keyword typescriptBOMLocationMethod contained assign reload replace toString nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptBOMLocationMethod
- hi def link typescriptBOMLocationMethod Keyword
-
- "runtime syntax/yats/web-history.vim
- syntax keyword typescriptBOMHistoryProp contained length current next previous state
- syntax keyword typescriptBOMHistoryProp contained scrollRestoration
- syntax cluster props add=typescriptBOMHistoryProp
- hi def link typescriptBOMHistoryProp Keyword
- syntax keyword typescriptBOMHistoryMethod contained back forward go pushState replaceState nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptBOMHistoryMethod
- hi def link typescriptBOMHistoryMethod Keyword
-
- "runtime syntax/yats/web-console.vim
- 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
- hi def link typescriptConsoleMethod Keyword
-
- "runtime syntax/yats/web-xhr.vim
- syntax keyword typescriptXHRGlobal containedin=typescriptIdentifierName XMLHttpRequest
- hi def link typescriptXHRGlobal Structure
- 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
- hi def link typescriptXHRProp Keyword
- syntax keyword typescriptXHRMethod contained abort getAllResponseHeaders getResponseHeader nextgroup=typescriptFuncCallArg
- syntax keyword typescriptXHRMethod contained open overrideMimeType send setRequestHeader nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptXHRMethod
- hi def link typescriptXHRMethod Keyword
-
- "runtime syntax/yats/web-blob.vim
- 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
- hi def link typescriptFileMethod Keyword
- syntax keyword typescriptFileReaderProp contained error readyState result
- syntax cluster props add=typescriptFileReaderProp
- hi def link typescriptFileReaderProp Keyword
- syntax keyword typescriptFileReaderMethod contained abort readAsArrayBuffer readAsBinaryString nextgroup=typescriptFuncCallArg
- syntax keyword typescriptFileReaderMethod contained readAsDataURL readAsText nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptFileReaderMethod
- hi def link typescriptFileReaderMethod Keyword
- syntax keyword typescriptFileListMethod contained item nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptFileListMethod
- hi def link typescriptFileListMethod Keyword
- syntax keyword typescriptBlobMethod contained append getBlob getFile nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptBlobMethod
- hi def link typescriptBlobMethod Keyword
- 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
- hi def link typescriptURLUtilsProp Keyword
- syntax keyword typescriptURLStaticMethod contained createObjectURL revokeObjectURL nextgroup=typescriptFuncCallArg
- hi def link typescriptURLStaticMethod Keyword
-
- "runtime syntax/yats/web-crypto.vim
- syntax keyword typescriptCryptoGlobal containedin=typescriptIdentifierName crypto
- hi def link typescriptCryptoGlobal Structure
- syntax keyword typescriptSubtleCryptoMethod contained encrypt decrypt sign verify nextgroup=typescriptFuncCallArg
- syntax keyword typescriptSubtleCryptoMethod contained digest nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptSubtleCryptoMethod
- hi def link typescriptSubtleCryptoMethod Keyword
- syntax keyword typescriptCryptoProp contained subtle
- syntax cluster props add=typescriptCryptoProp
- hi def link typescriptCryptoProp Keyword
- syntax keyword typescriptCryptoMethod contained getRandomValues nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptCryptoMethod
- hi def link typescriptCryptoMethod Keyword
-
- "runtime syntax/yats/web-fetch.vim
- 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
- hi def link typescriptGlobalMethod Structure
- syntax keyword typescriptHeadersMethod contained append delete get getAll has set nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptHeadersMethod
- hi def link typescriptHeadersMethod Keyword
- syntax keyword typescriptRequestProp contained method url headers context referrer
- syntax keyword typescriptRequestProp contained mode credentials cache
- syntax cluster props add=typescriptRequestProp
- hi def link typescriptRequestProp Keyword
- syntax keyword typescriptRequestMethod contained clone nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptRequestMethod
- hi def link typescriptRequestMethod Keyword
- syntax keyword typescriptResponseProp contained type url status statusText headers
- syntax keyword typescriptResponseProp contained redirected
- syntax cluster props add=typescriptResponseProp
- hi def link typescriptResponseProp Keyword
- syntax keyword typescriptResponseMethod contained clone nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptResponseMethod
- hi def link typescriptResponseMethod Keyword
-
- "runtime syntax/yats/web-service-worker.vim
- syntax keyword typescriptServiceWorkerProp contained controller ready
- syntax cluster props add=typescriptServiceWorkerProp
- hi def link typescriptServiceWorkerProp Keyword
- syntax keyword typescriptServiceWorkerMethod contained register getRegistration nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptServiceWorkerMethod
- hi def link typescriptServiceWorkerMethod Keyword
- 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
- hi def link typescriptCacheMethod Keyword
-
- "runtime syntax/yats/web-encoding.vim
- syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextEncoder
- syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextDecoder
- hi def link typescriptEncodingGlobal Structure
- syntax keyword typescriptEncodingProp contained encoding fatal ignoreBOM
- syntax cluster props add=typescriptEncodingProp
- hi def link typescriptEncodingProp Keyword
- syntax keyword typescriptEncodingMethod contained encode decode nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptEncodingMethod
- hi def link typescriptEncodingMethod Keyword
-
- "runtime syntax/yats/web-geo.vim
- 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
- hi def link typescriptGeolocationMethod Keyword
-
- "runtime syntax/yats/web-network.vim
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName NetworkInformation
- syntax keyword typescriptBOMNetworkProp contained downlink downlinkMax effectiveType
- syntax keyword typescriptBOMNetworkProp contained rtt type
- syntax cluster props add=typescriptBOMNetworkProp
- hi def link typescriptBOMNetworkProp Keyword
-
- "runtime syntax/yats/web-payment.vim
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName PaymentRequest
- syntax keyword typescriptPaymentMethod contained show abort canMakePayment nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptPaymentMethod
- hi def link typescriptPaymentMethod Keyword
- syntax keyword typescriptPaymentProp contained shippingAddress shippingOption result
- syntax cluster props add=typescriptPaymentProp
- hi def link typescriptPaymentProp Keyword
- syntax keyword typescriptPaymentEvent contained onshippingaddresschange onshippingoptionchange
- hi def link typescriptPaymentEvent Keyword
- syntax keyword typescriptPaymentResponseMethod contained complete nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptPaymentResponseMethod
- hi def link typescriptPaymentResponseMethod Keyword
- syntax keyword typescriptPaymentResponseProp contained details methodName payerEmail
- syntax keyword typescriptPaymentResponseProp contained payerPhone shippingAddress
- syntax keyword typescriptPaymentResponseProp contained shippingOption
- syntax cluster props add=typescriptPaymentResponseProp
- hi def link typescriptPaymentResponseProp Keyword
- 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
- hi def link typescriptPaymentAddressProp Keyword
- syntax keyword typescriptPaymentShippingOptionProp contained id label amount selected
- syntax cluster props add=typescriptPaymentShippingOptionProp
- hi def link typescriptPaymentShippingOptionProp Keyword
-
- "runtime syntax/yats/dom-node.vim
- 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
- hi def link typescriptDOMNodeProp Keyword
- 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
- hi def link typescriptDOMNodeMethod Keyword
- 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
- hi def link typescriptDOMNodeType Keyword
-
- "runtime syntax/yats/dom-elem.vim
- 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
- hi def link typescriptDOMElemAttrs Keyword
- 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
- hi def link typescriptDOMElemFuncs Keyword
-
- "runtime syntax/yats/dom-document.vim
- 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
- hi def link typescriptDOMDocProp Keyword
- 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
- hi def link typescriptDOMDocMethod Keyword
-
- "runtime syntax/yats/dom-event.vim
- syntax keyword typescriptDOMEventTargetMethod contained addEventListener removeEventListener nextgroup=typescriptEventFuncCallArg
- syntax keyword typescriptDOMEventTargetMethod contained dispatchEvent waitUntil nextgroup=typescriptEventFuncCallArg
- syntax cluster props add=typescriptDOMEventTargetMethod
- hi def link typescriptDOMEventTargetMethod Keyword
- 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
- hi def link typescriptDOMEventCons Structure
- 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
- hi def link typescriptDOMEventProp Keyword
- syntax keyword typescriptDOMEventMethod contained initEvent preventDefault stopImmediatePropagation nextgroup=typescriptEventFuncCallArg
- syntax keyword typescriptDOMEventMethod contained stopPropagation respondWith default nextgroup=typescriptEventFuncCallArg
- syntax cluster props add=typescriptDOMEventMethod
- hi def link typescriptDOMEventMethod Keyword
-
- "runtime syntax/yats/dom-storage.vim
- syntax keyword typescriptDOMStorage contained sessionStorage localStorage
- hi def link typescriptDOMStorage Keyword
- syntax keyword typescriptDOMStorageProp contained length
- syntax cluster props add=typescriptDOMStorageProp
- hi def link typescriptDOMStorageProp Keyword
- syntax keyword typescriptDOMStorageMethod contained getItem key setItem removeItem nextgroup=typescriptFuncCallArg
- syntax keyword typescriptDOMStorageMethod contained clear nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptDOMStorageMethod
- hi def link typescriptDOMStorageMethod Keyword
-
- "runtime syntax/yats/dom-form.vim
- syntax keyword typescriptDOMFormProp contained acceptCharset action elements encoding
- syntax keyword typescriptDOMFormProp contained enctype length method name target
- syntax cluster props add=typescriptDOMFormProp
- hi def link typescriptDOMFormProp Keyword
- syntax keyword typescriptDOMFormMethod contained reportValidity reset submit nextgroup=typescriptFuncCallArg
- syntax cluster props add=typescriptDOMFormMethod
- hi def link typescriptDOMFormMethod Keyword
-
- "runtime syntax/yats/css.vim
- 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
- hi def link typescriptDOMStyle Keyword
-
-
-
- let typescript_props = 1
-
- "runtime syntax/yats/event.vim
- syntax keyword typescriptAnimationEvent contained animationend animationiteration
- syntax keyword typescriptAnimationEvent contained animationstart beginEvent endEvent
- syntax keyword typescriptAnimationEvent contained repeatEvent
- syntax cluster events add=typescriptAnimationEvent
- hi def link typescriptAnimationEvent Title
- syntax keyword typescriptCSSEvent contained CssRuleViewRefreshed CssRuleViewChanged
- syntax keyword typescriptCSSEvent contained CssRuleViewCSSLinkClicked transitionend
- syntax cluster events add=typescriptCSSEvent
- hi def link typescriptCSSEvent Title
- syntax keyword typescriptDatabaseEvent contained blocked complete error success upgradeneeded
- syntax keyword typescriptDatabaseEvent contained versionchange
- syntax cluster events add=typescriptDatabaseEvent
- hi def link typescriptDatabaseEvent Title
- syntax keyword typescriptDocumentEvent contained DOMLinkAdded DOMLinkRemoved DOMMetaAdded
- syntax keyword typescriptDocumentEvent contained DOMMetaRemoved DOMWillOpenModalDialog
- syntax keyword typescriptDocumentEvent contained DOMModalDialogClosed unload
- syntax cluster events add=typescriptDocumentEvent
- hi def link typescriptDocumentEvent Title
- 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
- hi def link typescriptDOMMutationEvent Title
- 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
- hi def link typescriptDragEvent Title
- syntax keyword typescriptElementEvent contained invalid overflow underflow DOMAutoComplete
- syntax keyword typescriptElementEvent contained command commandupdate
- syntax cluster events add=typescriptElementEvent
- hi def link typescriptElementEvent Title
- syntax keyword typescriptFocusEvent contained blur change DOMFocusIn DOMFocusOut focus
- syntax keyword typescriptFocusEvent contained focusin focusout
- syntax cluster events add=typescriptFocusEvent
- hi def link typescriptFocusEvent Title
- syntax keyword typescriptFormEvent contained reset submit
- syntax cluster events add=typescriptFormEvent
- hi def link typescriptFormEvent Title
- syntax keyword typescriptFrameEvent contained DOMFrameContentLoaded
- syntax cluster events add=typescriptFrameEvent
- hi def link typescriptFrameEvent Title
- 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
- hi def link typescriptInputDeviceEvent Title
- 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
- hi def link typescriptMediaEvent Title
- syntax keyword typescriptMenuEvent contained DOMMenuItemActive DOMMenuItemInactive
- syntax cluster events add=typescriptMenuEvent
- hi def link typescriptMenuEvent Title
- syntax keyword typescriptNetworkEvent contained datachange dataerror disabled enabled
- syntax keyword typescriptNetworkEvent contained offline online statuschange connectionInfoUpdate
- syntax cluster events add=typescriptNetworkEvent
- hi def link typescriptNetworkEvent Title
- syntax keyword typescriptProgressEvent contained abort error load loadend loadstart
- syntax keyword typescriptProgressEvent contained progress timeout uploadprogress
- syntax cluster events add=typescriptProgressEvent
- hi def link typescriptProgressEvent Title
- syntax keyword typescriptResourceEvent contained cached error load
- syntax cluster events add=typescriptResourceEvent
- hi def link typescriptResourceEvent Title
- syntax keyword typescriptScriptEvent contained afterscriptexecute beforescriptexecute
- syntax cluster events add=typescriptScriptEvent
- hi def link typescriptScriptEvent Title
- syntax keyword typescriptSensorEvent contained compassneedscalibration devicelight
- syntax keyword typescriptSensorEvent contained devicemotion deviceorientation deviceproximity
- syntax keyword typescriptSensorEvent contained orientationchange userproximity
- syntax cluster events add=typescriptSensorEvent
- hi def link typescriptSensorEvent Title
- syntax keyword typescriptSessionHistoryEvent contained pagehide pageshow popstate
- syntax cluster events add=typescriptSessionHistoryEvent
- hi def link typescriptSessionHistoryEvent Title
- syntax keyword typescriptStorageEvent contained change storage
- syntax cluster events add=typescriptStorageEvent
- hi def link typescriptStorageEvent Title
- syntax keyword typescriptSVGEvent contained SVGAbort SVGError SVGLoad SVGResize SVGScroll
- syntax keyword typescriptSVGEvent contained SVGUnload SVGZoom
- syntax cluster events add=typescriptSVGEvent
- hi def link typescriptSVGEvent Title
- syntax keyword typescriptTabEvent contained visibilitychange
- syntax cluster events add=typescriptTabEvent
- hi def link typescriptTabEvent Title
- syntax keyword typescriptTextEvent contained compositionend compositionstart compositionupdate
- syntax keyword typescriptTextEvent contained copy cut paste select text
- syntax cluster events add=typescriptTextEvent
- hi def link typescriptTextEvent Title
- syntax keyword typescriptTouchEvent contained touchcancel touchend touchenter touchleave
- syntax keyword typescriptTouchEvent contained touchmove touchstart
- syntax cluster events add=typescriptTouchEvent
- hi def link typescriptTouchEvent Title
- syntax keyword typescriptUpdateEvent contained checking downloading error noupdate
- syntax keyword typescriptUpdateEvent contained obsolete updateready
- syntax cluster events add=typescriptUpdateEvent
- hi def link typescriptUpdateEvent Title
- syntax keyword typescriptValueChangeEvent contained hashchange input readystatechange
- syntax cluster events add=typescriptValueChangeEvent
- hi def link typescriptValueChangeEvent Title
- syntax keyword typescriptViewEvent contained fullscreen fullscreenchange fullscreenerror
- syntax keyword typescriptViewEvent contained resize scroll
- syntax cluster events add=typescriptViewEvent
- hi def link typescriptViewEvent Title
- syntax keyword typescriptWebsocketEvent contained close error message open
- syntax cluster events add=typescriptWebsocketEvent
- hi def link typescriptWebsocketEvent Title
- syntax keyword typescriptWindowEvent contained DOMWindowCreated DOMWindowClose DOMTitleChanged
- syntax cluster events add=typescriptWindowEvent
- hi def link typescriptWindowEvent Title
- syntax keyword typescriptUncategorizedEvent contained beforeunload message open show
- syntax cluster events add=typescriptUncategorizedEvent
- hi def link typescriptUncategorizedEvent Title
- syntax keyword typescriptServiceWorkerEvent contained install activate fetch
- syntax cluster events add=typescriptServiceWorkerEvent
- hi def link typescriptServiceWorkerEvent Title
-
-
-endif
-
-" patch
-"runtime syntax/basic/patch.vim
-" patch for generated code
-syntax keyword typescriptGlobal Promise
- \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline
-syntax keyword typescriptGlobal Map WeakMap
- \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline
-
-"runtime syntax/basic/members.vim
-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
-
-"runtime syntax/basic/class.vim
-"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=/</ end=/>/
- \ 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=/</ end=/>/
- \ 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=/</ end=/>/
- \ 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=/</ end=/>/ skip=/\s*,\s*/
- \ contains=@typescriptType
- \ nextgroup=typescriptObjectType,typescriptInterfaceComma
- \ contained skipwhite
-
-syntax match typescriptInterfaceComma /,/ contained nextgroup=typescriptInterfaceHeritage skipwhite skipnl
-
-"runtime syntax/basic/cluster.vim
-"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
-
-"runtime syntax/basic/function.vim
-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=/</ end=/>/ 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
-
-"runtime syntax/basic/decorator.vim
-syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/
- \ nextgroup=typescriptArgumentList
- \ contains=@_semantic,typescriptDotNotation
-
-" Define the default highlighting.
-hi def link typescriptReserved Error
-
-hi def link typescriptEndColons Exception
-hi def link typescriptSymbols Normal
-hi def link typescriptBraces Function
-hi def link typescriptParens Normal
-hi def link typescriptComment Comment
-hi def link typescriptLineComment Comment
-hi def link typescriptDocComment Comment
-hi def link typescriptCommentTodo Todo
-hi def link typescriptRef Include
-hi def link typescriptDocNotation SpecialComment
-hi def link typescriptDocTags SpecialComment
-hi def link typescriptDocNGParam typescriptDocParam
-hi def link typescriptDocParam Function
-hi def link typescriptDocNumParam Function
-hi def link typescriptDocEventRef Function
-hi def link typescriptDocNamedParamType Type
-hi def link typescriptDocParamName Type
-hi def link typescriptDocParamType Type
-hi def link typescriptString String
-hi def link typescriptSpecial Special
-hi def link typescriptStringLiteralType String
-hi def link typescriptStringMember String
-hi def link typescriptTemplate String
-hi def link typescriptEventString String
-hi def link typescriptASCII Special
-hi def link typescriptTemplateSB Label
-hi def link typescriptRegexpString String
-hi def link typescriptGlobal Constant
-hi def link typescriptPrototype Type
-hi def link typescriptConditional Conditional
-hi def link typescriptConditionalElse Conditional
-hi def link typescriptCase Conditional
-hi def link typescriptDefault typescriptCase
-hi def link typescriptBranch Conditional
-hi def link typescriptIdentifier Structure
-hi def link typescriptVariable Identifier
-hi def link typescriptEnumKeyword Identifier
-hi def link typescriptRepeat Repeat
-hi def link typescriptForOperator Repeat
-hi def link typescriptStatementKeyword Statement
-hi def link typescriptMessage Keyword
-hi def link typescriptOperator Identifier
-hi def link typescriptKeywordOp Identifier
-hi def link typescriptCastKeyword Special
-hi def link typescriptType Type
-hi def link typescriptNull Boolean
-hi def link typescriptNumber Number
-hi def link typescriptExponent Number
-hi def link typescriptBoolean Boolean
-hi def link typescriptObjectLabel typescriptLabel
-hi def link typescriptLabel Label
-hi def link typescriptStringProperty String
-hi def link typescriptImport Special
-hi def link typescriptAmbientDeclaration Special
-hi def link typescriptExport Special
-hi def link typescriptModule Special
-hi def link typescriptTry Special
-hi def link typescriptExceptions Special
-
-hi def link typescriptMember Function
-hi def link typescriptMethodAccessor Operator
-
-hi def link typescriptAsyncFuncKeyword Keyword
-hi def link typescriptAsyncFor Keyword
-hi def link typescriptFuncKeyword Keyword
-hi def link typescriptAsyncFunc Keyword
-hi def link typescriptArrowFunc Type
-hi def link typescriptFuncName Function
-hi def link typescriptFuncArg PreProc
-hi def link typescriptArrowFuncArg PreProc
-hi def link typescriptFuncComma Operator
-
-hi def link typescriptClassKeyword Keyword
-hi def link typescriptClassExtends Keyword
-" hi def link typescriptClassName Function
-hi def link typescriptAbstract Special
-" hi def link typescriptClassHeritage Function
-" hi def link typescriptInterfaceHeritage Function
-hi def link typescriptClassStatic StorageClass
-hi def link typescriptReadonlyModifier Keyword
-hi def link typescriptInterfaceKeyword Keyword
-hi def link typescriptInterfaceExtends Keyword
-hi def link typescriptInterfaceName Function
-
-hi def link shellbang Comment
-
-hi def link typescriptTypeParameter Identifier
-hi def link typescriptConstraint Keyword
-hi def link typescriptPredefinedType Type
-hi def link typescriptReadonlyArrayKeyword Keyword
-hi def link typescriptUnion Operator
-hi def link typescriptFuncTypeArrow Function
-hi def link typescriptConstructorType Function
-hi def link typescriptTypeQuery Keyword
-hi def link typescriptAccessibilityModifier Keyword
-hi def link typescriptOptionalMark PreProc
-hi def link typescriptFuncType Special
-hi def link typescriptMappedIn Special
-hi def link typescriptCall PreProc
-hi def link typescriptParamImpl PreProc
-hi def link typescriptConstructSignature Identifier
-hi def link typescriptAliasDeclaration Identifier
-hi def link typescriptAliasKeyword Keyword
-hi def link typescriptUserDefinedType Keyword
-hi def link typescriptTypeReference Identifier
-hi def link typescriptConstructor Keyword
-hi def link typescriptDecorator Special
-
-hi link typeScript NONE
let b:current_syntax = "typescript"
if main_syntax == 'typescript'
diff --git a/runtime/syntax/typescriptcommon.vim b/runtime/syntax/typescriptcommon.vim
new file mode 100644
index 0000000000..ff53168329
--- /dev/null
+++ b/runtime/syntax/typescriptcommon.vim
@@ -0,0 +1,2067 @@
+" Vim syntax file
+" Language: TypeScript and TypeScriptReact
+" Maintainer: Bram Moolenaar, Herrington Darkholme
+" Last Change: 2019 Nov 30
+" Based On: Herrington Darkholme's yats.vim
+" Changes: See https:github.com/HerringtonDarkholme/yats.vim
+" Credits: See yats.vim on github
+
+if &cpo =~ 'C'
+ let s:cpo_save = &cpo
+ set cpo&vim
+endif
+
+
+" NOTE: this results in accurate highlighting, but can be slow.
+syntax sync fromstart
+
+"Dollar sign is permitted anywhere in an identifier
+setlocal iskeyword-=$
+if main_syntax == 'typescript' || main_syntax == 'typescriptreact'
+ 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
+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
+
+"runtime syntax/basic/literal.vim
+"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
+" <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48>
+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
+
+
+" runtime syntax/basic/object.vim
+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
+
+"runtime syntax/basic/symbols.vim
+" + - ^ ~
+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
+
+" runtime syntax/basic/reserved.vim
+
+"runtime syntax/basic/keyword.vim
+"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
+
+"runtime syntax/basic/doc.vim
+"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*<reference\s\+.*\/>$+
+ \ contains=typescriptString
+syntax match typescriptRef +///\s*<amd-dependency\s\+.*\/>$+
+ \ contains=typescriptString
+syntax match typescriptRef +///\s*<amd-module\s\+.*\/>$+
+ \ contains=typescriptString
+
+"JSDoc
+syntax case ignore
+
+syntax region typescriptDocComment matchgroup=typescriptComment
+ \ start="/\*\*" end="\*/"
+ \ contains=typescriptDocNotation,typescriptCommentTodo,@Spell
+ \ fold keepend
+syntax match typescriptDocNotation contained /@/ nextgroup=typescriptDocTags
+
+syntax keyword typescriptDocTags contained constant constructor constructs function ignore inner private public readonly static
+syntax keyword typescriptDocTags contained const dict expose inheritDoc interface nosideeffects override protected struct internal
+syntax keyword typescriptDocTags contained example global
+syntax keyword typescriptDocTags contained alpha beta defaultValue eventProperty experimental label
+syntax keyword typescriptDocTags contained packageDocumentation privateRemarks remarks sealed typeParam
+
+" syntax keyword typescriptDocTags contained ngdoc nextgroup=typescriptDocNGDirective
+syntax keyword typescriptDocTags contained ngdoc scope priority animations
+syntax keyword typescriptDocTags contained ngdoc restrict methodOf propertyOf eventOf eventType nextgroup=typescriptDocParam skipwhite
+syntax keyword typescriptDocNGDirective contained overview service object function method property event directive filter inputType error
+
+syntax keyword typescriptDocTags contained abstract virtual access augments
+
+syntax keyword typescriptDocTags contained arguments callback lends memberOf name type kind link mixes mixin tutorial nextgroup=typescriptDocParam skipwhite
+syntax keyword typescriptDocTags contained variation nextgroup=typescriptDocNumParam skipwhite
+
+syntax keyword typescriptDocTags contained author class classdesc copyright default defaultvalue nextgroup=typescriptDocDesc skipwhite
+syntax keyword typescriptDocTags contained deprecated description external host nextgroup=typescriptDocDesc skipwhite
+syntax keyword typescriptDocTags contained file fileOverview overview namespace requires since version nextgroup=typescriptDocDesc skipwhite
+syntax keyword typescriptDocTags contained summary todo license preserve nextgroup=typescriptDocDesc skipwhite
+
+syntax keyword typescriptDocTags contained borrows exports nextgroup=typescriptDocA skipwhite
+syntax keyword typescriptDocTags contained param arg argument property prop module nextgroup=typescriptDocNamedParamType,typescriptDocParamName skipwhite
+syntax keyword typescriptDocTags contained define enum extends implements this typedef nextgroup=typescriptDocParamType skipwhite
+syntax keyword typescriptDocTags contained return returns throws exception nextgroup=typescriptDocParamType,typescriptDocParamName skipwhite
+syntax keyword typescriptDocTags contained see nextgroup=typescriptDocRef skipwhite
+
+syntax keyword typescriptDocTags contained function func method nextgroup=typescriptDocName skipwhite
+syntax match typescriptDocName contained /\h\w*/
+
+syntax keyword typescriptDocTags contained fires event nextgroup=typescriptDocEventRef skipwhite
+syntax match typescriptDocEventRef contained /\h\w*#\(\h\w*\:\)\?\h\w*/
+
+syntax match typescriptDocNamedParamType contained /{.\+}/ nextgroup=typescriptDocParamName skipwhite
+syntax match typescriptDocParamName contained /\[\?0-9a-zA-Z_\.]\+\]\?/ nextgroup=typescriptDocDesc skipwhite
+syntax match typescriptDocParamType contained /{.\+}/ nextgroup=typescriptDocDesc skipwhite
+syntax match typescriptDocA contained /\%(#\|\w\|\.\|:\|\/\)\+/ nextgroup=typescriptDocAs skipwhite
+syntax match typescriptDocAs contained /\s*as\s*/ nextgroup=typescriptDocB skipwhite
+syntax match typescriptDocB contained /\%(#\|\w\|\.\|:\|\/\)\+/
+syntax match typescriptDocParam contained /\%(#\|\w\|\.\|:\|\/\|-\)\+/
+syntax match typescriptDocNumParam contained /\d\+/
+syntax match typescriptDocRef contained /\%(#\|\w\|\.\|:\|\/\)\+/
+syntax region typescriptDocLinkTag contained matchgroup=typescriptDocLinkTag start=/{/ end=/}/ contains=typescriptDocTags
+
+syntax cluster typescriptDocs contains=typescriptDocParamType,typescriptDocNamedParamType,typescriptDocParam
+
+if main_syntax == "typescript"
+ syntax sync clear
+ syntax sync ccomment typescriptComment minlines=200
+endif
+
+syntax case match
+
+"runtime syntax/basic/type.vim
+" Types
+syntax match typescriptOptionalMark /?/ contained
+
+syntax region typescriptTypeParameters matchgroup=typescriptTypeBrackets
+ \ start=/</ end=/>/
+ \ 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<T> {} // ClassBlock
+" func<T>() // FuncCallArg
+syntax region typescriptTypeArguments matchgroup=typescriptTypeBrackets
+ \ start=/\></ end=/>/
+ \ 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,
+ \ typescriptAssertType
+
+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,@typescriptComments
+ \ contained skipwhite
+
+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=/</ end=/>/
+ \ 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 keyword typescriptAssertType asserts
+ \ nextgroup=typescriptTypeReference
+ \ contained skipwhite skipnl
+
+syntax cluster typescriptCallSignature contains=typescriptGenericCall,typescriptCall
+syntax region typescriptGenericCall matchgroup=typescriptTypeBrackets
+ \ start=/</ end=/>/
+ \ 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
+
+" extension
+if get(g:, 'yats_host_keyword', 1)
+ "runtime syntax/yats.vim
+ "runtime syntax/yats/typescript.vim
+ 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
+ hi def link typescriptGlobal Structure
+ 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
+ hi def link typescriptGlobalMethod Structure
+
+ "runtime syntax/yats/es6-number.vim
+ 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
+ hi def link typescriptNumberStaticProp Keyword
+ syntax keyword typescriptNumberStaticMethod contained isFinite isInteger isNaN isSafeInteger nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptNumberStaticMethod contained parseFloat parseInt nextgroup=typescriptFuncCallArg
+ hi def link typescriptNumberStaticMethod Keyword
+ syntax keyword typescriptNumberMethod contained toExponential toFixed toLocaleString nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptNumberMethod contained toPrecision toSource toString valueOf nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptNumberMethod
+ hi def link typescriptNumberMethod Keyword
+
+ "runtime syntax/yats/es6-string.vim
+ 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
+ hi def link typescriptStringStaticMethod Keyword
+ 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
+ hi def link typescriptStringMethod Keyword
+
+ "runtime syntax/yats/es6-array.vim
+ 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
+ hi def link typescriptArrayStaticMethod Keyword
+ 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
+ hi def link typescriptArrayMethod Keyword
+
+ "runtime syntax/yats/es6-object.vim
+ 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
+ hi def link typescriptObjectStaticMethod Keyword
+ 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
+ hi def link typescriptObjectMethod Keyword
+
+ "runtime syntax/yats/es6-symbol.vim
+ 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
+ hi def link typescriptSymbolStaticProp Keyword
+ syntax keyword typescriptSymbolStaticMethod contained for keyFor nextgroup=typescriptFuncCallArg
+ hi def link typescriptSymbolStaticMethod Keyword
+
+ "runtime syntax/yats/es6-function.vim
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function
+ syntax keyword typescriptFunctionMethod contained apply bind call nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptFunctionMethod
+ hi def link typescriptFunctionMethod Keyword
+
+ "runtime syntax/yats/es6-math.vim
+ 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
+ hi def link typescriptMathStaticProp Keyword
+ 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
+ hi def link typescriptMathStaticMethod Keyword
+
+ "runtime syntax/yats/es6-date.vim
+ 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
+ hi def link typescriptDateStaticMethod Keyword
+ 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
+ hi def link typescriptDateMethod Keyword
+
+ "runtime syntax/yats/es6-json.vim
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName JSON nextgroup=typescriptGlobalJSONDot,typescriptFuncCallArg
+ syntax match typescriptGlobalJSONDot /\./ contained nextgroup=typescriptJSONStaticMethod,typescriptProp
+ syntax keyword typescriptJSONStaticMethod contained parse stringify nextgroup=typescriptFuncCallArg
+ hi def link typescriptJSONStaticMethod Keyword
+
+ "runtime syntax/yats/es6-regexp.vim
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName RegExp nextgroup=typescriptGlobalRegExpDot,typescriptFuncCallArg
+ syntax match typescriptGlobalRegExpDot /\./ contained nextgroup=typescriptRegExpStaticProp,typescriptProp
+ syntax keyword typescriptRegExpStaticProp contained lastIndex
+ hi def link typescriptRegExpStaticProp Keyword
+ syntax keyword typescriptRegExpProp contained global ignoreCase multiline source sticky
+ syntax cluster props add=typescriptRegExpProp
+ hi def link typescriptRegExpProp Keyword
+ syntax keyword typescriptRegExpMethod contained exec test nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptRegExpMethod
+ hi def link typescriptRegExpMethod Keyword
+
+ "runtime syntax/yats/es6-map.vim
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Map WeakMap
+ syntax keyword typescriptES6MapProp contained size
+ syntax cluster props add=typescriptES6MapProp
+ hi def link typescriptES6MapProp Keyword
+ 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
+ hi def link typescriptES6MapMethod Keyword
+
+ "runtime syntax/yats/es6-set.vim
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Set WeakSet
+ syntax keyword typescriptES6SetProp contained size
+ syntax cluster props add=typescriptES6SetProp
+ hi def link typescriptES6SetProp Keyword
+ syntax keyword typescriptES6SetMethod contained add clear delete entries forEach has nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptES6SetMethod contained values nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptES6SetMethod
+ hi def link typescriptES6SetMethod Keyword
+
+ "runtime syntax/yats/es6-proxy.vim
+ 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
+ hi def link typescriptProxyAPI Keyword
+
+ "runtime syntax/yats/es6-promise.vim
+ 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
+ hi def link typescriptPromiseStaticMethod Keyword
+ syntax keyword typescriptPromiseMethod contained then catch finally nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptPromiseMethod
+ hi def link typescriptPromiseMethod Keyword
+
+ "runtime syntax/yats/es6-reflect.vim
+ 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
+ hi def link typescriptReflectMethod Keyword
+
+ "runtime syntax/yats/ecma-402.vim
+ 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
+ hi def link typescriptIntlMethod Keyword
+
+ "runtime syntax/yats/node.vim
+ 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
+ hi def link typescriptNodeGlobal Structure
+
+ 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
+
+ "runtime syntax/yats/web.vim
+ 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
+ hi def link typescriptBOM Structure
+
+ "runtime syntax/yats/web-window.vim
+ 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
+ hi def link typescriptBOMWindowProp Structure
+ 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
+ hi def link typescriptBOMWindowMethod Structure
+ 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
+ hi def link typescriptBOMWindowEvent Keyword
+ syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName DOMParser
+ syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName QueryInterface
+ syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName XMLSerializer
+ hi def link typescriptBOMWindowCons Structure
+
+ "runtime syntax/yats/web-navigator.vim
+ 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
+ hi def link typescriptBOMNavigatorProp Keyword
+ 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
+ hi def link typescriptBOMNavigatorMethod Keyword
+ syntax keyword typescriptServiceWorkerMethod contained register nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptServiceWorkerMethod
+ hi def link typescriptServiceWorkerMethod Keyword
+
+ "runtime syntax/yats/web-location.vim
+ 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
+ hi def link typescriptBOMLocationProp Keyword
+ syntax keyword typescriptBOMLocationMethod contained assign reload replace toString nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptBOMLocationMethod
+ hi def link typescriptBOMLocationMethod Keyword
+
+ "runtime syntax/yats/web-history.vim
+ syntax keyword typescriptBOMHistoryProp contained length current next previous state
+ syntax keyword typescriptBOMHistoryProp contained scrollRestoration
+ syntax cluster props add=typescriptBOMHistoryProp
+ hi def link typescriptBOMHistoryProp Keyword
+ syntax keyword typescriptBOMHistoryMethod contained back forward go pushState replaceState nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptBOMHistoryMethod
+ hi def link typescriptBOMHistoryMethod Keyword
+
+ "runtime syntax/yats/web-console.vim
+ 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
+ hi def link typescriptConsoleMethod Keyword
+
+ "runtime syntax/yats/web-xhr.vim
+ syntax keyword typescriptXHRGlobal containedin=typescriptIdentifierName XMLHttpRequest
+ hi def link typescriptXHRGlobal Structure
+ 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
+ hi def link typescriptXHRProp Keyword
+ syntax keyword typescriptXHRMethod contained abort getAllResponseHeaders getResponseHeader nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptXHRMethod contained open overrideMimeType send setRequestHeader nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptXHRMethod
+ hi def link typescriptXHRMethod Keyword
+
+ "runtime syntax/yats/web-blob.vim
+ 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
+ hi def link typescriptFileMethod Keyword
+ syntax keyword typescriptFileReaderProp contained error readyState result
+ syntax cluster props add=typescriptFileReaderProp
+ hi def link typescriptFileReaderProp Keyword
+ syntax keyword typescriptFileReaderMethod contained abort readAsArrayBuffer readAsBinaryString nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptFileReaderMethod contained readAsDataURL readAsText nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptFileReaderMethod
+ hi def link typescriptFileReaderMethod Keyword
+ syntax keyword typescriptFileListMethod contained item nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptFileListMethod
+ hi def link typescriptFileListMethod Keyword
+ syntax keyword typescriptBlobMethod contained append getBlob getFile nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptBlobMethod
+ hi def link typescriptBlobMethod Keyword
+ 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
+ hi def link typescriptURLUtilsProp Keyword
+ syntax keyword typescriptURLStaticMethod contained createObjectURL revokeObjectURL nextgroup=typescriptFuncCallArg
+ hi def link typescriptURLStaticMethod Keyword
+
+ "runtime syntax/yats/web-crypto.vim
+ syntax keyword typescriptCryptoGlobal containedin=typescriptIdentifierName crypto
+ hi def link typescriptCryptoGlobal Structure
+ syntax keyword typescriptSubtleCryptoMethod contained encrypt decrypt sign verify nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptSubtleCryptoMethod contained digest nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptSubtleCryptoMethod
+ hi def link typescriptSubtleCryptoMethod Keyword
+ syntax keyword typescriptCryptoProp contained subtle
+ syntax cluster props add=typescriptCryptoProp
+ hi def link typescriptCryptoProp Keyword
+ syntax keyword typescriptCryptoMethod contained getRandomValues nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptCryptoMethod
+ hi def link typescriptCryptoMethod Keyword
+
+ "runtime syntax/yats/web-fetch.vim
+ 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
+ hi def link typescriptGlobalMethod Structure
+ syntax keyword typescriptHeadersMethod contained append delete get getAll has set nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptHeadersMethod
+ hi def link typescriptHeadersMethod Keyword
+ syntax keyword typescriptRequestProp contained method url headers context referrer
+ syntax keyword typescriptRequestProp contained mode credentials cache
+ syntax cluster props add=typescriptRequestProp
+ hi def link typescriptRequestProp Keyword
+ syntax keyword typescriptRequestMethod contained clone nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptRequestMethod
+ hi def link typescriptRequestMethod Keyword
+ syntax keyword typescriptResponseProp contained type url status statusText headers
+ syntax keyword typescriptResponseProp contained redirected
+ syntax cluster props add=typescriptResponseProp
+ hi def link typescriptResponseProp Keyword
+ syntax keyword typescriptResponseMethod contained clone nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptResponseMethod
+ hi def link typescriptResponseMethod Keyword
+
+ "runtime syntax/yats/web-service-worker.vim
+ syntax keyword typescriptServiceWorkerProp contained controller ready
+ syntax cluster props add=typescriptServiceWorkerProp
+ hi def link typescriptServiceWorkerProp Keyword
+ syntax keyword typescriptServiceWorkerMethod contained register getRegistration nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptServiceWorkerMethod
+ hi def link typescriptServiceWorkerMethod Keyword
+ 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
+ hi def link typescriptCacheMethod Keyword
+
+ "runtime syntax/yats/web-encoding.vim
+ syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextEncoder
+ syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextDecoder
+ hi def link typescriptEncodingGlobal Structure
+ syntax keyword typescriptEncodingProp contained encoding fatal ignoreBOM
+ syntax cluster props add=typescriptEncodingProp
+ hi def link typescriptEncodingProp Keyword
+ syntax keyword typescriptEncodingMethod contained encode decode nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptEncodingMethod
+ hi def link typescriptEncodingMethod Keyword
+
+ "runtime syntax/yats/web-geo.vim
+ 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
+ hi def link typescriptGeolocationMethod Keyword
+
+ "runtime syntax/yats/web-network.vim
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName NetworkInformation
+ syntax keyword typescriptBOMNetworkProp contained downlink downlinkMax effectiveType
+ syntax keyword typescriptBOMNetworkProp contained rtt type
+ syntax cluster props add=typescriptBOMNetworkProp
+ hi def link typescriptBOMNetworkProp Keyword
+
+ "runtime syntax/yats/web-payment.vim
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName PaymentRequest
+ syntax keyword typescriptPaymentMethod contained show abort canMakePayment nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptPaymentMethod
+ hi def link typescriptPaymentMethod Keyword
+ syntax keyword typescriptPaymentProp contained shippingAddress shippingOption result
+ syntax cluster props add=typescriptPaymentProp
+ hi def link typescriptPaymentProp Keyword
+ syntax keyword typescriptPaymentEvent contained onshippingaddresschange onshippingoptionchange
+ hi def link typescriptPaymentEvent Keyword
+ syntax keyword typescriptPaymentResponseMethod contained complete nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptPaymentResponseMethod
+ hi def link typescriptPaymentResponseMethod Keyword
+ syntax keyword typescriptPaymentResponseProp contained details methodName payerEmail
+ syntax keyword typescriptPaymentResponseProp contained payerPhone shippingAddress
+ syntax keyword typescriptPaymentResponseProp contained shippingOption
+ syntax cluster props add=typescriptPaymentResponseProp
+ hi def link typescriptPaymentResponseProp Keyword
+ 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
+ hi def link typescriptPaymentAddressProp Keyword
+ syntax keyword typescriptPaymentShippingOptionProp contained id label amount selected
+ syntax cluster props add=typescriptPaymentShippingOptionProp
+ hi def link typescriptPaymentShippingOptionProp Keyword
+
+ "runtime syntax/yats/dom-node.vim
+ 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
+ hi def link typescriptDOMNodeProp Keyword
+ 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
+ hi def link typescriptDOMNodeMethod Keyword
+ 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
+ hi def link typescriptDOMNodeType Keyword
+
+ "runtime syntax/yats/dom-elem.vim
+ 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
+ hi def link typescriptDOMElemAttrs Keyword
+ 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
+ hi def link typescriptDOMElemFuncs Keyword
+
+ "runtime syntax/yats/dom-document.vim
+ 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
+ hi def link typescriptDOMDocProp Keyword
+ 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
+ hi def link typescriptDOMDocMethod Keyword
+
+ "runtime syntax/yats/dom-event.vim
+ syntax keyword typescriptDOMEventTargetMethod contained addEventListener removeEventListener nextgroup=typescriptEventFuncCallArg
+ syntax keyword typescriptDOMEventTargetMethod contained dispatchEvent waitUntil nextgroup=typescriptEventFuncCallArg
+ syntax cluster props add=typescriptDOMEventTargetMethod
+ hi def link typescriptDOMEventTargetMethod Keyword
+ 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
+ hi def link typescriptDOMEventCons Structure
+ 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
+ hi def link typescriptDOMEventProp Keyword
+ syntax keyword typescriptDOMEventMethod contained initEvent preventDefault stopImmediatePropagation nextgroup=typescriptEventFuncCallArg
+ syntax keyword typescriptDOMEventMethod contained stopPropagation respondWith default nextgroup=typescriptEventFuncCallArg
+ syntax cluster props add=typescriptDOMEventMethod
+ hi def link typescriptDOMEventMethod Keyword
+
+ "runtime syntax/yats/dom-storage.vim
+ syntax keyword typescriptDOMStorage contained sessionStorage localStorage
+ hi def link typescriptDOMStorage Keyword
+ syntax keyword typescriptDOMStorageProp contained length
+ syntax cluster props add=typescriptDOMStorageProp
+ hi def link typescriptDOMStorageProp Keyword
+ syntax keyword typescriptDOMStorageMethod contained getItem key setItem removeItem nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptDOMStorageMethod contained clear nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptDOMStorageMethod
+ hi def link typescriptDOMStorageMethod Keyword
+
+ "runtime syntax/yats/dom-form.vim
+ syntax keyword typescriptDOMFormProp contained acceptCharset action elements encoding
+ syntax keyword typescriptDOMFormProp contained enctype length method name target
+ syntax cluster props add=typescriptDOMFormProp
+ hi def link typescriptDOMFormProp Keyword
+ syntax keyword typescriptDOMFormMethod contained reportValidity reset submit nextgroup=typescriptFuncCallArg
+ syntax cluster props add=typescriptDOMFormMethod
+ hi def link typescriptDOMFormMethod Keyword
+
+ "runtime syntax/yats/css.vim
+ 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
+ hi def link typescriptDOMStyle Keyword
+
+
+
+ let typescript_props = 1
+
+ "runtime syntax/yats/event.vim
+ syntax keyword typescriptAnimationEvent contained animationend animationiteration
+ syntax keyword typescriptAnimationEvent contained animationstart beginEvent endEvent
+ syntax keyword typescriptAnimationEvent contained repeatEvent
+ syntax cluster events add=typescriptAnimationEvent
+ hi def link typescriptAnimationEvent Title
+ syntax keyword typescriptCSSEvent contained CssRuleViewRefreshed CssRuleViewChanged
+ syntax keyword typescriptCSSEvent contained CssRuleViewCSSLinkClicked transitionend
+ syntax cluster events add=typescriptCSSEvent
+ hi def link typescriptCSSEvent Title
+ syntax keyword typescriptDatabaseEvent contained blocked complete error success upgradeneeded
+ syntax keyword typescriptDatabaseEvent contained versionchange
+ syntax cluster events add=typescriptDatabaseEvent
+ hi def link typescriptDatabaseEvent Title
+ syntax keyword typescriptDocumentEvent contained DOMLinkAdded DOMLinkRemoved DOMMetaAdded
+ syntax keyword typescriptDocumentEvent contained DOMMetaRemoved DOMWillOpenModalDialog
+ syntax keyword typescriptDocumentEvent contained DOMModalDialogClosed unload
+ syntax cluster events add=typescriptDocumentEvent
+ hi def link typescriptDocumentEvent Title
+ 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
+ hi def link typescriptDOMMutationEvent Title
+ 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
+ hi def link typescriptDragEvent Title
+ syntax keyword typescriptElementEvent contained invalid overflow underflow DOMAutoComplete
+ syntax keyword typescriptElementEvent contained command commandupdate
+ syntax cluster events add=typescriptElementEvent
+ hi def link typescriptElementEvent Title
+ syntax keyword typescriptFocusEvent contained blur change DOMFocusIn DOMFocusOut focus
+ syntax keyword typescriptFocusEvent contained focusin focusout
+ syntax cluster events add=typescriptFocusEvent
+ hi def link typescriptFocusEvent Title
+ syntax keyword typescriptFormEvent contained reset submit
+ syntax cluster events add=typescriptFormEvent
+ hi def link typescriptFormEvent Title
+ syntax keyword typescriptFrameEvent contained DOMFrameContentLoaded
+ syntax cluster events add=typescriptFrameEvent
+ hi def link typescriptFrameEvent Title
+ 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
+ hi def link typescriptInputDeviceEvent Title
+ 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
+ hi def link typescriptMediaEvent Title
+ syntax keyword typescriptMenuEvent contained DOMMenuItemActive DOMMenuItemInactive
+ syntax cluster events add=typescriptMenuEvent
+ hi def link typescriptMenuEvent Title
+ syntax keyword typescriptNetworkEvent contained datachange dataerror disabled enabled
+ syntax keyword typescriptNetworkEvent contained offline online statuschange connectionInfoUpdate
+ syntax cluster events add=typescriptNetworkEvent
+ hi def link typescriptNetworkEvent Title
+ syntax keyword typescriptProgressEvent contained abort error load loadend loadstart
+ syntax keyword typescriptProgressEvent contained progress timeout uploadprogress
+ syntax cluster events add=typescriptProgressEvent
+ hi def link typescriptProgressEvent Title
+ syntax keyword typescriptResourceEvent contained cached error load
+ syntax cluster events add=typescriptResourceEvent
+ hi def link typescriptResourceEvent Title
+ syntax keyword typescriptScriptEvent contained afterscriptexecute beforescriptexecute
+ syntax cluster events add=typescriptScriptEvent
+ hi def link typescriptScriptEvent Title
+ syntax keyword typescriptSensorEvent contained compassneedscalibration devicelight
+ syntax keyword typescriptSensorEvent contained devicemotion deviceorientation deviceproximity
+ syntax keyword typescriptSensorEvent contained orientationchange userproximity
+ syntax cluster events add=typescriptSensorEvent
+ hi def link typescriptSensorEvent Title
+ syntax keyword typescriptSessionHistoryEvent contained pagehide pageshow popstate
+ syntax cluster events add=typescriptSessionHistoryEvent
+ hi def link typescriptSessionHistoryEvent Title
+ syntax keyword typescriptStorageEvent contained change storage
+ syntax cluster events add=typescriptStorageEvent
+ hi def link typescriptStorageEvent Title
+ syntax keyword typescriptSVGEvent contained SVGAbort SVGError SVGLoad SVGResize SVGScroll
+ syntax keyword typescriptSVGEvent contained SVGUnload SVGZoom
+ syntax cluster events add=typescriptSVGEvent
+ hi def link typescriptSVGEvent Title
+ syntax keyword typescriptTabEvent contained visibilitychange
+ syntax cluster events add=typescriptTabEvent
+ hi def link typescriptTabEvent Title
+ syntax keyword typescriptTextEvent contained compositionend compositionstart compositionupdate
+ syntax keyword typescriptTextEvent contained copy cut paste select text
+ syntax cluster events add=typescriptTextEvent
+ hi def link typescriptTextEvent Title
+ syntax keyword typescriptTouchEvent contained touchcancel touchend touchenter touchleave
+ syntax keyword typescriptTouchEvent contained touchmove touchstart
+ syntax cluster events add=typescriptTouchEvent
+ hi def link typescriptTouchEvent Title
+ syntax keyword typescriptUpdateEvent contained checking downloading error noupdate
+ syntax keyword typescriptUpdateEvent contained obsolete updateready
+ syntax cluster events add=typescriptUpdateEvent
+ hi def link typescriptUpdateEvent Title
+ syntax keyword typescriptValueChangeEvent contained hashchange input readystatechange
+ syntax cluster events add=typescriptValueChangeEvent
+ hi def link typescriptValueChangeEvent Title
+ syntax keyword typescriptViewEvent contained fullscreen fullscreenchange fullscreenerror
+ syntax keyword typescriptViewEvent contained resize scroll
+ syntax cluster events add=typescriptViewEvent
+ hi def link typescriptViewEvent Title
+ syntax keyword typescriptWebsocketEvent contained close error message open
+ syntax cluster events add=typescriptWebsocketEvent
+ hi def link typescriptWebsocketEvent Title
+ syntax keyword typescriptWindowEvent contained DOMWindowCreated DOMWindowClose DOMTitleChanged
+ syntax cluster events add=typescriptWindowEvent
+ hi def link typescriptWindowEvent Title
+ syntax keyword typescriptUncategorizedEvent contained beforeunload message open show
+ syntax cluster events add=typescriptUncategorizedEvent
+ hi def link typescriptUncategorizedEvent Title
+ syntax keyword typescriptServiceWorkerEvent contained install activate fetch
+ syntax cluster events add=typescriptServiceWorkerEvent
+ hi def link typescriptServiceWorkerEvent Title
+
+
+endif
+
+" patch
+"runtime syntax/basic/patch.vim
+" patch for generated code
+syntax keyword typescriptGlobal Promise
+ \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline
+syntax keyword typescriptGlobal Map WeakMap
+ \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline
+
+"runtime syntax/basic/members.vim
+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
+
+"runtime syntax/basic/class.vim
+"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=/</ end=/>/
+ \ 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=/</ end=/>/
+ \ 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=/</ end=/>/
+ \ 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=/</ end=/>/ skip=/\s*,\s*/
+ \ contains=@typescriptType
+ \ nextgroup=typescriptObjectType,typescriptInterfaceComma
+ \ contained skipwhite
+
+syntax match typescriptInterfaceComma /,/ contained nextgroup=typescriptInterfaceHeritage skipwhite skipnl
+
+"runtime syntax/basic/cluster.vim
+"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
+
+"runtime syntax/basic/function.vim
+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=/</ end=/>/ 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
+
+"runtime syntax/basic/decorator.vim
+syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/
+ \ nextgroup=typescriptArgumentList,typescriptTypeArguments
+ \ contains=@_semantic,typescriptDotNotation
+
+" Define the default highlighting.
+hi def link typescriptReserved Error
+
+hi def link typescriptEndColons Exception
+hi def link typescriptSymbols Normal
+hi def link typescriptBraces Function
+hi def link typescriptParens Normal
+hi def link typescriptComment Comment
+hi def link typescriptLineComment Comment
+hi def link typescriptDocComment Comment
+hi def link typescriptCommentTodo Todo
+hi def link typescriptRef Include
+hi def link typescriptDocNotation SpecialComment
+hi def link typescriptDocTags SpecialComment
+hi def link typescriptDocNGParam typescriptDocParam
+hi def link typescriptDocParam Function
+hi def link typescriptDocNumParam Function
+hi def link typescriptDocEventRef Function
+hi def link typescriptDocNamedParamType Type
+hi def link typescriptDocParamName Type
+hi def link typescriptDocParamType Type
+hi def link typescriptString String
+hi def link typescriptSpecial Special
+hi def link typescriptStringLiteralType String
+hi def link typescriptStringMember String
+hi def link typescriptTemplate String
+hi def link typescriptEventString String
+hi def link typescriptASCII Special
+hi def link typescriptTemplateSB Label
+hi def link typescriptRegexpString String
+hi def link typescriptGlobal Constant
+hi def link typescriptTestGlobal Function
+hi def link typescriptPrototype Type
+hi def link typescriptConditional Conditional
+hi def link typescriptConditionalElse Conditional
+hi def link typescriptCase Conditional
+hi def link typescriptDefault typescriptCase
+hi def link typescriptBranch Conditional
+hi def link typescriptIdentifier Structure
+hi def link typescriptVariable Identifier
+hi def link typescriptEnumKeyword Identifier
+hi def link typescriptRepeat Repeat
+hi def link typescriptForOperator Repeat
+hi def link typescriptStatementKeyword Statement
+hi def link typescriptMessage Keyword
+hi def link typescriptOperator Identifier
+hi def link typescriptKeywordOp Identifier
+hi def link typescriptCastKeyword Special
+hi def link typescriptType Type
+hi def link typescriptNull Boolean
+hi def link typescriptNumber Number
+hi def link typescriptExponent Number
+hi def link typescriptBoolean Boolean
+hi def link typescriptObjectLabel typescriptLabel
+hi def link typescriptLabel Label
+hi def link typescriptStringProperty String
+hi def link typescriptImport Special
+hi def link typescriptAmbientDeclaration Special
+hi def link typescriptExport Special
+hi def link typescriptModule Special
+hi def link typescriptTry Special
+hi def link typescriptExceptions Special
+
+hi def link typescriptMember Function
+hi def link typescriptMethodAccessor Operator
+
+hi def link typescriptAsyncFuncKeyword Keyword
+hi def link typescriptAsyncFor Keyword
+hi def link typescriptFuncKeyword Keyword
+hi def link typescriptAsyncFunc Keyword
+hi def link typescriptArrowFunc Type
+hi def link typescriptFuncName Function
+hi def link typescriptFuncArg PreProc
+hi def link typescriptArrowFuncArg PreProc
+hi def link typescriptFuncComma Operator
+
+hi def link typescriptClassKeyword Keyword
+hi def link typescriptClassExtends Keyword
+" hi def link typescriptClassName Function
+hi def link typescriptAbstract Special
+" hi def link typescriptClassHeritage Function
+" hi def link typescriptInterfaceHeritage Function
+hi def link typescriptClassStatic StorageClass
+hi def link typescriptReadonlyModifier Keyword
+hi def link typescriptInterfaceKeyword Keyword
+hi def link typescriptInterfaceExtends Keyword
+hi def link typescriptInterfaceName Function
+
+hi def link shellbang Comment
+
+hi def link typescriptTypeParameter Identifier
+hi def link typescriptConstraint Keyword
+hi def link typescriptPredefinedType Type
+hi def link typescriptReadonlyArrayKeyword Keyword
+hi def link typescriptUnion Operator
+hi def link typescriptFuncTypeArrow Function
+hi def link typescriptConstructorType Function
+hi def link typescriptTypeQuery Keyword
+hi def link typescriptAccessibilityModifier Keyword
+hi def link typescriptOptionalMark PreProc
+hi def link typescriptFuncType Special
+hi def link typescriptMappedIn Special
+hi def link typescriptCall PreProc
+hi def link typescriptParamImpl PreProc
+hi def link typescriptConstructSignature Identifier
+hi def link typescriptAliasDeclaration Identifier
+hi def link typescriptAliasKeyword Keyword
+hi def link typescriptUserDefinedType Keyword
+hi def link typescriptTypeReference Identifier
+hi def link typescriptConstructor Keyword
+hi def link typescriptDecorator Special
+hi def link typescriptAssertType Keyword
+
+hi link typeScript NONE
+
+if exists('s:cpo_save')
+ let &cpo = s:cpo_save
+ unlet s:cpo_save
+endif
diff --git a/runtime/syntax/typescriptreact.vim b/runtime/syntax/typescriptreact.vim
new file mode 100644
index 0000000000..f29fe785b9
--- /dev/null
+++ b/runtime/syntax/typescriptreact.vim
@@ -0,0 +1,160 @@
+" Vim syntax file
+" Language: TypeScript with React (JSX)
+" Maintainer: Bram Moolenaar
+" Last Change: 2019 Nov 30
+" Based On: Herrington Darkholme's yats.vim
+" Changes: See https:github.com/HerringtonDarkholme/yats.vim
+" Credits: See yats.vim on github
+
+if !exists("main_syntax")
+ if exists("b:current_syntax")
+ finish
+ endif
+ let main_syntax = 'typescriptreact'
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+syntax region tsxTag
+ \ start=+<\([^/!?<>="':]\+\)\@=+
+ \ skip=+</[^ /!?<>"']\+>+
+ \ end=+/\@<!>+
+ \ end=+\(/>\)\@=+
+ \ contained
+ \ contains=tsxTagName,tsxIntrinsicTagName,tsxAttrib,tsxEscJs,
+ \tsxCloseString,@tsxComment
+
+syntax match tsxTag /<>/ contained
+
+
+" <tag></tag>
+" s~~~~~~~~~e
+" and self close tag
+" <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=+</\_s*\z1>+
+ \ 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
+
+" </tag>
+" ~~~~~~
+syntax match tsxCloseTag
+ \ +</\_s*[^/!?<>"']\+>+
+ \ 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 "[&.;]"
+
+" <tag key={this.props.key}>
+" ~~~
+syntax match tsxTagName
+ \ +[</]\_s*[^/!?<>"'* ]\++hs=s+1
+ \ contained
+ \ nextgroup=tsxAttrib
+ \ skipwhite
+ \ display
+syntax match tsxIntrinsicTagName
+ \ +[</]\_s*[a-z1-9-]\++hs=s+1
+ \ contained
+ \ nextgroup=tsxAttrib
+ \ skipwhite
+ \ display
+
+" <tag key={this.props.key}>
+" ~~~
+syntax match tsxAttrib
+ \ +[a-zA-Z_][-0-9a-zA-Z_]*+
+ \ nextgroup=tsxEqual skipwhite
+ \ contained
+ \ display
+
+" <tag id="sample">
+" ~
+syntax match tsxEqual +=+ display contained
+ \ nextgroup=tsxString skipwhite
+
+" <tag id="sample">
+" s~~~~~~e
+syntax region tsxString contained start=+"+ end=+"+ contains=tsxEntity,@Spell display
+
+" <tag key={this.props.key}>
+" s~~~~~~~~~~~~~~e
+syntax region tsxEscJs
+ \ contained
+ \ contains=@typescriptValue,@tsxComment
+ \ matchgroup=typescriptBraces
+ \ start=+{+
+ \ end=+}+
+ \ extend
+
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""
+" Source the part common with typescriptreact.vim
+source <sfile>:h/typescriptcommon.vim
+
+
+syntax cluster typescriptExpression add=tsxRegion,tsxFragment
+
+hi def link tsxTag htmlTag
+hi def link tsxTagName Function
+hi def link tsxIntrinsicTagName htmlTagName
+hi def link tsxString String
+hi def link tsxNameSpace Function
+hi def link tsxCommentInvalid Error
+hi def link tsxBlockComment Comment
+hi def link tsxLineComment Comment
+hi def link tsxAttrib Type
+hi def link tsxEscJs tsxEscapeJs
+hi def link tsxCloseTag htmlTag
+hi def link tsxCloseString Identifier
+
+let b:current_syntax = "typescriptreact"
+if main_syntax == 'typescriptreact'
+ unlet main_syntax
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/tools/check_colors.vim b/runtime/tools/check_colors.vim
index 57b71b19db..e4acbc33ec 100644
--- a/runtime/tools/check_colors.vim
+++ b/runtime/tools/check_colors.vim
@@ -1,6 +1,6 @@
" This script tests a color scheme for some errors and lists potential errors.
" Load the scheme and source this script, like this:
-" :edit colors/desert.vim | :so colors/tools/check_colors.vim
+" :edit colors/desert.vim | :so tools/check_colors.vim
let s:save_cpo= &cpo
set cpo&vim
@@ -8,7 +8,7 @@ set cpo&vim
func! Test_check_colors()
let l:savedview = winsaveview()
call cursor(1,1)
- let err={}
+ let err = {}
" 1) Check g:colors_name is existing
if !search('\<\%(g:\)\?colors_name\>', 'cnW')
@@ -81,36 +81,39 @@ func! Test_check_colors()
\ 'WarningMsg',
\ 'WildMenu',
\ ]
- let groups={}
+ let groups = {}
for group in hi_groups
- if search('\c@suppress\s\+'.group, 'cnW')
+ if search('\c@suppress\s\+\<' .. group .. '\>', 'cnW')
" skip check, if the script contains a line like
" @suppress Visual:
- let groups[group] = 'Ignoring '.group
continue
endif
- if search('hi\%[ghlight]!\= \+link \+'.group, 'cnW') " Linked group
+ if search('hi\%[ghlight]!\= \+link \+' .. group, 'cnW') " Linked group
continue
endif
- if !search('hi\%[ghlight] \+'.group, 'cnW')
- let groups[group] = 'No highlight definition for '.group
+ if !search('hi\%[ghlight] \+\<' .. group .. '\>', 'cnW')
+ let groups[group] = 'No highlight definition for ' .. group
continue
endif
- if !search('hi\%[ghlight] \+'.group. '.*fg=', 'cnW')
- let groups[group] = 'Missing foreground color for '.group
+ if !search('hi\%[ghlight] \+\<' .. group .. '\>.*[bf]g=', 'cnW')
+ let groups[group] = 'Missing foreground or background color for ' .. group
continue
endif
- if search('hi\%[ghlight] \+'.group. '.*guibg=', 'cnW') &&
- \ !search('hi\%[ghlight] \+'.group. '.*ctermbg=', 'cnW')
- let groups[group] = 'Missing bg terminal color for '.group
+ if search('hi\%[ghlight] \+\<' .. group .. '\>.*guibg=', 'cnW') &&
+ \ !search('hi\%[ghlight] \+\<' .. group .. '\>.*ctermbg=', 'cnW')
+ \ && group != 'Cursor'
+ let groups[group] = 'Missing bg terminal color for ' .. group
continue
endif
- if !search('hi\%[ghlight] \+'.group. '.*guifg=', 'cnW')
- let groups[group] = 'Missing guifg definition for '.group
+ if !search('hi\%[ghlight] \+\<' .. group .. '\>.*guifg=', 'cnW')
+ \ && group !~ '^Diff'
+ let groups[group] = 'Missing guifg definition for ' .. group
continue
endif
- if !search('hi\%[ghlight] \+'.group. '.*ctermfg=', 'cnW')
- let groups[group] = 'Missing ctermfg definition for '.group
+ if !search('hi\%[ghlight] \+\<' .. group .. '\>.*ctermfg=', 'cnW')
+ \ && group !~ '^Diff'
+ \ && group != 'Cursor'
+ let groups[group] = 'Missing ctermfg definition for ' .. group
continue
endif
" do not check for background colors, they could be intentionally left out
@@ -120,10 +123,10 @@ func! Test_check_colors()
" 3) Check, that it does not set background highlighting
" Doesn't ':hi Normal ctermfg=253 ctermfg=233' also set the background sometimes?
- let bg_set='\(set\?\|setl\(ocal\)\?\) .*\(background\|bg\)=\(dark\|light\)'
- let bg_let='let \%([&]\%([lg]:\)\?\)\%(background\|bg\)\s*=\s*\([''"]\?\)\w\+\1'
- let bg_pat='\%('.bg_set. '\|'.bg_let.'\)'
- let line=search(bg_pat, 'cnW')
+ let bg_set = '\(set\?\|setl\(ocal\)\?\) .*\(background\|bg\)=\(dark\|light\)'
+ let bg_let = 'let \%([&]\%([lg]:\)\?\)\%(background\|bg\)\s*=\s*\([''"]\?\)\w\+\1'
+ let bg_pat = '\%(' .. bg_set .. '\|' .. bg_let .. '\)'
+ let line = search(bg_pat, 'cnW')
if search(bg_pat, 'cnW')
exe line
if search('hi \U\w\+\s\+\S', 'cbnW')
@@ -145,7 +148,7 @@ func! Test_check_colors()
" if exists("syntax_on")
" syntax reset
" endif
- let pat='hi\%[ghlight]\s*clear\n\s*if\s*exists(\([''"]\)syntax_on\1)\n\s*syn\%[tax]\s*reset\n\s*endif'
+ let pat = 'hi\%[ghlight]\s*clear\n\s*if\s*exists(\([''"]\)syntax_on\1)\n\s*syn\%[tax]\s*reset\n\s*endif'
if !search(pat, 'cnW')
let err['init'] = 'No initialization'
endif
@@ -160,7 +163,7 @@ func! Test_check_colors()
let ft_groups = []
" let group = '\%('.join(hi_groups, '\|').'\)' " More efficient than a for loop, but less informative
for group in hi_groups
- let pat='\Chi\%[ghlight]!\= *\%[link] \+\zs'.group.'\w\+\>\ze \+.' " Skips `hi clear`
+ let pat = '\Chi\%[ghlight]!\= *\%[link] \+\zs' .. group .. '\w\+\>\ze \+.' " Skips `hi clear`
if search(pat, 'cW')
call add(ft_groups, matchstr(getline('.'), pat))
endif
@@ -172,7 +175,7 @@ func! Test_check_colors()
" 8) Were debugPC and debugBreakpoint defined?
for group in ['debugPC', 'debugBreakpoint']
- let pat='\Chi\%[ghlight]!\= *\%[link] \+\zs'.group.'\>'
+ let pat = '\Chi\%[ghlight]!\= *\%[link] \+\zs' .. group .. '\>'
if search(pat, 'cnW')
let line = search(pat, 'cW')
let err['filetype'] = get(err, 'filetype', 'Should not define: ') . matchstr(getline('.'), pat). ' '