diff options
author | Christian Clason <c.clason@uni-graz.at> | 2024-09-08 18:23:46 +0200 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2024-09-08 21:06:13 +0200 |
commit | 3a881132460430d23f2fdc87822c87d47f721cfc (patch) | |
tree | de8abf80bbea46c7400cde8e84a828e127b312e0 /runtime/doc/lua.txt | |
parent | 08153ddd1c149c867948f4681846531d53ba7759 (diff) | |
download | rneovim-3a881132460430d23f2fdc87822c87d47f721cfc.tar.gz rneovim-3a881132460430d23f2fdc87822c87d47f721cfc.tar.bz2 rneovim-3a881132460430d23f2fdc87822c87d47f721cfc.zip |
fix(lua): revert vim.tbl_extend behavior change and document it
Problem: vim.tbl_deep_extend had an undocumented feature where arrays
(integer-indexed tables) were not merged but compared literally (used
for merging default and user config, where one list should overwrite the
other completely). Turns out this behavior was relied on in quite a
number of plugins (even though it wasn't a robust solution even for that
use case, since lists of tables (e.g., plugin specs) can be array-like
as well).
Solution: Revert the removal of this special feature. Check for
list-like (contiguous integer indices) instead, as this is closer to the
intent. Document this behavior.
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r-- | runtime/doc/lua.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 0a7c53a482..0beee1507a 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2230,6 +2230,12 @@ vim.tbl_count({t}) *vim.tbl_count()* vim.tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()* Merges recursively two or more tables. + Only values that are empty tables or tables that are not |lua-list|s + (indexed by consecutive integers starting from 1) are merged recursively. + This is useful for merging nested tables like default and user + configurations where lists should be treated as literals (i.e., are + overwritten instead of merged). + Parameters: ~ • {behavior} (`'error'|'keep'|'force'`) Decides what to do if a key is found in more than one map: |