Skip to content

Conversation

@lionel-
Copy link
Contributor

@lionel- lionel- commented Feb 10, 2026

Branched from #1033 (for test infra)
Addresses posit-dev/positron#11797
Addresses posit-dev/positron#11799

Adds support for the DAP feature of exception breakpoints, and for pausing the debugger at any time. Both features rely on:

  • Calling browser() from a global handler for the relevant condition (error, warning, or interrupt)

  • Skipping the top-level frame which points to our global handlers.

    When these handlers trigger, the R stack includes the handler frame at the top. Since this frame is not useful to users, we track why we entered the debugger via DebugStoppedReason (Condition for errors/warnings, Pause for interrupts) and discard the top frame in start_debug() for these cases.

    Note that the console will still evaluate in this frame until we fix IDE alternative to options(error = recover) positron#9156 (comment).

    Also note that for errors and warnings, we'd ideally automatically skip the part of the call stack involved in emitting/handling the condition (partly the base emitting context with withRestart() etc, and partly the package-level emitting context, e.g. based on rlang's error_call = parent.frame() pattern).

The condition breakpoints are surfaced like this in the UI:

Screenshot 2026-02-10 at 15 19 59

We could add messages as well but I thought that'd crowd the UI, and it doesn't feel as useful to easily break on those. Could be added as a user setting in the future.

Pausing can be done by calling the existing VS Code command "Pause":

Screenshot 2026-02-10 at 15 03 39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant