|
42 | 42 | function Spec:parse(spec)
|
43 | 43 | self:normalize(spec)
|
44 | 44 | self:fix_disabled()
|
45 |
| - |
46 |
| - -- calculate handlers |
47 |
| - for _, plugin in pairs(self.plugins) do |
48 |
| - for _, handler in pairs(Handler.types) do |
49 |
| - if plugin[handler] then |
50 |
| - plugin[handler] = M.values(plugin, handler, true) |
51 |
| - end |
52 |
| - end |
53 |
| - end |
54 | 45 | end
|
55 | 46 |
|
56 | 47 | -- PERF: optimized code to get package name without using lua patterns
|
|
609 | 600 | ---@param prop string
|
610 | 601 | ---@param is_list? boolean
|
611 | 602 | function M.values(plugin, prop, is_list)
|
| 603 | + if not plugin[prop] then |
| 604 | + return {} |
| 605 | + end |
| 606 | + plugin._.values = plugin._.values or {} |
| 607 | + local key = prop .. (is_list and "_list" or "") |
| 608 | + if plugin._.values[key] == nil then |
| 609 | + plugin[prop] = M._values(plugin, prop, is_list) |
| 610 | + plugin._.values[key] = true |
| 611 | + end |
| 612 | + return plugin[prop] or {} |
| 613 | +end |
| 614 | + |
| 615 | +-- Merges super values or runs the values function to override values or return new ones |
| 616 | +-- Used for opts, cmd, event, ft and keys |
| 617 | +---@param plugin LazyPlugin |
| 618 | +---@param prop string |
| 619 | +---@param is_list? boolean |
| 620 | +function M._values(plugin, prop, is_list) |
612 | 621 | ---@type table
|
613 |
| - local ret = plugin._.super and M.values(plugin._.super, prop, is_list) or {} |
| 622 | + local ret = plugin._.super and M._values(plugin._.super, prop, is_list) or {} |
614 | 623 | local values = rawget(plugin, prop)
|
615 | 624 |
|
616 | 625 | if not values then
|
|
0 commit comments