Skip to content

Commit

Permalink
refactor: rename utils validate to validate_config
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaSolOs committed Oct 27, 2024
1 parent e7a4442 commit 88101da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions lua/ibl/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ local validate_config = function(config)
return
end

utils.validate({
utils.validate_config({
enabled = { config.enabled, "boolean", true },
debounce = { config.debounce, "number", true },
viewport_buffer = { config.viewport_buffer, "table", true },
Expand All @@ -121,14 +121,14 @@ local validate_config = function(config)
}, config, "ibl.config")

if config.viewport_buffer then
utils.validate({
utils.validate_config({
min = { config.viewport_buffer.min, "number", true },
max = { config.viewport_buffer.max, "number", true },
}, config.viewport_buffer, "ibl.config.viewport_buffer")
end

if config.indent then
utils.validate({
utils.validate_config({
char = { config.indent.char, { "string", "table" }, true },
tab_char = { config.indent.char, { "string", "table" }, true },
highlight = { config.indent.highlight, { "string", "table" }, true },
Expand Down Expand Up @@ -168,7 +168,7 @@ local validate_config = function(config)
end

if config.whitespace then
utils.validate({
utils.validate_config({
highlight = { config.whitespace.highlight, { "string", "table" }, true },
remove_blankline_trail = { config.whitespace.remove_blankline_trail, "boolean", true },
}, config.whitespace, "ibl.config.whitespace")
Expand All @@ -186,7 +186,7 @@ local validate_config = function(config)
end

if config.scope then
utils.validate({
utils.validate_config({
enabled = { config.scope.enabled, "boolean", true },
char = { config.scope.char, { "string", "table" }, true },
show_start = { config.scope.show_start, "boolean", true },
Expand Down Expand Up @@ -219,21 +219,21 @@ local validate_config = function(config)
}
end
if config.scope.exclude then
utils.validate({
utils.validate_config({
language = { config.scope.exclude.language, "table", true },
node_type = { config.scope.exclude.node_type, "table", true },
}, config.scope.exclude, "ibl.config.scope.exclude")
end
if config.scope.include then
utils.validate({
utils.validate_config({
node_type = { config.scope.include.node_type, "table", true },
}, config.scope.include, "ibl.config.scope.include")
end
end

if config.exclude then
if config.exclude then
utils.validate({
utils.validate_config({
filetypes = { config.exclude.filetypes, "table", true },
buftypes = { config.exclude.buftypes, "table", true },
}, config.exclude, "ibl.config.exclude")
Expand Down
2 changes: 1 addition & 1 deletion lua/ibl/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end
---@param opt table
---@param input table
---@param path string
M.validate = function(opt, input, path)
M.validate_config = function(opt, input, path)
vim.validate(opt)
for key, _ in pairs(input) do
if not opt[key] then
Expand Down

0 comments on commit 88101da

Please sign in to comment.