Skip to content

Commit

Permalink
Provide breakpoints in response. Fixes microsoft#1408
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed May 16, 2019
1 parent 5e703f5 commit 8a8491c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/ptvsd/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ class Daemon(DaemonBase):

class SESSION(DebugSession):
class MESSAGE_PROCESSOR(VSCLifecycleMsgProcessor):

def on_setBreakpoints(self, request, args):
# Note: breakpoints is required (vscode will terminate
# the debugger if that's not the case).
# See: https://github.com/microsoft/ptvsd/issues/1408
self.send_response(
request,
success=True,
breakpoints=(
[{'verified': False}] * len(args.get('breakpoints', ()))
)
)

def on_invalid_request(self, request, args):
self.send_response(request, success=True)

Expand Down
3 changes: 2 additions & 1 deletion tests/func/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def code_to_debug():
with DebugSession() as session:
session.no_debug = True
session.initialize(target=(run_as, code_to_debug), start_method='launch', use_backchannel=True)
session.set_breakpoints(code_to_debug, [3])
breakpoints = session.set_breakpoints(code_to_debug, [3, 4])
assert breakpoints == [{'verified': False}, {'verified': False}]
session.start_debugging()

session.write_json(None)
Expand Down

0 comments on commit 8a8491c

Please sign in to comment.