feat(extras): allow recommended to be the args for LazyVim.extras.wants
This commit is contained in:
@ -37,7 +37,9 @@ M.ns = vim.api.nvim_create_namespace("lazyvim.extras")
|
|||||||
---@type string[]
|
---@type string[]
|
||||||
M.state = nil
|
M.state = nil
|
||||||
|
|
||||||
---@param opts {ft?: string|string[], root?: string|string[]}
|
---@alias WantsOpts {ft?: string|string[], root?: string|string[]}
|
||||||
|
|
||||||
|
---@param opts WantsOpts
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function M.wants(opts)
|
function M.wants(opts)
|
||||||
if opts.ft then
|
if opts.ft then
|
||||||
@ -105,10 +107,12 @@ function M.get_extra(source, modname)
|
|||||||
table.sort(plugins)
|
table.sort(plugins)
|
||||||
table.sort(optional)
|
table.sort(optional)
|
||||||
|
|
||||||
---@type boolean|(fun():boolean?)|nil
|
---@type boolean|(fun():boolean?)|nil|WantsOpts
|
||||||
local recommended = require(modname).recommended or false
|
local recommended = require(modname).recommended or false
|
||||||
if type(recommended) == "function" then
|
if type(recommended) == "function" then
|
||||||
recommended = recommended() or false
|
recommended = recommended() or false
|
||||||
|
elseif type(recommended) == "table" then
|
||||||
|
recommended = M.wants(recommended)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type LazyExtra
|
---@type LazyExtra
|
||||||
|
@ -21,6 +21,7 @@ local plugins = {
|
|||||||
{ "folke/lazy.nvim" },
|
{ "folke/lazy.nvim" },
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
}
|
}
|
||||||
|
|
||||||
local function main()
|
local function main()
|
||||||
|
Reference in New Issue
Block a user