Skip to content

Commit 18e54f3

Browse files
Modifying debugger to return the same breakpoints in 'debugInfo' response as 'setBreakpoints' (#1140)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c851746 commit 18e54f3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ipykernel/debugger.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,15 @@ async def setBreakpoints(self, message):
473473
"""Handle a set breakpoints message."""
474474
source = message["arguments"]["source"]["path"]
475475
self.breakpoint_list[source] = message["arguments"]["breakpoints"]
476-
return await self._forward_message(message)
476+
message_response = await self._forward_message(message)
477+
# debugpy can set breakpoints on different lines than the ones requested,
478+
# so we want to record the breakpoints that were actually added
479+
if "success" in message_response and message_response["success"]:
480+
self.breakpoint_list[source] = [
481+
{"line": breakpoint["line"]}
482+
for breakpoint in message_response["body"]["breakpoints"]
483+
]
484+
return message_response
477485

478486
async def source(self, message):
479487
"""Handle a source message."""

0 commit comments

Comments
 (0)