From a9372aa2258900a549e62123dc19719f1ed5eca2 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 23 Jan 2023 22:01:35 +0100 Subject: [PATCH] fix: updated rust/c dap config i don't really get it yet but eeh kinda works --- lua/plugins.lua | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/lua/plugins.lua b/lua/plugins.lua index 303c5ba..2642a25 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -77,17 +77,34 @@ local init_fn = function(use) type = 'lldb', request = 'launch', program = function() - local program = "" - for i in string.gmatch(vim.fn.getcwd(), "([^/]+)") do - program = i - end - return vim.fn.getcwd() .. "/target/debug/" .. program -- TODO can I put startup file somewhere? + vim.fn.input("run: ", vim.fn.getcwd() .. "/", "command") end, cwd = '${workspaceFolder}', }, } dap.configurations.c = dap.configurations.cpp - dap.configurations.rust = dap.configurations.cpp + dap.configurations.rust = { + { + name = 'Launch', + type = 'lldb', + request = 'launch', + program = function() + local program = "" + for i in string.gmatch(vim.fn.getcwd(), "([^/]+)") do -- TODO jank! assumes folder is called just like executable + program = i + end + return vim.fn.getcwd() .. "/target/debug/" .. program -- TODO can I put startup file somewhere? + end, + cwd = '${workspaceFolder}', + args = function() + local args = {} + for str in string.gmatch(vim.fn.input("args: "), "([^,]+)") do + table.insert(args, str) + end + return args + end, + }, + } require('keybinds'):set_dap_keys({}) require('dapui').setup() end,