Skip to content

Commit

Permalink
Use vim.iter/tbl_flatten for flattening
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed Jun 3, 2024
1 parent d749da9 commit ff7d6cb
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lua/dap-python.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,11 @@ end

---@return string[]
local function flatten(...)
local argc = select("#", ...)
local result = {}
for i = 1, argc do
local arg = select(i, ...)
if type(arg) == "table" then
vim.list_extend(result, arg)
else
table.insert(result, arg)
end
local values = {...}
if vim.iter then
return vim.iter(values):flatten(2):totable()
end
return result
return vim.tbl_flatten(values)
end


Expand Down

0 comments on commit ff7d6cb

Please sign in to comment.