mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
feat(lua): handle lazy submodules in :lua vim.
wildmenu completion
This commit is contained in:
parent
2783f4cc4a
commit
5ed60804fe
@ -519,6 +519,8 @@ function vim._expand_pat(pat, env)
|
|||||||
local mt = getmetatable(final_env)
|
local mt = getmetatable(final_env)
|
||||||
if mt and type(mt.__index) == "table" then
|
if mt and type(mt.__index) == "table" then
|
||||||
field = rawget(mt.__index, key)
|
field = rawget(mt.__index, key)
|
||||||
|
elseif final_env == vim and vim._submodules[key] then
|
||||||
|
field = vim[key]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
final_env = field
|
final_env = field
|
||||||
@ -545,6 +547,9 @@ function vim._expand_pat(pat, env)
|
|||||||
if mt and type(mt.__index) == "table" then
|
if mt and type(mt.__index) == "table" then
|
||||||
insert_keys(mt.__index)
|
insert_keys(mt.__index)
|
||||||
end
|
end
|
||||||
|
if final_env == vim then
|
||||||
|
insert_keys(vim._submodules)
|
||||||
|
end
|
||||||
|
|
||||||
table.sort(keys)
|
table.sort(keys)
|
||||||
|
|
||||||
|
@ -106,6 +106,14 @@ describe('nlua_expand_pat', function()
|
|||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('should work with lazy submodules of "vim" global', function()
|
||||||
|
eq({{ 'inspect' }, 4 },
|
||||||
|
get_completions('vim.inspec'))
|
||||||
|
|
||||||
|
eq({{ 'set' }, 11 },
|
||||||
|
get_completions('vim.keymap.se'))
|
||||||
|
end)
|
||||||
|
|
||||||
it('should be able to interpolate globals', function()
|
it('should be able to interpolate globals', function()
|
||||||
eq(
|
eq(
|
||||||
{{
|
{{
|
||||||
|
Loading…
Reference in New Issue
Block a user