diff options
Diffstat (limited to 'lua/common_lsp/util.lua')
| -rw-r--r-- | lua/common_lsp/util.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lua/common_lsp/util.lua b/lua/common_lsp/util.lua index 8f398dee..ccf420ce 100644 --- a/lua/common_lsp/util.lua +++ b/lua/common_lsp/util.lua @@ -38,4 +38,20 @@ local function split_lines(s) return vim.split(s, "\n", true) end +function M.tbl_deep_extend(dst, ...) + validate { dst = { dst, 't' } } + for i = 1, select("#", ...) do + local t = select(i, ...) + validate { arg = { t, 't' } } + for k, v in pairs(t) do + if type(v) == 'table' and not vim.tbl_islist(v) then + dst[k] = M.tbl_deep_extend(dst[k] or {}, v) + else + dst[k] = v + end + end + end + return dst +end + return M |
