feat(spec): allow mergig of config, priority and dependencies

This commit is contained in:
Folke Lemaitre 2023-01-02 09:41:09 +01:00
parent 7d755987ba
commit 313015fdb4
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 9 additions and 0 deletions

View File

@ -165,7 +165,16 @@ function Spec:merge(old, new)
vim.list_extend(values, type(old[k]) == "string" and { old[k] } or old[k]) vim.list_extend(values, type(old[k]) == "string" and { old[k] } or old[k])
---@diagnostic disable-next-line: no-unknown ---@diagnostic disable-next-line: no-unknown
old[k] = values old[k] = values
elseif k == "config" or k == "priority" then
old[k] = v
elseif k == "dependencies" then
for _, dep in ipairs(v) do
if not vim.tbl_contains(old[k], dep) then
table.insert(old[k], dep)
end
end
else else
old[k] = v
self:error("Merging plugins is not supported for key `" .. k .. "`\n" .. vim.inspect({ old = old, new = new })) self:error("Merging plugins is not supported for key `" .. k .. "`\n" .. vim.inspect({ old = old, new = new }))
end end
else else