mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-27 19:24:13 +00:00
feat(health): added spec parsing errors to :checkhealth
This commit is contained in:
parent
def5cc5816
commit
32511a1214
3 changed files with 41 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
|||
local Util = require("lazy.util")
|
||||
local Config = require("lazy.core.config")
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
|
||||
local M = {}
|
||||
|
||||
|
@ -48,7 +49,8 @@ function M.check()
|
|||
"cond",
|
||||
"_",
|
||||
}
|
||||
for _, plugin in pairs(Config.plugins) do
|
||||
local spec = Plugin.spec({ show_errors = false })
|
||||
for _, plugin in pairs(spec.plugins) do
|
||||
for key in pairs(plugin) do
|
||||
if not vim.tbl_contains(valid, key) then
|
||||
if key ~= "module" or type(plugin.module) ~= "boolean" then
|
||||
|
@ -57,6 +59,15 @@ function M.check()
|
|||
end
|
||||
end
|
||||
end
|
||||
if #spec.errors > 0 then
|
||||
vim.health.report_error("Errors were reported when loading your specs:")
|
||||
for _, error in ipairs(spec.errors) do
|
||||
local lines = vim.split(error, "\n")
|
||||
for _, line in ipairs(lines) do
|
||||
vim.health.report_error(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue