fix(picker.help): make sure plugin is loaded for which we want to view the help

This commit is contained in:
Folke Lemaitre 2025-02-10 14:56:48 +01:00
parent ffdbcd6a88
commit 3841a8705a
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -519,6 +519,14 @@ function M.help(picker, item, action)
---@cast action snacks.picker.jump.Action
if item then
picker:close()
local file = Snacks.picker.util.path(item) or ""
if package.loaded.lazy then
local plugin = file:match("/([^/]+)/doc/")
if plugin then
require("lazy").load({ plugins = { plugin } })
end
end
local cmd = "help " .. item.text
if action.cmd == "vsplit" then
cmd = "vert " .. cmd