Skip to content

Conversation

@DavisVaughan
Copy link
Contributor

@DavisVaughan DavisVaughan commented Nov 19, 2025

Addresses posit-dev/positron#8559 (via the fact that we no longer try to run examples one line at a time, there is still a regression in the frontend code logged elsewhere)

I can't find an issue that talks about wanting full Statement Range support in roxygen comments, but since we have the regression where running one line at a time doesn't work either, this became a much higher priority for me.


This PR adds full Statement Range support to roxygen @examples and @examplesIf blocks.

  • Previously we could only run one line at a time (and a regression had broken this too)
  • Now we can run entire blocks of code at once, just like the regular statement range provider

It works by extracting out the @examples or @examplesIf blocks into a subdocument, which we parse on its own and run through the statement range provider (adjusting row positions accordingly).

This is such a big QOL improvement for me 😬

I've also reworked the tests for statement range so that you can debug them one at a time. It was pretty frustrating to debug one individual test when others were in the way. Along the way I made it so that point_from_cursor() could accept an alternative cursor token than @, because that's what is used to denote roxygen tags! This allowed me to make the statement range tests much more readable.

Screen.Recording.2025-11-19.at.12.28.37.PM.mov

@DavisVaughan DavisVaughan requested a review from lionel- November 19, 2025 18:01
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.

2 participants