-
Fzf-lua enables fuzzy searching of dap breakpoints, it also enables deleting selected breakpoints with By “fails” I mean, the breakpoint is removed from the UI sign column, also reflected by I also tried to copy the Lines 803 to 810 in 405df1d The below is my most recent code, what else do I need to call aside from M.dap_bp_del = function(selected, opts)
local dap_bps = require("dap.breakpoints")
for _, e in ipairs(selected) do
local entry = path.entry_to_file(e, opts)
if entry.bufnr > 0 and entry.line then
dap_bps.remove(entry.bufnr, entry.line)
end
end
-- removing the BP will update the UI, if we're in session
-- we also need to broadcast the BP delete to the DAP server
local session = require("dap").session()
if session then
local bps = dap_bps.get()
session:set_breakpoints(bps)
end
end |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Oh well, that didn't take long I answered myself :-) Turns out that if I delete the last bp in a buffer I must set the M.dap_bp_del = function(selected, opts)
local bufnrs = {}
local dap_bps = require("dap.breakpoints")
for _, e in ipairs(selected) do
local entry = path.entry_to_file(e, opts)
if entry.bufnr > 0 and entry.line then
dap_bps.remove(entry.bufnr, entry.line)
table.insert(bufnrs, tonumber(entry.bufnr))
end
end
-- removing the BP will update the UI, if we're in session
-- we also need to broadcast the BP delete to the DAP server
local session = require("dap").session()
if session then
local bps = dap_bps.get()
for _, b in ipairs(bufnrs) do
-- If all BPs were removed from a buffer we must clear the buffer
-- by sending an empty table in the bufnr index
bps[b] = bps[b] or {}
end
session:set_breakpoints(bps)
end
end |
Beta Was this translation helpful? Give feedback.
Oh well, that didn't take long I answered myself :-)
Turns out that if I delete the last bp in a buffer I must set the
bp[index] = {}
in order to clear all breakpionts, my latest working code: