When is configuration evaluated? #597
-
Hi, new to nvim and dap configuration. I'm trying to setup a dynamic debug workspace, atm I'm using lua for configuration but I don't see how can I reuse the
Thanks for the help :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The configuration is evaluated when you launch a new debug session. I think what could work is using a forward reference to mutate the configuration within the local lldb_launch
lldb_launch = {
name = "Launch",
type = "lldb",
request = 'launch',
program = function()
local module = vim.fn.input('Module name: ')
local apps = {'non_test_app', 'non_test_app2'}
local is_test = true
-- 👇❗
lldb_launch.cwd = 'whatever'
for _, v in ipairs(apps) do
if module == v then
is_test = false
end
end
if is_test then
return '${workspaceFolder}/bin/tests/debug/' .. module .. '/' .. module .. '-tests'
end
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/bin/', 'file')
end,
stopOnEntry = false,
args = {}
}
dap.configurations.cpp = { lldb_launch, } |
Beta Was this translation helpful? Give feedback.
The configuration is evaluated when you launch a new debug session.
I think what could work is using a forward reference to mutate the configuration within the
program
function: