Skip to content

Commit

Permalink
feat(spec): show spec warnings in checkhealth only
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jan 2, 2023
1 parent d992387 commit bc4133c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ function Spec:log(msg, level)
self.notifs[#self.notifs + 1] = { msg = msg, level = level, file = self.importing }
end

function Spec:report()
function Spec:report(level)
level = level or vim.log.levels.ERROR
for _, notif in ipairs(self.notifs) do
Util.notify(notif.msg, notif.level)
if notif.level >= level then
Util.notify(notif.msg, notif.level)
end
end
end

Expand Down Expand Up @@ -145,6 +148,7 @@ function Spec:import(spec)
end

Cache.indexed_unloaded = false
self.modules[#self.modules + 1] = spec.import

local imported = 0
Util.lsmod(spec.import, function(modname)
Expand All @@ -155,8 +159,7 @@ function Spec:import(spec)
---@diagnostic disable-next-line: no-unknown
package.loaded[modname] = nil
Util.try(function()
self:normalize(Cache.require(modname))
self.modules[#self.modules + 1] = modname
self:normalize(require(modname))
self.importing = nil
Util.track()
end, {
Expand Down Expand Up @@ -198,7 +201,7 @@ function Spec:merge(old, new)
end
else
old[k] = v
self:error("Merging plugins is not supported for key `" .. k .. "`\n" .. vim.inspect({ old = old, new = new }))
self:warn("Overwriting key `" .. k .. "`\n" .. vim.inspect({ old = old, new = new }))
end
else
---@diagnostic disable-next-line: no-unknown
Expand Down Expand Up @@ -295,7 +298,7 @@ function M.find(path)
local slash = name:reverse():find("/", 1, true)
if slash then
name = name:sub(#name - slash + 2)
return name and Config.plugins[name] or nil
return name and Config.spec.plugins[name] or nil
end
end
end
Expand Down

0 comments on commit bc4133c

Please sign in to comment.