Skip to content

Error format adjustments - #4320

Merged
kddnewton merged 5 commits into
mainfrom
error-format
Oct 30, 2026
Merged

kddnewton merged 5 commits into
mainfrom
error-format

Conversation

@kddnewton

Copy link
Copy Markdown
Collaborator

Speed ups, windowing to make sure we don't give too much context, and checking for UTF-8 in one pass. Error formatting appears to have gotten about 2x faster and is no longer quadratic with respect to input. Fixes #4304.

When an error is very far into a line, we were previously displaying
the whole context line above it and then padding out spaces before
the error message. For pathological cases, this ends up being really
bad. Instead we now display errors under a window of context.
Instead of checking each line individually, sort all of the errors
and do a single walk over the source to figure out if it is valid
UTF-8 to determine how to format the errors.
Do not hard-code the potential values for gutters, instead build
them on the fly based on what is actually found in the range of
the errors.
@kddnewton
kddnewton merged commit 37d2d0d into main Oct 30, 2026
119 checks passed
@kddnewton
kddnewton deleted the error-format branch October 30, 2026 03:41
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.

Quadratic memory amplification in Prism rich SyntaxError formatting

1 participant