Skip to content

Commit

Permalink
feat: add build flags as option for default config list
Browse files Browse the repository at this point in the history
  • Loading branch information
nkane committed Jul 3, 2024
1 parent a0c5a2b commit be9bdfa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lua/dap-go.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ local function get_arguments()
end)
end

local function get_build_flags()
return coroutine.create(function(dap_run_co)
local build_flags = {}
vim.ui.input({ prompt = "Build Flags: " }, function(input)
build_flags = vim.split(input or "", " ")
coroutine.resume(dap_run_co, build_flags)
end)
end)
end

local function filtered_pick_process()
local opts = {}
vim.ui.input(
Expand Down Expand Up @@ -80,6 +90,14 @@ local function setup_go_configuration(dap, configs)
args = get_arguments,
buildFlags = configs.delve.build_flags,
},
{
type = "go",
name = "Debug (Arguments & Build Flags)",
request = "launch",
program = "${file}",
args = get_arguments,
buildFlags = get_build_flags,
},
{
type = "go",
name = "Debug Package",
Expand Down

0 comments on commit be9bdfa

Please sign in to comment.