Skip to content
Discussion options

You must be logged in to vote

but then it would need to be added to each configuration

If you really want to add the same args to all configurations, it's just a bit of lua:

local dap = require("dap")
for ft, configs in pairs(dap.configurations) do
    for _, config in ipairs(configs) do
        config.args = args
    end
end

The usual approach is to have one dedicated configuration that prompts for args. For example:

    {
      type = 'python';
      request = 'launch';
      name = 'Launch file with arguments';
      program = '${file}';
      args = function()
        local args_string = vim.fn.input('Arguments: ')
        return vim.split(args_string, " +")
      end;
    }

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@lars-vc
Comment options

Answer selected by lars-vc
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants