Skip to content

Commit

Permalink
perf: dont loop over handlers to determine if a plugin should be opt=…
Browse files Browse the repository at this point in the history
…true
  • Loading branch information
folke committed Nov 29, 2022
1 parent ba8b472 commit 812bb3c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,13 @@ function M.update_state(opts)
plugin._ = plugin._ or {}
plugin[1] = plugin["1"] or plugin[1]
if plugin.opt == nil then
local has_handler = false
for handler, _ in pairs(Handler.handlers) do
if plugin[handler] then
has_handler = true
break
end
end
plugin.opt = plugin.dep or has_handler or Config.options.opt
plugin.opt = plugin.dep
or Config.options.opt
or plugin.module
or plugin.event
or plugin.keys
or plugin.ft
or plugin.cmd
end
local opt = plugin.opt and "opt" or "start"
plugin.dir = Config.options.packpath .. "/" .. opt .. "/" .. plugin.name
Expand Down

0 comments on commit 812bb3c

Please sign in to comment.