aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-03-28 02:00:11 -0700
committerMichael Lingelbach <m.j.lbach@gmail.com>2021-03-28 02:00:24 -0700
commit3a6dddd489c41736bc10a35e53f02dec6466d6aa (patch)
tree537372dd0ea41422abdb5a6d30519f9a778e744a /lua
parentAdd stop, start, and restart commands (diff)
downloadnvim-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')
-rw-r--r--lua/lspconfig/configs.lua8
-rw-r--r--lua/lspconfig/util.lua34
2 files changed, 4 insertions, 38 deletions
diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua
index 13b92b17..b0642bf6 100644
--- a/lua/lspconfig/configs.lua
+++ b/lua/lspconfig/configs.lua
@@ -97,10 +97,10 @@ function configs.__newindex(t, config_name, config_def)
end
local make_config = function(_root_dir)
- local new_config = util.tbl_deep_extend("keep", vim.empty_dict(), config)
- new_config = util.tbl_deep_extend('keep', new_config, default_config)
+ local new_config = vim.tbl_deep_extend("keep", vim.empty_dict(), config)
+ new_config = vim.tbl_deep_extend('keep', new_config, default_config)
new_config.capabilities = new_config.capabilities or lsp.protocol.make_client_capabilities()
- new_config.capabilities = util.tbl_deep_extend('keep', new_config.capabilities, {
+ new_config.capabilities = vim.tbl_deep_extend('keep', new_config.capabilities, {
workspace = {
configuration = true;
}
@@ -188,7 +188,7 @@ function configs.__newindex(t, config_name, config_def)
client.config._on_attach(client, bufnr)
end
if client.config.commands and not vim.tbl_isempty(client.config.commands) then
- M.commands = util.tbl_deep_extend("force", M.commands, client.config.commands)
+ M.commands = vim.tbl_deep_extend("force", M.commands, client.config.commands)
end
if not M.commands_created and not vim.tbl_isempty(M.commands) then
-- Create the module commands
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!"}