From 1e2f44a69eb0acd19bc9b9a2c2525f72d82389fe Mon Sep 17 00:00:00 2001 From: Ashkan Kiani Date: Wed, 13 Nov 2019 09:59:23 -0800 Subject: Add configuration options. --- lua/common_lsp/util.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lua/common_lsp/util.lua') 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 -- cgit v1.2.3-70-g09d2