From 75d4a6aa01b4e9321220c2f54e35ac9245aec1d3 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 15 Feb 2025 11:30:20 -0600 Subject: [PATCH] feat: allow debugging with launch.json that uses a args string --- lua/plugins/debugging.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lua/plugins/debugging.lua b/lua/plugins/debugging.lua index 451afed..e839734 100644 --- a/lua/plugins/debugging.lua +++ b/lua/plugins/debugging.lua @@ -244,6 +244,24 @@ return { }, } + local convertArgStringToArray = function(config) + local c = {} + + for k, v in pairs(vim.deepcopy(config)) do + if k == "args" and type(v) == "string" then + c[k] = require("dap.utils").splitstr(v) + else + c[k] = v + end + end + + return c + end + + for key, _ in pairs(dap.configurations) do + dap.listeners.on_config[key] = convertArgStringToArray + end + dap.listeners.before.attach.dapui_config = function() dapui.open() end