File tree 2 files changed +26
-7
lines changed
2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 93
93
--- @return boolean
94
94
local function is_lazy (spec )
95
95
--- @diagnostic disable-next-line : undefined-field
96
- return spec .lazy
97
- or vim .iter (handlers ):any (function (spec_field , _ )
98
- -- PERF: This should be simpler and more performant than
99
- -- filtering out "lazy" spec fields. However, this also
100
- -- assumes that 'false' means a handler is disabled.
101
- return spec [spec_field ] and spec [spec_field ] ~= nil
102
- end )
96
+ if spec .lazy ~= nil then
97
+ --- @diagnostic disable-next-line : undefined-field
98
+ return spec .lazy
99
+ end
100
+ return vim .iter (handlers ):any (function (spec_field , _ )
101
+ -- PERF: This should be simpler and more performant than
102
+ -- filtering out "lazy" spec fields. However, this also
103
+ -- assumes that 'false' means a handler is disabled.
104
+ return spec [spec_field ] and spec [spec_field ] ~= nil
105
+ end )
103
106
end
104
107
105
108
--- Mutates the `plugin`.
Original file line number Diff line number Diff line change @@ -96,5 +96,21 @@ describe("lz.n", function()
96
96
cmd = { " Single" },
97
97
})
98
98
end )
99
+ it (" eagerly load if lazy=False" , function ()
100
+ local spy_load = spy .on (loader , " _load" )
101
+ lz .load ({
102
+ {
103
+ " single.nvim" ,
104
+ cmd = " Single" ,
105
+ lazy = false ,
106
+ },
107
+ })
108
+ assert .spy (spy_load ).called (1 )
109
+ assert .spy (spy_load ).called_with ({
110
+ name = " single.nvim" ,
111
+ cmd = { " Single" },
112
+ lazy = false ,
113
+ })
114
+ end )
99
115
end )
100
116
end )
You can’t perform that action at this time.
0 commit comments