fix(astro): include newline in the astro fence#10331
Draft
Conaclos wants to merge 1 commit into
Draft
Conversation
|
Conaclos
commented
May 10, 2026
| format!( | ||
| "{}{}{}", | ||
| &input[..start.end() + 1], | ||
| output.trim_start(), |
Member
Author
There was a problem hiding this comment.
This trim_start can remove too many spaces.
Conaclos
commented
May 10, 2026
| 3 2 │ | ||
|
|
||
| 1 │ debugger; | ||
| │ --------- |
Member
Author
There was a problem hiding this comment.
This is the bug regarding the code fixes that I mentioned in the PR description.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This improves over #9592
This PR makes sure that the newline (if any) is part of the Astro fence.
Also, this fixes a bug where too many spaces can be trimmed by a
trim_start().I also discovered a bug related to code fixes: The reported lines of code fixes are relative to the extracted JavaScript, instead of the entire file.
Until now this was not noticed because our tests put the Astro fence on the first line and as the newline wasn't part of the fence, this conveniently matched the correct line number.
By including the newline with the fence, the bug is visible.
I didn't find the place where to adjust the code fix ranges yet.
I am afraid it is not so easy, because code fixes are applied on the extracted JavaScript, not the entire file.
Test Plan
TBD
Docs