Skip to content

Commit

Permalink
feat: modes isn't required field anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
rasulomaroff committed Jan 30, 2024
1 parent 8118983 commit 1203453
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lua/reactive/snapshot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ function M:gen(opts)

Util.iterate_mode_reverse(mode, function(inc_mode, len)
return State:iterate_presets(function(preset)
if not preset.modes then
return
end

if presets_len == vim.tbl_count(dropped_presets) then
-- all presets are dropped, break the loop
return true
Expand Down Expand Up @@ -169,7 +173,7 @@ function M:gen(opts)
self:form_snapshot(preset.name, {
winhl = preset.static.winhl and preset.static.winhl.active,
hl = preset.static.hl,
}, '@static.active', scope[preset.name].constraints)
}, '@static.active', scope[preset.name] and scope[preset.name].constraints or {})
end

if not opts or not opts.callbacks or not preset.modes or dropped_presets[preset.name] then
Expand Down
2 changes: 1 addition & 1 deletion lua/reactive/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function M:add_preset(preset)
if self.presets[preset.name] then
self:update_preset(preset)
else
vim.validate { modes = { preset.modes, 'table' } }
-- vim.validate { modes = { preset.modes, 'table' } }

self:init_preset(preset)
end
Expand Down

0 comments on commit 1203453

Please sign in to comment.