aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-04-18 21:34:31 +0200
committerGitHub <noreply@github.com>2022-04-18 21:34:31 +0200
commit43b273803e39f355f704bfdb3037ea83cee664e2 (patch)
treeb0aca00c9d36a160be512b5d94834e91ac897e7c /lua
parentadd cargo to healthcheck (diff)
downloadmason-43b273803e39f355f704bfdb3037ea83cee664e2.tar
mason-43b273803e39f355f704bfdb3037ea83cee664e2.tar.gz
mason-43b273803e39f355f704bfdb3037ea83cee664e2.tar.bz2
mason-43b273803e39f355f704bfdb3037ea83cee664e2.tar.lz
mason-43b273803e39f355f704bfdb3037ea83cee664e2.tar.xz
mason-43b273803e39f355f704bfdb3037ea83cee664e2.tar.zst
mason-43b273803e39f355f704bfdb3037ea83cee664e2.zip
fix(spawn): recursively parse arglist (#610)
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,