Skip to content

Commit

Permalink
fix(ui): use Plugin.find to detect loading reason
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 2, 2022
1 parent 575421b commit 98ccf55
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lua/lazy/view/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 98ccf55

Please sign in to comment.