Add full statement range support to roxygen @examples and @examplesIf
#965
+624
−168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
@examplesand@examplesIfblocks.It works by extracting out the
@examplesor@examplesIfblocks 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