mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-02 21:44:37 +02:00
feat(extras): show extras imported in other extras
This commit is contained in:
parent
45b92aa381
commit
b2858a297a
1 changed files with 16 additions and 1 deletions
|
@ -17,6 +17,7 @@ local Text = require("lazy.view.text")
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
---@field managed boolean
|
---@field managed boolean
|
||||||
---@field recommended? boolean
|
---@field recommended? boolean
|
||||||
|
---@field imports string[]
|
||||||
---@field row? number
|
---@field row? number
|
||||||
---@field section? string
|
---@field section? string
|
||||||
---@field plugins string[]
|
---@field plugins string[]
|
||||||
|
@ -82,7 +83,16 @@ end
|
||||||
---@param source LazyExtraSource
|
---@param source LazyExtraSource
|
||||||
function M.get_extra(source, modname)
|
function M.get_extra(source, modname)
|
||||||
local enabled = vim.tbl_contains(M.state, modname)
|
local enabled = vim.tbl_contains(M.state, modname)
|
||||||
local spec = Plugin.Spec.new({ import = modname }, { optional = true })
|
local spec = Plugin.Spec.new(nil, { optional = true })
|
||||||
|
spec:parse({ import = modname })
|
||||||
|
local imports = vim.tbl_filter(function(x)
|
||||||
|
return x ~= modname
|
||||||
|
end, spec.modules)
|
||||||
|
if #imports > 0 then
|
||||||
|
spec = Plugin.Spec.new(nil, { optional = true })
|
||||||
|
spec.modules = vim.deepcopy(imports)
|
||||||
|
spec:parse({ import = modname })
|
||||||
|
end
|
||||||
local plugins = {} ---@type string[]
|
local plugins = {} ---@type string[]
|
||||||
local optional = {} ---@type string[]
|
local optional = {} ---@type string[]
|
||||||
for _, p in pairs(spec.plugins) do
|
for _, p in pairs(spec.plugins) do
|
||||||
|
@ -107,6 +117,7 @@ function M.get_extra(source, modname)
|
||||||
name = modname:sub(#source.module + 2),
|
name = modname:sub(#source.module + 2),
|
||||||
module = modname,
|
module = modname,
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
|
imports = imports,
|
||||||
desc = require(modname).desc,
|
desc = require(modname).desc,
|
||||||
recommended = recommended,
|
recommended = recommended,
|
||||||
managed = vim.tbl_contains(Config.json.data.extras, modname) or not enabled,
|
managed = vim.tbl_contains(Config.json.data.extras, modname) or not enabled,
|
||||||
|
@ -254,6 +265,10 @@ function X:extra(extra)
|
||||||
if extra.source.name ~= "LazyVim" then
|
if extra.source.name ~= "LazyVim" then
|
||||||
self.text:append(" "):append(LazyConfig.options.ui.icons.event .. " " .. extra.source.name, "LazyReasonEvent")
|
self.text:append(" "):append(LazyConfig.options.ui.icons.event .. " " .. extra.source.name, "LazyReasonEvent")
|
||||||
end
|
end
|
||||||
|
for _, import in ipairs(extra.imports) do
|
||||||
|
import = import:gsub("^lazyvim.plugins.extras.", "")
|
||||||
|
self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. import, "LazyReasonStart")
|
||||||
|
end
|
||||||
for _, plugin in ipairs(extra.plugins) do
|
for _, plugin in ipairs(extra.plugins) do
|
||||||
self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonPlugin")
|
self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonPlugin")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue