Skip to content

Refine statement range parse error behavior#1030

Open
DavisVaughan wants to merge 1 commit intomainfrom
feature/statement-range-before-parse-error
Open

Refine statement range parse error behavior#1030
DavisVaughan wants to merge 1 commit intomainfrom
feature/statement-range-before-parse-error

Conversation

@DavisVaughan
Copy link
Contributor

@DavisVaughan DavisVaughan commented Feb 4, 2026

Part of posit-dev/positron#8350
Part of posit-dev/positron#5023

Part 1 of the statement range refinement plan

Only refuse to provide a statement range after detecting the first top-level expression that contains a parse error somewhere within it. We assert that anything before this has parsed correctly, so if the user's cursor is up there, we should be able to compute a statement range (we are mostly confident in this assertion, I cannot think of any examples where it would not hold).


This matches Mine's expectations over in posit-dev/positron#8350 of

Regardless of broken/buggy code further down in the script, a "good" pipeline with line breaks should be sent to the Console entirely.

Only refuse to provide a statement range after detecting the first top-level expression that contains a parse error somewhere within it.

This allows top-level statements before this one to still be executed.
@jennybc
Copy link
Member

jennybc commented Feb 6, 2026

I've got Positron using a debug build of ark from this PR and it LGTM so far. I'll continue to exercise it implicitly and explicitly and report back anything interesting.

// Refuse to provide a statement range after detecting a top-level `child` with a
// parse error. We expect that everything before this top-level `child` has parsed
// correctly, so if the cursor was above this first parse error, we can execute
// that code fearlessly. After the first parse error, all bets are off. Even if
Copy link
Member

Choose a reason for hiding this comment

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

Fearlessly!!!

fearless

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