Skip to content

Commit

Permalink
fix for #518 select should accept idx
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-x committed Nov 2, 2024
1 parent c6582dc commit 2153f9e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lua/go/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ M.run = function(...)
return require('dap').toggle_breakpoint()
end

local original_select = vim.ui.select
vim.ui.select = _GO_NVIM_CFG.go_select()
-- local original_select = vim.ui.select
-- vim.ui.select = _GO_NVIM_CFG.go_select()

-- testopts = {"test", "nearest", "file", "stop", "restart"}
log('plugin loaded', mode, optarg)
Expand Down Expand Up @@ -568,8 +568,12 @@ M.run = function(...)
for _, cfg in ipairs(dap.configurations.go) do
table.insert(launch_names, cfg.name)
end
vim.ui.select(launch_names, { prompt = 'which you would like to debug' }, function(index)
dap.run(dap.configurations.go[index])
local sel = _GO_NVIM_CFG.go_select()
sel(launch_names, { prompt = 'which you would like to debug' }, function(name, idx)
if idx then
vim.notify(string.format('Debug %d: %s', idx or 1, name))
dap.run(dap.configurations.go[idx])
end
end)
end
else -- no args
Expand All @@ -585,7 +589,7 @@ M.run = function(...)

M.pre_mode = dap_cfg.mode or M.pre_mode

vim.ui.select = original_select
-- vim.ui.select = original_select
end

local unmap = function()
Expand Down

0 comments on commit 2153f9e

Please sign in to comment.