mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 08:53:33 +02:00
fix(extras): better reasons as to why some extras are included in your config.
This commit is contained in:
parent
6efbdabd1b
commit
eeccbbc407
4 changed files with 45 additions and 5 deletions
|
@ -26,4 +26,13 @@ return {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {},
|
dependencies = {},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- dummy import to save core imports
|
||||||
|
{
|
||||||
|
import = "foobar",
|
||||||
|
enabled = function()
|
||||||
|
LazyVim.plugin.save_core()
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,9 @@ local v = version.major .. "_" .. version.minor
|
||||||
|
|
||||||
local compat = { "0_9" }
|
local compat = { "0_9" }
|
||||||
|
|
||||||
|
LazyVim.plugin.save_core()
|
||||||
if vim.tbl_contains(compat, v) then
|
if vim.tbl_contains(compat, v) then
|
||||||
extras[#extras + 1] = "lazyvim.plugins.compat.nvim-" .. v
|
table.insert(extras, 1, "lazyvim.plugins.compat.nvim-" .. v)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.sort(extras, function(a, b)
|
table.sort(extras, function(a, b)
|
||||||
|
|
|
@ -250,10 +250,30 @@ end
|
||||||
---@param extra LazyExtra
|
---@param extra LazyExtra
|
||||||
function X:extra(extra)
|
function X:extra(extra)
|
||||||
if not extra.managed then
|
if not extra.managed then
|
||||||
self:diagnostic({
|
---@type LazyExtra[]
|
||||||
message = "Not managed by LazyExtras (config)",
|
local parents = {}
|
||||||
severity = vim.diagnostic.severity.WARN,
|
for _, x in ipairs(self.extras) do
|
||||||
})
|
if x.enabled and vim.tbl_contains(x.imports, extra.module) then
|
||||||
|
parents[#parents + 1] = x
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #parents > 0 then
|
||||||
|
local pp = vim.tbl_map(function(x)
|
||||||
|
return x.name
|
||||||
|
end, parents)
|
||||||
|
self:diagnostic({
|
||||||
|
message = "Required by " .. table.concat(pp, ", "),
|
||||||
|
})
|
||||||
|
elseif vim.tbl_contains(LazyVim.plugin.core_imports, extra.module) then
|
||||||
|
self:diagnostic({
|
||||||
|
message = "This extra is included by default",
|
||||||
|
})
|
||||||
|
else
|
||||||
|
self:diagnostic({
|
||||||
|
message = "Not managed by LazyExtras (config)",
|
||||||
|
severity = vim.diagnostic.severity.WARN,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
extra.row = self.text:row()
|
extra.row = self.text:row()
|
||||||
local hl = extra.managed and "LazySpecial" or "LazyLocal"
|
local hl = extra.managed and "LazySpecial" or "LazyLocal"
|
||||||
|
|
|
@ -3,6 +3,9 @@ local Plugin = require("lazy.core.plugin")
|
||||||
---@class lazyvim.util.plugin
|
---@class lazyvim.util.plugin
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
---@type string[]
|
||||||
|
M.core_imports = {}
|
||||||
|
|
||||||
M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" }
|
M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" }
|
||||||
|
|
||||||
---@type table<string, string>
|
---@type table<string, string>
|
||||||
|
@ -32,6 +35,13 @@ M.renames = {
|
||||||
["glepnir/dashboard-nvim"] = "nvimdev/dashboard-nvim",
|
["glepnir/dashboard-nvim"] = "nvimdev/dashboard-nvim",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function M.save_core()
|
||||||
|
if vim.v.vim_did_enter == 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
M.core_imports = vim.deepcopy(require("lazy.core.config").spec.modules)
|
||||||
|
end
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
M.fix_imports()
|
M.fix_imports()
|
||||||
M.fix_renames()
|
M.fix_renames()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue