diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-03-28 02:00:11 -0700 |
|---|---|---|
| committer | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-03-28 02:00:24 -0700 |
| commit | 3a6dddd489c41736bc10a35e53f02dec6466d6aa (patch) | |
| tree | 537372dd0ea41422abdb5a6d30519f9a778e744a /lua/lspconfig/util.lua | |
| parent | Add stop, start, and restart commands (diff) | |
| download | nvim-lspconfig-3a6dddd489c41736bc10a35e53f02dec6466d6aa.tar nvim-lspconfig-3a6dddd489c41736bc10a35e53f02dec6466d6aa.tar.gz nvim-lspconfig-3a6dddd489c41736bc10a35e53f02dec6466d6aa.tar.bz2 nvim-lspconfig-3a6dddd489c41736bc10a35e53f02dec6466d6aa.tar.lz nvim-lspconfig-3a6dddd489c41736bc10a35e53f02dec6466d6aa.tar.xz nvim-lspconfig-3a6dddd489c41736bc10a35e53f02dec6466d6aa.tar.zst nvim-lspconfig-3a6dddd489c41736bc10a35e53f02dec6466d6aa.zip | |
Remove duplicated tbl_deep_extend
Diffstat (limited to 'lua/lspconfig/util.lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index a6dabd78..dca330ae 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -46,40 +46,6 @@ function M.add_hook_after(func, new_fn) end end -function M.tbl_deep_extend(behavior, ...) - if (behavior ~= 'error' and behavior ~= 'keep' and behavior ~= 'force') then - error('invalid "behavior": '..tostring(behavior)) - end - - if select('#', ...) < 2 then - error('wrong number of arguments (given '..tostring(1 + select('#', ...))..', expected at least 3)') - end - - local ret = {} - if vim._empty_dict_mt ~= nil and getmetatable(select(1, ...)) == vim._empty_dict_mt then - ret = vim.empty_dict() - end - - for i = 1, select('#', ...) do - local tbl = select(i, ...) - vim.validate{["after the second argument"] = {tbl,'t'}} - if tbl then - for k, v in pairs(tbl) do - if type(v) == 'table' and not vim.tbl_islist(v) then - ret[k] = M.tbl_deep_extend(behavior, ret[k] or vim.empty_dict(), v) - elseif behavior ~= 'force' and ret[k] ~= nil then - if behavior == 'error' then - error('key found in more than one map: '..k) - end -- Else behavior is "keep". - else - ret[k] = v - end - end - end - end - return ret -end - function M.create_module_commands(module_name, commands) for command_name, def in pairs(commands) do local parts = {"command!"} |
