fix(health): check for all packages on the rtp, excluding `dist` packs

This commit is contained in:
Folke Lemaitre 2023-01-03 23:48:00 +01:00
parent c85f929bd9
commit 1c854d7a6d
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 14 additions and 5 deletions

View File

@ -1,4 +1,3 @@
local Util = require("lazy.util")
local Config = require("lazy.core.config") local Config = require("lazy.core.config")
local M = {} local M = {}
@ -6,11 +5,21 @@ local M = {}
function M.check() function M.check()
vim.health.report_start("lazy.nvim") vim.health.report_start("lazy.nvim")
local sites = vim.opt.packpath:get()
local default_site = vim.fn.stdpath("data") .. "/site"
if not vim.tbl_contains(sites, default_site) then
sites[#sites + 1] = default_site
end
local existing = false local existing = false
Util.ls(vim.fn.stdpath("data") .. "/site/pack/", function(path) for _, site in pairs(sites) do
existing = true for _, packs in ipairs(vim.fn.expand(site .. "/pack/*", false, true)) do
vim.health.report_warn("found existing packages at `" .. path .. "`") if not packs:find("/dist$") and vim.loop.fs_stat(packs) then
end) existing = true
vim.health.report_warn("found existing packages at `" .. packs .. "`")
end
end
end
if not existing then if not existing then
vim.health.report_ok("no existing packages found by other package managers") vim.health.report_ok("no existing packages found by other package managers")
end end