Skip to content

Commit 84d943c

Browse files
committed
Buf fix
1 parent 94093cd commit 84d943c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

lua/nvim-tree.lua

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,22 @@ local function validate_options(conf)
678678
if def[k] == nil then
679679
-- option does not exist
680680
invalid = string.format("[NvimTree] unknown option: %s%s", prefix, k)
681-
elseif type(v) ~= type(def[k]) and types[k] and not vim.tbl_contains(types[k], type(v)) then
682-
-- option is of the wrong type and is not a function
683-
invalid =
684-
string.format("[NvimTree] invalid option: %s%s expected: %s actual: %s", prefix, k, type(def[k]), type(v))
681+
elseif type(v) ~= type(def[k]) then
682+
local expected
683+
684+
if types[k] and #types[k] > 0 then
685+
if not vim.tbl_contains(types[k], type(v)) then
686+
expected = table.concat(types[k], "|")
687+
end
688+
else
689+
expected = type(def[k])
690+
end
691+
692+
if expected then
693+
-- option is of the wrong type
694+
invalid =
695+
string.format("[NvimTree] Invalid option: %s%s. Expected %s, got %s", prefix, k, expected, type(v))
696+
end
685697
elseif type(v) == "string" and strs[k] and not vim.tbl_contains(strs[k], v) then
686698
-- option has type `string` but value is not accepted
687699
invalid = string.format("[NvimTree] invalid value for field %s%s: '%s'", prefix, k, v)

0 commit comments

Comments
 (0)