Skip to content

Commit faf585f

Browse files
committed
fix(dap_breakpoints): delete all bps in a buffer
1 parent f75db4a commit faf585f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lua/fzf-lua/actions.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,18 +900,25 @@ M.complete = function(selected, opts)
900900
end
901901

902902
M.dap_bp_del = function(selected, opts)
903+
local bufnrs = {}
903904
local dap_bps = require("dap.breakpoints")
904905
for _, e in ipairs(selected) do
905906
local entry = path.entry_to_file(e, opts)
906907
if entry.bufnr > 0 and entry.line then
907908
dap_bps.remove(entry.bufnr, entry.line)
909+
table.insert(bufnrs, tonumber(entry.bufnr))
908910
end
909911
end
910912
-- removing the BP will update the UI, if we're in session
911913
-- we also need to broadcast the BP delete to the DAP server
912914
local session = require("dap").session()
913915
if session then
914916
local bps = dap_bps.get()
917+
for _, b in ipairs(bufnrs) do
918+
-- If all BPs were removed from a buffer we must clear the buffer
919+
-- by sending an empty table in the bufnr index
920+
bps[b] = bps[b] or {}
921+
end
915922
session:set_breakpoints(bps)
916923
end
917924
end

0 commit comments

Comments
 (0)