Skip to content

fix(astro): include newline in the astro fence#10331

Draft
Conaclos wants to merge 1 commit into
mainfrom
conaclos/fix-astro-fence-range
Draft

fix(astro): include newline in the astro fence#10331
Conaclos wants to merge 1 commit into
mainfrom
conaclos/fix-astro-fence-range

Conversation

@Conaclos
Copy link
Copy Markdown
Member

@Conaclos Conaclos commented May 10, 2026

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

  • Changeset

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 10, 2026

⚠️ No Changeset found

Latest commit: 1959838

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added A-CLI Area: CLI A-Project Area: project labels May 10, 2026
format!(
"{}{}{}",
&input[..start.end() + 1],
output.trim_start(),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This trim_start can remove too many spaces.

3 2 │

1 │ debugger;
│ ---------
Copy link
Copy Markdown
Member Author

@Conaclos Conaclos May 10, 2026

Choose a reason for hiding this comment

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

This is the bug regarding the code fixes that I mentioned in the PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant