fix(ui): use Plugin.find to detect loading reason

This commit is contained in:
Folke Lemaitre 2022-12-02 09:22:43 +01:00
parent 575421b3fb
commit 98ccf556d8
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 7 additions and 10 deletions

View File

@ -3,6 +3,7 @@ local Util = require("lazy.util")
local Sections = require("lazy.view.sections") local Sections = require("lazy.view.sections")
local Handler = require("lazy.core.handler") local Handler = require("lazy.core.handler")
local Git = require("lazy.manage.git") local Git = require("lazy.manage.git")
local Plugin = require("lazy.core.plugin")
local Text = require("lazy.view.text") local Text = require("lazy.view.text")
@ -191,16 +192,12 @@ function M:reason(reason, opts)
---@type string? ---@type string?
local source = reason.source local source = reason.source
if source then if source then
source = vim.loop.fs_realpath(source) or source local plugin = Plugin.find(source)
for _, other in pairs(Config.plugins) do if plugin then
if source:find(vim.loop.fs_realpath(other.dir), 1, true) then reason.plugin = plugin.name
reason.plugin = other.name
reason.source = nil reason.source = nil
break else
end local config = vim.fn.stdpath("config")
end
if reason.source then
local config = vim.loop.fs_realpath(vim.fn.stdpath("config"))
if source == config .. "/init.lua" then if source == config .. "/init.lua" then
reason.source = "init.lua" reason.source = "init.lua"
else else