fix: table number option extend (#947)

* fix: prevent error when overriding tables with numbers

Fixes #944

- refactor `config.smarter_depth_2_extend`

- use `config.smarter_depth_2_extend` for setting `layout_config` in `Picker:new`

* test: check that can override a table with a number for layout configuration
This commit is contained in:
Luke Kershaw
2021-07-02 07:50:55 +01:00
committed by GitHub
parent 5a53ec5c2f
commit 50001d4965
3 changed files with 19 additions and 2 deletions

View File

@@ -35,7 +35,13 @@ local smarter_depth_2_extend = function(priority, base)
end
end
end
result = vim.tbl_deep_extend("keep", priority, result)
for key, val in pairs(priority) do
if type(val) ~= "table" then
result[key] = first_non_null(val,result[key])
else
result[key] = vim.tbl_extend("keep",val,result[key] or {})
end
end
return result
end
@@ -43,6 +49,7 @@ end
-- selection_strategy
local config = {}
config.smarter_depth_2_extend = smarter_depth_2_extend
config.values = _TelescopeConfigurationValues
config.descriptions = {}