Skip to content

Commit bc4133c

Browse files
committed
feat(spec): show spec warnings in checkhealth only
1 parent d992387 commit bc4133c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lua/lazy/core/plugin.lua

+9-6
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ function Spec:log(msg, level)
9393
self.notifs[#self.notifs + 1] = { msg = msg, level = level, file = self.importing }
9494
end
9595

96-
function Spec:report()
96+
function Spec:report(level)
97+
level = level or vim.log.levels.ERROR
9798
for _, notif in ipairs(self.notifs) do
98-
Util.notify(notif.msg, notif.level)
99+
if notif.level >= level then
100+
Util.notify(notif.msg, notif.level)
101+
end
99102
end
100103
end
101104

@@ -145,6 +148,7 @@ function Spec:import(spec)
145148
end
146149

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

149153
local imported = 0
150154
Util.lsmod(spec.import, function(modname)
@@ -155,8 +159,7 @@ function Spec:import(spec)
155159
---@diagnostic disable-next-line: no-unknown
156160
package.loaded[modname] = nil
157161
Util.try(function()
158-
self:normalize(Cache.require(modname))
159-
self.modules[#self.modules + 1] = modname
162+
self:normalize(require(modname))
160163
self.importing = nil
161164
Util.track()
162165
end, {
@@ -198,7 +201,7 @@ function Spec:merge(old, new)
198201
end
199202
else
200203
old[k] = v
201-
self:error("Merging plugins is not supported for key `" .. k .. "`\n" .. vim.inspect({ old = old, new = new }))
204+
self:warn("Overwriting key `" .. k .. "`\n" .. vim.inspect({ old = old, new = new }))
202205
end
203206
else
204207
---@diagnostic disable-next-line: no-unknown
@@ -295,7 +298,7 @@ function M.find(path)
295298
local slash = name:reverse():find("/", 1, true)
296299
if slash then
297300
name = name:sub(#name - slash + 2)
298-
return name and Config.plugins[name] or nil
301+
return name and Config.spec.plugins[name] or nil
299302
end
300303
end
301304
end

0 commit comments

Comments
 (0)