From 8a14f24ccabd1300618863ca1a6bd2f7e0d1b8e6 Mon Sep 17 00:00:00 2001 From: James Trew Date: Wed, 24 Jan 2024 22:22:50 -0500 Subject: [PATCH] fix(layout_strat): only validate strategy specific config values --- lua/telescope/pickers/layout_strategies.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/telescope/pickers/layout_strategies.lua b/lua/telescope/pickers/layout_strategies.lua index 32c68cb..a6f16c1 100644 --- a/lua/telescope/pickers/layout_strategies.lua +++ b/lua/telescope/pickers/layout_strategies.lua @@ -113,11 +113,11 @@ local adjust_pos = function(pos, ...) end end ---@param strategy_name string: the name of the layout_strategy we are validating for ---@param configuration table: table with keys for each option available ---@param values table: table containing all of the non-default options we want to set ---@param default_layout_config table: table with the default values to configure layouts ---@return table: table containing the combined options (defaults and non-defaults) +---@param strategy_name string: the name of the layout_strategy we are validating for +---@param configuration table: table with keys for each option available +---@param values table: table containing all of the non-default options we want to set +---@param default_layout_config table: table with the default values to configure layouts +---@return table: table containing the combined options (defaults and non-defaults) local function validate_layout_config(strategy_name, configuration, values, default_layout_config) assert(strategy_name, "It is required to have a strategy name for validation.") local valid_configuration_keys = get_valid_configuration_keys(configuration) @@ -159,7 +159,7 @@ local function validate_layout_config(strategy_name, configuration, values, defa end -- Always set the values passed first. - for k in pairs(values) do + for k in pairs(values[strategy_name]) do if not valid_configuration_keys[k] then -- TODO: At some point we'll move to error here, -- but it's a bit annoying to just straight up crash everyone's stuff.