diff options
| author | Luke Kershaw <35707277+l-kershaw@users.noreply.github.com> | 2021-07-02 07:50:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-02 08:50:55 +0200 |
| commit | 50001d4965af3c95614b1423ab6d130068319cd9 (patch) | |
| tree | 9120d114b4713259ba9ab10a70261a98fe9c0b3f /lua/telescope/config.lua | |
| parent | 5a53ec5c2fdab10ca8775d3979b1a85e63d57953 (diff) | |
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
Diffstat (limited to 'lua/telescope/config.lua')
| -rw-r--r-- | lua/telescope/config.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua index aecfcc6..847f067 100644 --- a/lua/telescope/config.lua +++ b/lua/telescope/config.lua @@ -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 = {} |
