mirror of
https://github.com/neovim/neovim.git
synced 2026-04-04 22:59:36 +00:00
feat: allow function passed to defaulttable to take an argument (#22839)
Pass the value of the key being accessed to the create function, to allow users to dynamically generate default values.
This commit is contained in:
@@ -2915,6 +2915,15 @@ describe('lua stdlib', function()
|
||||
return a
|
||||
]])
|
||||
end)
|
||||
|
||||
it('accepts the key name', function()
|
||||
eq({ b = 'b', c = 'c' }, exec_lua [[
|
||||
local a = vim.defaulttable(function(k) return k end)
|
||||
local _ = a.b
|
||||
local _ = a.c
|
||||
return a
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
it('vim.lua_omnifunc', function()
|
||||
|
||||
Reference in New Issue
Block a user