aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/core/spawn.lua19
1 files changed, 12 insertions, 7 deletions
diff --git a/lua/nvim-lsp-installer/core/spawn.lua b/lua/nvim-lsp-installer/core/spawn.lua
index 8ac06aa4..355df029 100644
--- a/lua/nvim-lsp-installer/core/spawn.lua
+++ b/lua/nvim-lsp-installer/core/spawn.lua
@@ -33,18 +33,23 @@ local function Failure(err, cmd)
}))
end
+local function parse_args(args, dest)
+ for _, arg in ipairs(args) do
+ if type(arg) == "table" then
+ parse_args(arg, dest)
+ elseif arg ~= vim.NIL then
+ dest[#dest + 1] = arg
+ end
+ end
+ return dest
+end
+
setmetatable(spawn, {
__index = function(self, k)
---@param args string|nil|string[][]
return function(args)
local cmd_args = {}
- for _, arg in ipairs(args) do
- if type(arg) == "table" then
- vim.list_extend(cmd_args, arg)
- elseif arg ~= vim.NIL then
- cmd_args[#cmd_args + 1] = arg
- end
- end
+ parse_args(args, cmd_args)
---@type JobSpawnOpts
local spawn_args = {
stdio_sink = args.stdio_sink,