From 1c854d7a6d37d7b2ab6926605e7341696c77fd6c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 3 Jan 2023 23:48:00 +0100 Subject: [PATCH] fix(health): check for all packages on the rtp, excluding `dist` packs --- lua/lazy/health.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lua/lazy/health.lua b/lua/lazy/health.lua index a498dcf..7b8fe8a 100644 --- a/lua/lazy/health.lua +++ b/lua/lazy/health.lua @@ -1,4 +1,3 @@ -local Util = require("lazy.util") local Config = require("lazy.core.config") local M = {} @@ -6,11 +5,21 @@ local M = {} function M.check() 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 - Util.ls(vim.fn.stdpath("data") .. "/site/pack/", function(path) - existing = true - vim.health.report_warn("found existing packages at `" .. path .. "`") - end) + for _, site in pairs(sites) do + for _, packs in ipairs(vim.fn.expand(site .. "/pack/*", false, true)) do + if not packs:find("/dist$") and vim.loop.fs_stat(packs) then + existing = true + vim.health.report_warn("found existing packages at `" .. packs .. "`") + end + end + end if not existing then vim.health.report_ok("no existing packages found by other package managers") end