aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-03-09 14:57:57 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-03-09 14:57:57 -0700
commitc324271b99eee4c621463f368914d57cd729bd9c (patch)
tree5d979d333a2d5f9c080991d5482fd5916f8579c6 /runtime/lua
parent931bffbda3668ddc609fc1da8f9eb576b170aa52 (diff)
parentade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff)
downloadrneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.gz
rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.bz2
rneovim-c324271b99eee4c621463f368914d57cd729bd9c.zip
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'runtime/lua')
-rw-r--r--runtime/lua/man.lua2
-rw-r--r--runtime/lua/nvim/health.lua47
-rw-r--r--runtime/lua/provider/clipboard/health.lua40
-rw-r--r--runtime/lua/provider/health.lua916
-rw-r--r--runtime/lua/provider/node/health.lua105
-rw-r--r--runtime/lua/provider/perl/health.lua90
-rw-r--r--runtime/lua/provider/python/health.lua500
-rw-r--r--runtime/lua/provider/ruby/health.lua71
-rw-r--r--runtime/lua/tohtml.lua1349
-rw-r--r--runtime/lua/vim/F.lua5
-rw-r--r--runtime/lua/vim/_defaults.lua386
-rw-r--r--runtime/lua/vim/_editor.lua135
-rw-r--r--runtime/lua/vim/_init_packages.lua10
-rw-r--r--runtime/lua/vim/_inspector.lua35
-rw-r--r--runtime/lua/vim/_meta.lua4
-rw-r--r--runtime/lua/vim/_meta/api.lua1021
-rw-r--r--runtime/lua/vim/_meta/api_keysets.lua101
-rw-r--r--runtime/lua/vim/_meta/api_keysets_extra.lua167
-rw-r--r--runtime/lua/vim/_meta/builtin.lua133
-rw-r--r--runtime/lua/vim/_meta/builtin_types.lua6
-rw-r--r--runtime/lua/vim/_meta/json.lua2
-rw-r--r--runtime/lua/vim/_meta/lpeg.lua103
-rw-r--r--runtime/lua/vim/_meta/misc.lua3
-rw-r--r--runtime/lua/vim/_meta/mpack.lua5
-rw-r--r--runtime/lua/vim/_meta/options.lua736
-rw-r--r--runtime/lua/vim/_meta/re.lua54
-rw-r--r--runtime/lua/vim/_meta/regex.lua3
-rw-r--r--runtime/lua/vim/_meta/vimfn.lua268
-rw-r--r--runtime/lua/vim/_meta/vvars.lua779
-rw-r--r--runtime/lua/vim/_options.lua433
-rw-r--r--runtime/lua/vim/_system.lua12
-rw-r--r--runtime/lua/vim/_watch.lua304
-rw-r--r--runtime/lua/vim/diagnostic.lua1010
-rw-r--r--runtime/lua/vim/filetype.lua54
-rw-r--r--runtime/lua/vim/filetype/detect.lua78
-rw-r--r--runtime/lua/vim/fs.lua74
-rw-r--r--runtime/lua/vim/glob.lua84
-rw-r--r--runtime/lua/vim/health.lua235
-rw-r--r--runtime/lua/vim/highlight.lua37
-rw-r--r--runtime/lua/vim/iter.lua274
-rw-r--r--runtime/lua/vim/keymap.lua4
-rw-r--r--runtime/lua/vim/loader.lua90
-rw-r--r--runtime/lua/vim/lsp.lua1769
-rw-r--r--runtime/lua/vim/lsp/_changetracking.lua373
-rw-r--r--runtime/lua/vim/lsp/_completion.lua52
-rw-r--r--runtime/lua/vim/lsp/_dynamic.lua31
-rw-r--r--runtime/lua/vim/lsp/_meta.lua10
-rw-r--r--runtime/lua/vim/lsp/_meta/protocol.lua1320
-rw-r--r--runtime/lua/vim/lsp/_tagfunc.lua (renamed from runtime/lua/vim/lsp/tagfunc.lua)0
-rw-r--r--runtime/lua/vim/lsp/_watchfiles.lua118
-rw-r--r--runtime/lua/vim/lsp/buf.lua279
-rw-r--r--runtime/lua/vim/lsp/client.lua1056
-rw-r--r--runtime/lua/vim/lsp/codelens.lua45
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua208
-rw-r--r--runtime/lua/vim/lsp/handlers.lua212
-rw-r--r--runtime/lua/vim/lsp/health.lua46
-rw-r--r--runtime/lua/vim/lsp/inlay_hint.lua72
-rw-r--r--runtime/lua/vim/lsp/log.lua214
-rw-r--r--runtime/lua/vim/lsp/protocol.lua150
-rw-r--r--runtime/lua/vim/lsp/rpc.lua456
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua90
-rw-r--r--runtime/lua/vim/lsp/sync.lua57
-rw-r--r--runtime/lua/vim/lsp/util.lua274
-rw-r--r--runtime/lua/vim/provider.lua7
-rw-r--r--runtime/lua/vim/provider/perl.lua66
-rw-r--r--runtime/lua/vim/provider/python.lua150
-rw-r--r--runtime/lua/vim/provider/ruby.lua61
-rw-r--r--runtime/lua/vim/re.lua1
-rw-r--r--runtime/lua/vim/secure.lua25
-rw-r--r--runtime/lua/vim/shared.lua330
-rw-r--r--runtime/lua/vim/snippet.lua49
-rw-r--r--runtime/lua/vim/termcap.lua59
-rw-r--r--runtime/lua/vim/text.lua2
-rw-r--r--runtime/lua/vim/treesitter.lua164
-rw-r--r--runtime/lua/vim/treesitter/_fold.lua300
-rw-r--r--runtime/lua/vim/treesitter/_meta.lua28
-rw-r--r--runtime/lua/vim/treesitter/_query_linter.lua46
-rw-r--r--runtime/lua/vim/treesitter/dev.lua228
-rw-r--r--runtime/lua/vim/treesitter/health.lua2
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua194
-rw-r--r--runtime/lua/vim/treesitter/language.lua40
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua95
-rw-r--r--runtime/lua/vim/treesitter/query.lua602
-rw-r--r--runtime/lua/vim/ui.lua17
-rw-r--r--runtime/lua/vim/ui/clipboard/osc52.lua4
-rw-r--r--runtime/lua/vim/uri.lua19
-rw-r--r--runtime/lua/vim/version.lua101
-rw-r--r--runtime/lua/vim/vimhelp.lua36
88 files changed, 12605 insertions, 6618 deletions
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua
index dcdfc2b87f..ac15aff60c 100644
--- a/runtime/lua/man.lua
+++ b/runtime/lua/man.lua
@@ -238,7 +238,7 @@ local function get_path(sect, name, silent)
-- If you run man -w strlen and string.3 comes up first, this is a problem. We
-- should search for a matching named one in the results list.
-- However, if you search for man -w clock_gettime, you will *only* get
- -- clock_getres.2, which is the right page. Searching the resuls for
+ -- clock_getres.2, which is the right page. Searching the results for
-- clock_gettime will no longer work. In this case, we should just use the
-- first one that was found in the correct section.
--
diff --git a/runtime/lua/nvim/health.lua b/runtime/lua/nvim/health.lua
index 6b6370fa19..0480e4df4e 100644
--- a/runtime/lua/nvim/health.lua
+++ b/runtime/lua/nvim/health.lua
@@ -17,15 +17,21 @@ local shell_error = function()
return vim.v.shell_error ~= 0
end
-local suggest_faq = 'https://github.com/neovim/neovim/wiki/Building-Neovim#optimized-builds'
+local suggest_faq = 'https://github.com/neovim/neovim/blob/docs/install/BUILD.md#building'
local function check_runtime()
health.start('Runtime')
-- Files from an old installation.
local bad_files = {
+ ['plugin/health.vim'] = false,
+ ['autoload/health/nvim.vim'] = false,
+ ['autoload/health/provider.vim'] = false,
+ ['autoload/man.vim'] = false,
['plugin/man.vim'] = false,
+ ['queries/help/highlights.scm'] = false,
+ ['queries/help/injections.scm'] = false,
['scripts.vim'] = false,
- ['autoload/man.vim'] = false,
+ ['syntax/syncolor.vim'] = false,
}
local bad_files_msg = ''
for k, _ in pairs(bad_files) do
@@ -42,10 +48,10 @@ local function check_runtime()
if not ok then
health.error(
string.format(
- '$VIMRUNTIME has files from an old installation (this can cause weird behavior):\n%s',
+ 'Found old files in $VIMRUNTIME (this can cause weird behavior):\n%s',
bad_files_msg
),
- { 'Delete $VIMRUNTIME (or uninstall Nvim), then reinstall Nvim.' }
+ { 'Delete the $VIMRUNTIME directory (or uninstall Nvim), then reinstall Nvim.' }
)
end
end
@@ -183,10 +189,6 @@ local function check_rplugin_manifest()
health.start('Remote Plugins')
local existing_rplugins = {}
- for _, item in ipairs(vim.fn['remote#host#PluginsForHost']('python')) do
- existing_rplugins[item.path] = 'python'
- end
-
for _, item in ipairs(vim.fn['remote#host#PluginsForHost']('python3')) do
existing_rplugins[item.path] = 'python3'
end
@@ -324,24 +326,17 @@ local function check_tmux()
end
-- check for RGB capabilities
- local info = vim.fn.system({ 'tmux', 'display-message', '-p', '#{client_termfeatures}' })
- info = vim.split(vim.trim(info), ',', { trimempty = true })
- if not vim.list_contains(info, 'RGB') then
- local has_rgb = false
- if #info == 0 then
- -- client_termfeatures may not be supported; fallback to checking show-messages
- info = vim.fn.system({ 'tmux', 'show-messages', '-JT' })
- has_rgb = info:find(' Tc: (flag) true', 1, true) or info:find(' RGB: (flag) true', 1, true)
- end
- if not has_rgb then
- health.warn(
- "Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.",
- {
- "Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:\nset-option -sa terminal-features ',XXX:RGB'",
- "For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'",
- }
- )
- end
+ local info = vim.fn.system({ 'tmux', 'show-messages', '-T' })
+ local has_setrgbb = vim.fn.stridx(info, ' setrgbb: (string)') ~= -1
+ local has_setrgbf = vim.fn.stridx(info, ' setrgbf: (string)') ~= -1
+ if not has_setrgbb or not has_setrgbf then
+ health.warn(
+ "True color support could not be detected. |'termguicolors'| won't work properly.",
+ {
+ "Add the following to your tmux configuration file, replacing XXX by the value of $TERM outside of tmux:\nset-option -a terminal-features 'XXX:RGB'",
+ "For older tmux versions use this instead:\nset-option -a terminal-overrides 'XXX:Tc'",
+ }
+ )
end
end
diff --git a/runtime/lua/provider/clipboard/health.lua b/runtime/lua/provider/clipboard/health.lua
new file mode 100644
index 0000000000..dc33cb0ab0
--- /dev/null
+++ b/runtime/lua/provider/clipboard/health.lua
@@ -0,0 +1,40 @@
+local health = vim.health
+local executable = health.executable
+
+local M = {}
+
+function M.check()
+ health.start('Clipboard (optional)')
+
+ if
+ os.getenv('TMUX')
+ and executable('tmux')
+ and executable('pbpaste')
+ and not health.cmd_ok('pbpaste')
+ then
+ local tmux_version = string.match(vim.fn.system('tmux -V'), '%d+%.%d+')
+ local advice = {
+ 'Install tmux 2.6+. https://superuser.com/q/231130',
+ 'or use tmux with reattach-to-user-namespace. https://superuser.com/a/413233',
+ }
+ health.error('pbcopy does not work with tmux version: ' .. tmux_version, advice)
+ end
+
+ local clipboard_tool = vim.fn['provider#clipboard#Executable']()
+ if vim.g.clipboard ~= nil and clipboard_tool == '' then
+ local error_message = vim.fn['provider#clipboard#Error']()
+ health.error(
+ error_message,
+ "Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."
+ )
+ elseif clipboard_tool:find('^%s*$') then
+ health.warn(
+ 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.',
+ ':help clipboard'
+ )
+ else
+ health.ok('Clipboard tool found: ' .. clipboard_tool)
+ end
+end
+
+return M
diff --git a/runtime/lua/provider/health.lua b/runtime/lua/provider/health.lua
deleted file mode 100644
index d33f74f6e9..0000000000
--- a/runtime/lua/provider/health.lua
+++ /dev/null
@@ -1,916 +0,0 @@
-local M = {}
-
-local start = vim.health.start
-local ok = vim.health.ok
-local info = vim.health.info
-local warn = vim.health.warn
-local error = vim.health.error
-local iswin = vim.uv.os_uname().sysname == 'Windows_NT'
-
-local shell_error_code = 0
-local function shell_error()
- return shell_error_code ~= 0
-end
-
--- Returns true if `cmd` exits with success, else false.
-local function cmd_ok(cmd)
- vim.fn.system(cmd)
- return vim.v.shell_error == 0
-end
-
-local function executable(exe)
- return vim.fn.executable(exe) == 1
-end
-
-local function is_blank(s)
- return s:find('^%s*$') ~= nil
-end
-
-local function isdir(path)
- if not path then
- return false
- end
- local stat = vim.uv.fs_stat(path)
- if not stat then
- return false
- end
- return stat.type == 'directory'
-end
-
-local function isfile(path)
- if not path then
- return false
- end
- local stat = vim.uv.fs_stat(path)
- if not stat then
- return false
- end
- return stat.type == 'file'
-end
-
--- Handler for s:system() function.
-local function system_handler(self, _, data, event)
- if event == 'stderr' then
- if self.add_stderr_to_output then
- self.output = self.output .. vim.fn.join(data, '')
- else
- self.stderr = self.stderr .. vim.fn.join(data, '')
- end
- elseif event == 'stdout' then
- self.output = self.output .. vim.fn.join(data, '')
- elseif event == 'exit' then
- shell_error_code = data
- end
-end
-
--- Attempts to construct a shell command from an args list.
--- Only for display, to help users debug a failed command.
-local function shellify(cmd)
- if type(cmd) ~= 'table' then
- return cmd
- end
- return vim.fn.join(
- vim.fn.map(vim.fn.copy(cmd), [[v:val =~# ''\m[^\-.a-zA-Z_/]'' ? shellescape(v:val) : v:val]]),
- ' '
- )
-end
-
--- Run a system command and timeout after 30 seconds.
-local function system(cmd, ...)
- local args = { ... }
- local args_count = vim.tbl_count(args)
-
- local stdin = (args_count > 0 and args[1] or '')
- local stderr = (args_count > 1 and args[2] or false)
- local ignore_error = (args_count > 2 and args[3] or false)
-
- local opts = {
- add_stderr_to_output = stderr,
- output = '',
- stderr = '',
- on_stdout = system_handler,
- on_stderr = system_handler,
- on_exit = system_handler,
- }
- local jobid = vim.fn.jobstart(cmd, opts)
-
- if jobid < 1 then
- local message = 'Command error (job='
- .. jobid
- .. '): `'
- .. shellify(cmd)
- .. '` (in '
- .. vim.fn.string(vim.fn.getcwd())
- .. ')'
-
- error(message)
- shell_error_code = 1
- return opts.output
- end
-
- if not is_blank(stdin) then
- vim.api.nvim_chan_send(jobid, stdin)
- end
-
- local res = vim.fn.jobwait({ jobid }, 30000)
- if res[1] == -1 then
- error('Command timed out: ' .. shellify(cmd))
- vim.fn.jobstop(jobid)
- elseif shell_error() and not ignore_error then
- local emsg = 'Command error (job='
- .. jobid
- .. ', exit code '
- .. shell_error_code
- .. '): `'
- .. shellify(cmd)
- .. '` (in '
- .. vim.fn.string(vim.fn.getcwd())
- .. ')'
- if not is_blank(opts.output) then
- emsg = emsg .. '\noutput: ' .. opts.output
- end
- if not is_blank(opts.stderr) then
- emsg = emsg .. '\nstderr: ' .. opts.stderr
- end
- error(emsg)
- end
-
- -- return opts.output
- local _ = ...
- return vim.trim(vim.fn.system(cmd))
-end
-
-local function clipboard()
- start('Clipboard (optional)')
-
- if
- os.getenv('TMUX')
- and executable('tmux')
- and executable('pbpaste')
- and not cmd_ok('pbpaste')
- then
- local tmux_version = string.match(vim.fn.system('tmux -V'), '%d+%.%d+')
- local advice = {
- 'Install tmux 2.6+. https://superuser.com/q/231130',
- 'or use tmux with reattach-to-user-namespace. https://superuser.com/a/413233',
- }
- error('pbcopy does not work with tmux version: ' .. tmux_version, advice)
- end
-
- local clipboard_tool = vim.fn['provider#clipboard#Executable']()
- if vim.g.clipboard and is_blank(clipboard_tool) then
- local error_message = vim.fn['provider#clipboard#Error']()
- error(
- error_message,
- "Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."
- )
- elseif is_blank(clipboard_tool) then
- warn(
- 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.',
- ':help clipboard'
- )
- else
- ok('Clipboard tool found: ' .. clipboard_tool)
- end
-end
-
-local function disabled_via_loaded_var(provider)
- local loaded_var = 'loaded_' .. provider .. '_provider'
- local v = vim.g[loaded_var]
- if v == 0 then
- info('Disabled (' .. loaded_var .. '=' .. v .. ').')
- return true
- end
- return false
-end
-
--- Check if pyenv is available and a valid pyenv root can be found, then return
--- their respective paths. If either of those is invalid, return two empty
--- strings, effectively ignoring pyenv.
-local function check_for_pyenv()
- local pyenv_path = vim.fn.resolve(vim.fn.exepath('pyenv'))
-
- if is_blank(pyenv_path) then
- return { '', '' }
- end
-
- info('pyenv: Path: ' .. pyenv_path)
-
- local pyenv_root = os.getenv('PYENV_ROOT') and vim.fn.resolve(os.getenv('PYENV_ROOT')) or ''
-
- if is_blank(pyenv_root) then
- pyenv_root = vim.trim(system({ pyenv_path, 'root' }))
- info('pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.')
- end
-
- if not isdir(pyenv_root) then
- local message = 'pyenv: Root does not exist: '
- .. pyenv_root
- .. '. Ignoring pyenv for all following checks.'
- warn(message)
- return { '', '' }
- end
-
- info('pyenv: Root: ' .. pyenv_root)
-
- return {