Add cmp.config.disable for opt-out default setting
This commit is contained in:
@@ -29,6 +29,9 @@ misc.concat = function(list1, list2)
|
||||
return new_list
|
||||
end
|
||||
|
||||
---The symbol to remove key in misc.merge.
|
||||
misc.none = vim.NIL
|
||||
|
||||
---Merge two tables recursively
|
||||
---@generic T
|
||||
---@param v1 T
|
||||
@@ -49,6 +52,9 @@ misc.merge = function(v1, v2)
|
||||
end
|
||||
return new_tbl
|
||||
end
|
||||
if v1 == misc.none then
|
||||
return nil
|
||||
end
|
||||
if v1 == nil then
|
||||
return v2
|
||||
end
|
||||
|
||||
@@ -15,6 +15,7 @@ describe('misc', function()
|
||||
},
|
||||
})
|
||||
assert.are.equal(merged.a.b, 1)
|
||||
|
||||
merged = misc.merge({
|
||||
a = false,
|
||||
}, {
|
||||
@@ -23,5 +24,14 @@ describe('misc', function()
|
||||
},
|
||||
})
|
||||
assert.are.equal(merged.a, false)
|
||||
|
||||
merged = misc.merge({
|
||||
a = misc.none,
|
||||
}, {
|
||||
a = {
|
||||
b = 1,
|
||||
},
|
||||
})
|
||||
assert.are.equal(merged.a, nil)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user