Improve path joining in LazyVim.get_pkg_path

This commit is contained in:
TheDSCPL 2025-05-14 02:32:25 +00:00 committed by Iordanis Petkakis
parent 060b7ca704
commit 65306ceff4
2 changed files with 12 additions and 5 deletions

View file

@ -50,7 +50,7 @@ return {
local dap = require("dap") local dap = require("dap")
dap.adapters.php = { dap.adapters.php = {
type = "executable", type = "executable",
command = vim.fn.exepath("php-debug-adapter"), command = "php-debug-adapter",
args = {}, args = {},
} }
end, end,

View file

@ -254,10 +254,17 @@ function M.get_pkg_path(pkg, path, opts)
opts.warn = opts.warn == nil and true or opts.warn opts.warn = opts.warn == nil and true or opts.warn
path = path or "" path = path or ""
local ret = vim.fs.normalize(root .. "/packages/" .. pkg .. "/" .. path) local ret = vim.fs.normalize(root .. "/packages/" .. pkg .. "/" .. path)
if opts.warn and not vim.loop.fs_stat(ret) and not require("lazy.core.config").headless() then if opts.warn then
M.warn( vim.schedule(function()
("Mason package path not found for **%s**:\n- `%s`\nYou may need to force update the package."):format(pkg, path) if not require("lazy.core.config").headless() and not vim.loop.fs_stat(ret) then
) M.warn(
("Mason package path not found for **%s**:\n- `%s`\nYou may need to force update the package."):format(
pkg,
path
)
)
end
end)
end end
return ret return ret
end end