mirror of https://github.com/folke/neoconf.nvim
fix: flatten
This commit is contained in:
parent
099f30fafe
commit
cdbd1f2da8
|
|
@ -98,7 +98,7 @@ function M.get_type(prop)
|
|||
if vim.tbl_isempty(types) then
|
||||
types = { "any" }
|
||||
end
|
||||
return vim.iter(types):flatten():join("|")
|
||||
return table.concat(util.flatten(types), "|")
|
||||
end
|
||||
|
||||
function M.process_object(name, prop)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ function M.translate(props, nls_url)
|
|||
desc = nls[desc:gsub("%%", "")] or desc
|
||||
if type(desc) == "table" then
|
||||
local lines = vim.tbl_values(desc)
|
||||
lines = vim.iter(lines):flatten():totable()
|
||||
lines = Util.flatten(lines)
|
||||
table.sort(lines)
|
||||
desc = table.concat(lines, "\n\n")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -70,6 +70,20 @@ function M.on_config(opts)
|
|||
end)
|
||||
end
|
||||
|
||||
---@param t table
|
||||
---@param ret? table
|
||||
function M.flatten(t, ret)
|
||||
ret = ret or {}
|
||||
for _, v in pairs(t) do
|
||||
if type(v) == "table" then
|
||||
M.flatten(v, ret)
|
||||
else
|
||||
ret[#ret + 1] = v
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
---@param opts? { local: boolean, global: boolean, autocmd: boolean }
|
||||
---@return string[]
|
||||
function M.file_patterns(opts)
|
||||
|
|
|
|||
Loading…
Reference in New Issue