2022-12-05 20:31:26 +00:00
|
|
|
local Util = require("lazy.util")
|
|
|
|
local Config = require("lazy.core.config")
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
function M.check()
|
|
|
|
vim.health.report_start("lazy.nvim")
|
|
|
|
|
|
|
|
local existing = false
|
|
|
|
Util.ls(vim.fn.stdpath("data") .. "/site/pack/", function(path)
|
|
|
|
existing = true
|
|
|
|
vim.health.report_warn("found existing packages at `" .. path .. "`")
|
|
|
|
end)
|
|
|
|
if not existing then
|
|
|
|
vim.health.report_ok("no existing packages found by other package managers")
|
|
|
|
end
|
|
|
|
|
|
|
|
local packer_compiled = vim.fn.stdpath("config") .. "/plugin/packer_compiled.lua"
|
|
|
|
if vim.loop.fs_stat(packer_compiled) then
|
|
|
|
vim.health.report_error("please remove the file `" .. packer_compiled .. "`")
|
|
|
|
else
|
|
|
|
vim.health.report_ok("packer_compiled.lua not found")
|
|
|
|
end
|
|
|
|
|
|
|
|
local valid = {
|
|
|
|
1,
|
|
|
|
"name",
|
2022-12-06 10:12:54 +00:00
|
|
|
"url",
|
2022-12-05 20:31:26 +00:00
|
|
|
"enabled",
|
|
|
|
"lazy",
|
|
|
|
"dev",
|
|
|
|
"dependencies",
|
|
|
|
"init",
|
|
|
|
"config",
|
|
|
|
"build",
|
|
|
|
"branch",
|
|
|
|
"tag",
|
|
|
|
"commit",
|
|
|
|
"version",
|
2022-12-21 15:07:49 +00:00
|
|
|
"module",
|
2022-12-05 20:31:26 +00:00
|
|
|
"pin",
|
|
|
|
"cmd",
|
|
|
|
"event",
|
|
|
|
"keys",
|
|
|
|
"ft",
|
|
|
|
"dir",
|
2022-12-27 23:03:09 +00:00
|
|
|
"priority",
|
2022-12-28 16:39:51 +00:00
|
|
|
"cond",
|
2022-12-05 20:31:26 +00:00
|
|
|
"_",
|
|
|
|
}
|
2023-01-01 20:09:02 +00:00
|
|
|
local spec = Config.parsed
|
2022-12-30 10:52:09 +00:00
|
|
|
for _, plugin in pairs(spec.plugins) do
|
2022-12-05 20:31:26 +00:00
|
|
|
for key in pairs(plugin) do
|
|
|
|
if not vim.tbl_contains(valid, key) then
|
2022-12-21 15:07:49 +00:00
|
|
|
if key ~= "module" or type(plugin.module) ~= "boolean" then
|
|
|
|
vim.health.report_warn("{" .. plugin.name .. "}: unknown key <" .. key .. ">")
|
|
|
|
end
|
2022-12-05 20:31:26 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-12-30 10:52:09 +00:00
|
|
|
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
|
2022-12-05 20:31:26 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|