aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorphanium <91544758+phanen@users.noreply.github.com>2025-03-16 20:49:05 +0800
committerGitHub <noreply@github.com>2025-03-16 05:49:05 -0700
commitf5dd30948e67b0bfbfe0f1023a9b0c8a0b20b486 (patch)
tree064af071d0dd5de1493e386e7ca3bb98f785105b /runtime/lua/vim
parent7aae3f98de9ff8ee4371318ca223af0f51c5e08d (diff)
downloadrneovim-f5dd30948e67b0bfbfe0f1023a9b0c8a0b20b486.tar.gz
rneovim-f5dd30948e67b0bfbfe0f1023a9b0c8a0b20b486.tar.bz2
rneovim-f5dd30948e67b0bfbfe0f1023a9b0c8a0b20b486.zip
fix(checkhealth): handle nested lua/ directory #32918
Problem: :checkhealth fails if plugin has nested "lua/" directory Solution: trim `{runtimepath}/lua` from fullpath to get subpath (`./**/{health, health/init.lua}`)
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/health.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua
index 0d42e8fed6..75cbfdef4a 100644
--- a/runtime/lua/vim/health.lua
+++ b/runtime/lua/vim/health.lua
@@ -118,7 +118,13 @@ local function filepath_to_healthcheck(path)
func = 'health#' .. name .. '#check'
filetype = 'v'
else
- local subpath = path:gsub('.*/lua/', '')
+ local rtp = vim
+ .iter(vim.api.nvim_list_runtime_paths())
+ :map(vim.fs.normalize)
+ :find(function(rtp0)
+ return vim.fs.relpath(rtp0, path)
+ end)
+ local subpath = path:gsub('^' .. vim.pesc(rtp .. '/lua/'), '')
if vim.fs.basename(subpath) == 'health.lua' then
-- */health.lua
name = vim.fs.dirname(subpath)