From 98ccf556d8c1e6a8eadb004620c9d5e95733285a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 2 Dec 2022 09:22:43 +0100 Subject: [PATCH] fix(ui): use Plugin.find to detect loading reason --- lua/lazy/view/render.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lua/lazy/view/render.lua b/lua/lazy/view/render.lua index 27e2886..b76bacf 100644 --- a/lua/lazy/view/render.lua +++ b/lua/lazy/view/render.lua @@ -3,6 +3,7 @@ local Util = require("lazy.util") local Sections = require("lazy.view.sections") local Handler = require("lazy.core.handler") local Git = require("lazy.manage.git") +local Plugin = require("lazy.core.plugin") local Text = require("lazy.view.text") @@ -191,16 +192,12 @@ function M:reason(reason, opts) ---@type string? local source = reason.source if source then - source = vim.loop.fs_realpath(source) or source - for _, other in pairs(Config.plugins) do - if source:find(vim.loop.fs_realpath(other.dir), 1, true) then - reason.plugin = other.name - reason.source = nil - break - end - end - if reason.source then - local config = vim.loop.fs_realpath(vim.fn.stdpath("config")) + local plugin = Plugin.find(source) + if plugin then + reason.plugin = plugin.name + reason.source = nil + else + local config = vim.fn.stdpath("config") if source == config .. "/init.lua" then reason.source = "init.lua" else