Skip to content

Make provideStatementRange() create a single chunk virtual doc#914

Open
DavisVaughan wants to merge 2 commits intoquarto-dev:mainfrom
DavisVaughan:feature/statement-range-per-cell
Open

Make provideStatementRange() create a single chunk virtual doc#914
DavisVaughan wants to merge 2 commits intoquarto-dev:mainfrom
DavisVaughan:feature/statement-range-per-cell

Conversation

@DavisVaughan
Copy link
Collaborator

@DavisVaughan DavisVaughan commented Feb 11, 2026

Part 2 of the statement range refinement plan

Surgical tweak to provideStatementRange() and virtualDoc() to only make the virtual doc for that chunk, so parse errors in one chunk can't render other chunks useless from a statement range perspective

You also need posit-dev/ark#1030 if you want to test that you can execute code above a parse error within the same chunk, but that isn't critical to the ability to execute code in an arbitrary chunk if one of them has a parse error.


Before, if you make a typo in one chunk:

  • ❌ In the same chunk, can't use statement execution above the typo
  • ❌ In the same chunk, can't use statement execution below the typo
  • ❌ In any other chunk, can't use statement execution
quarto-before.mov

After, if you make a typo in one chunk:

quarto-after.mov

@DavisVaughan DavisVaughan marked this pull request as ready for review February 11, 2026 17:07
@juliasilge
Copy link
Collaborator

Addresses posit-dev/positron#3233 partially

Copy link
Collaborator

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working great for me! I reviewed with the current Positron daily so I don't have posit-dev/ark#1030 in it, but the behavior is as expected and looks good.

Before we merge this, can you:

  • add a new vdoc.test.ts to the extension tests here with some basic tests of the virtual documents we make with the new options? One option is to make a utility similar to roundtripSnapshotTest() but for virtual docs (one way only, .qmd ➡️ .R or .py) and another option would be to inline the structure of the vdoc in the test file. Take a look at what we have in apps/vscode/src/test/examples and the tests in quartoDoc.test.ts for example on snapshots. Be aware you will not have access to any language pack extension in the tests, only the Quarto extension itself, but I think that will be fine in this case.
  • update the copyright year to say "Copyright (C) 2022-2026 by Posit Software, PBC" on the files you edited?

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