Skip to content

Commit

Permalink
feat: Only try to get value if there is a value
Browse files Browse the repository at this point in the history
This commit ultimately allows the user to set an object type to `false`
in their object_count_opts configuration to prevent it from being
counted.
  • Loading branch information
jakewvincent committed Jun 19, 2024
1 parent 61c3170 commit 1b0e415
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lua/mkdnflow/foldtext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,12 @@ local count_objects = function(lines)
}
local icons = {}
for k, v in pairs(object_count_opts) do
-- Get the tally method
tally_methods[v.count_method.tally][k] = v.count_method
-- Get just the icon
icons[k] = v.icon
if v then
-- Get the tally method
tally_methods[v.count_method.tally][k] = v.count_method
-- Get just the icon
icons[k] = v.icon
end
end
-- Iterate over lines for blocks and line objects
local block_objects, object_counts = {}, {}
Expand Down

0 comments on commit 1b0e415

Please sign in to comment.