Skip to content

Add Watch Pane support#1037

Open
lionel- wants to merge 15 commits intomainfrom
feature/watch-pane
Open

Add Watch Pane support#1037
lionel- wants to merge 15 commits intomainfrom
feature/watch-pane

Conversation

@lionel-
Copy link
Contributor

@lionel- lionel- commented Feb 10, 2026

Branched from #1033 (for DAP tests)
Addresses posit-dev/positron#1765

Adds support for evaluating expressions from the debug watch pane via DAP evaluate requests. One such request is sent for every watch expression.

Since we're asynchronously getting these requests, and R might no longer be idle at that time, the evaluate requests run as idle tasks (see #371) that only run once R is safely idle (waiting in ReadConsole). The regular idle tasks spawned with spawn_idle() do not run when the debugger is active. This is the safe default for general purpose tasks, but for evaluate requests we obviously need them to run when R is paused. I've introduced spawn_idle_any() for tasks that also need to run at debug prompts.

Also adds infrastructure for capturing console output during idle tasks processing evaluate requests. This way the output is logged at info level instead of being emitted as orphaned IOPub streams.

I've also added support for printing in the watch pane by prefixing the expression with /print . In that case we return the captured output instead of the object. That doesn't work that well though because you need to hover to see the captured outpub. This feature is almost free though so I kept it.

Screen.Recording.2026-02-10.at.16.01.09.mov

QA Notes

This is comprehensively tested on the backend side.

  • Expressions in the watch pane should be sensitive to selected frame, and should update at each step.

  • Expressions evaluate to the same kind of object as in the variable pane. Complex values are expandable.

  • By prefixing with the slash command /print, you can get the printed output, e.g. /print mtcars. Truncated but full output available on hover.

  • Watch expressions at top-level browser (e.g. browser() called directly) should evaluate in the global environment.

  • Invalid expressions should show error messages.

@lionel- lionel- force-pushed the task/dap-protocol-tests-sync-update branch 2 times, most recently from 4611c2c to dbb841c Compare February 12, 2026 18:19
Base automatically changed from task/dap-protocol-tests-sync-update to main February 12, 2026 18:20
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