fix(lua): double entries in :lua completion #19410

`:lua vim.ls<tab>` would list `lsp` twice.
This commit is contained in:
ii14
2022-07-18 00:40:18 +02:00
committed by GitHub
parent 9f4b19b6d0
commit 9169fb8f07

View File

@@ -614,7 +614,7 @@ function vim._expand_pat(pat, env)
local function insert_keys(obj) local function insert_keys(obj)
for k, _ in pairs(obj) do for k, _ in pairs(obj) do
if type(k) == 'string' and string.sub(k, 1, string.len(match_part)) == match_part then if type(k) == 'string' and string.sub(k, 1, string.len(match_part)) == match_part then
table.insert(keys, k) keys[k] = true
end end
end end
end end
@@ -630,6 +630,7 @@ function vim._expand_pat(pat, env)
insert_keys(vim._submodules) insert_keys(vim._submodules)
end end
keys = vim.tbl_keys(keys)
table.sort(keys) table.sort(keys)
return keys, #prefix_match_pat return keys, #prefix_match_pat