Skip to content

Commit

Permalink
fix(config): do not warn about keys that are nil by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jedrzejboczar committed Nov 11, 2023
1 parent be97aa0 commit 51fff4d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/possession/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ end

local config = defaults()

-- Keys that cannot be checked automatically because they are nil by default
local nil_keys = {
['telescope.previewer'] = true,
}

local function warn_on_unknown_keys(conf)
local unknown = {}

Expand All @@ -97,7 +102,10 @@ local function warn_on_unknown_keys(conf)
-- ignore list-like tables
if type(key) == 'string' then
if ref == nil or ref[key] == nil then
table.insert(unknown, state.path .. key)
local path = state.path .. key
if ref[key] == nil and not nil_keys[path] then
table.insert(unknown, path)
end
elseif type(val) == 'table' then
traverse(val, ref[key], {
path = state.path .. key .. '.',
Expand Down

0 comments on commit 51fff4d

Please sign in to comment.