aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Majewski <metiulekm@gmail.com>2023-02-06 05:24:00 +0100
committerGitHub <noreply@github.com>2023-02-06 12:24:00 +0800
commit6c39edaa7e5060cedfbbf61e88f4aad20fdff73d (patch)
treefbb2bfc32f0cdd9cf9a56b4a4793546b3fb5ca3b
parent228684d2fbb6262f761b2b5d7001033bd69880c1 (diff)
downloadrneovim-6c39edaa7e5060cedfbbf61e88f4aad20fdff73d.tar.gz
rneovim-6c39edaa7e5060cedfbbf61e88f4aad20fdff73d.tar.bz2
rneovim-6c39edaa7e5060cedfbbf61e88f4aad20fdff73d.zip
fix(health): iterate using ipairs correctly (#22119)
In a few places ipairs was used to iterate over elements of the array. However, the first return value of ipairs was erronously used, which is not the value, but rather the index. This would result in errors, for instance when trying to retrieve a field from the value.
-rw-r--r--runtime/lua/nvim/health.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/lua/nvim/health.lua b/runtime/lua/nvim/health.lua
index f11899434e..b6d84404ec 100644
--- a/runtime/lua/nvim/health.lua
+++ b/runtime/lua/nvim/health.lua
@@ -183,7 +183,7 @@ local function check_rplugin_manifest()
existing_rplugins[item.path] = 'python'
end
- for item in ipairs(vim.fn['remote#host#PluginsForHost']('python3')) do
+ for _, item in ipairs(vim.fn['remote#host#PluginsForHost']('python3')) do
existing_rplugins[item.path] = 'python3'
end
@@ -200,7 +200,7 @@ local function check_rplugin_manifest()
local scripts = vim.fn.glob(python_dir .. '/*.py', true, true)
vim.list_extend(scripts, vim.fn.glob(python_dir .. '/*/__init__.py', true, true))
- for script in ipairs(scripts) do
+ for _, script in ipairs(scripts) do
local contents = vim.fn.join(vim.fn.readfile(script))
if vim.regex([[\<\%(from\|import\)\s\+neovim\>]]):match_str(contents) then
if vim.regex([[[\/]__init__\.py$]]):match_str(script) then
@@ -384,7 +384,13 @@ local function check_terminal()
)
end
- for env_var in ipairs({ 'XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY' }) do
+ for _, env_var in ipairs({
+ 'XTERM_VERSION',
+ 'VTE_VERSION',
+ 'TERM_PROGRAM',
+ 'COLORTERM',
+ 'SSH_TTY',
+ }) do
if vim.env[env_var] then
health.report_info(vim.fn.printf('$%s="%s"', env_var, vim.env[env_var]))
end