Skip to content

Commit 656d3d1

Browse files
committed
feat: show rockspec deps in plugin details
1 parent 0f45c0d commit 656d3d1

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

lua/lazy/pkg/rockspec.lua

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
--# selene:allow(incorrect_standard_library_use)
2-
3-
local Util = require("lazy.core.util")
2+
local Config = require("lazy.core.config")
3+
local Util = require("lazy.util")
44

55
local M = {}
66

77
M.dev_suffix = "-1.rockspec"
88
M.skip = { "lua" }
99

10+
---@param plugin LazyPlugin
11+
function M.deps(plugin)
12+
local root = Config.options.rocks.root .. "/" .. plugin.name
13+
local manifest_file = root .. "/lib/luarocks/rocks-5.1/manifest"
14+
local manifest = {}
15+
local ok = pcall(function()
16+
local load, err = loadfile(manifest_file, "t", manifest)
17+
if not load then
18+
error(err)
19+
end
20+
load()
21+
end)
22+
return manifest and vim.tbl_keys(manifest.repository or {})
23+
end
24+
1025
---@class RockSpec
1126
---@field rockspec_format string
1227
---@field package string

lua/lazy/view/render.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,11 @@ function M:details(plugin)
511511
table.insert(props, { "commit", git.commit:sub(1, 7), "LazyCommit" })
512512
end
513513
end
514+
local rocks = require("lazy.pkg.rockspec").deps(plugin)
515+
if not vim.tbl_isempty(rocks) then
516+
table.insert(props, { "rocks", vim.inspect(rocks) })
517+
end
518+
514519
if Util.file_exists(plugin.dir .. "/README.md") then
515520
table.insert(props, { "readme", "README.md" })
516521
end

0 commit comments

Comments
 (0)