@@ -45,7 +45,10 @@ function Spec:add(plugin, results, is_dep)
45
45
-- check if we already processed this spec. Can happen when a user uses the same instance of a spec in multiple specs
46
46
-- see https://github.com/folke/lazy.nvim/issues/45
47
47
if plugin ._ then
48
- return results and table.insert (results , plugin .name )
48
+ if results then
49
+ table.insert (results , plugin .name )
50
+ end
51
+ return plugin
49
52
end
50
53
51
54
if not plugin .url and plugin [1 ] then
@@ -76,6 +79,7 @@ function Spec:add(plugin, results, is_dep)
76
79
end
77
80
else
78
81
self :error (" Invalid plugin spec " .. vim .inspect (plugin ))
82
+ return
79
83
end
80
84
81
85
plugin .event = type (plugin .event ) == " string" and { plugin .event } or plugin .event
@@ -91,7 +95,10 @@ function Spec:add(plugin, results, is_dep)
91
95
plugin = self :merge (self .plugins [plugin .name ], plugin )
92
96
end
93
97
self .plugins [plugin .name ] = plugin
94
- return results and table.insert (results , plugin .name )
98
+ if results then
99
+ table.insert (results , plugin .name )
100
+ end
101
+ return plugin
95
102
end
96
103
97
104
function Spec :error (msg )
@@ -182,12 +189,19 @@ function Spec:normalize(spec, results, is_dep)
182
189
for _ , s in ipairs (spec ) do
183
190
self :normalize (s , results , is_dep )
184
191
end
192
+ elseif spec [1 ] or spec .dir or spec .url then
193
+ --- @cast spec LazyPlugin
194
+ local plugin = self :add (spec , results , is_dep )
195
+ --- @diagnostic disable-next-line : cast-type-mismatch
196
+ --- @cast plugin LazySpecImport
197
+ if plugin and plugin .import then
198
+ self :import (plugin )
199
+ end
185
200
elseif spec .import then
186
201
--- @cast spec LazySpecImport
187
202
self :import (spec )
188
203
else
189
- --- @cast spec LazyPlugin
190
- self :add (spec , results , is_dep )
204
+ self :error (" Invalid plugin spec " .. vim .inspect (spec ))
191
205
end
192
206
return results
193
207
end
0 commit comments