Skip to content

refactor(formatter): specialised verbatim formatting#7002

Merged
ematipico merged 1 commit intomainfrom
refactor/verbatim-trivia
Jul 25, 2025
Merged

refactor(formatter): specialised verbatim formatting#7002
ematipico merged 1 commit intomainfrom
refactor/verbatim-trivia

Conversation

@ematipico
Copy link
Member

Summary

To fix #5356, we need to change the infrastructure of our formatter. At the moment our formatter is generic and tries to do everything itself, however if the specialised formatter want to change the default behaviour, they can't.

We'll have to change that, and each specialised formatter will have to implement their generic formatter.

Before applying this logic for comments, we need to start with verbatim and bogus nodes. This PR removes the verbatim/bogus utilities from biome_formatter, and adds a verbatim.rs module for each specialised formatter.

The code, for now, it's repeated across modules.

Test Plan

CI should stay green

Docs

@changeset-bot
Copy link

changeset-bot bot commented Jul 25, 2025

⚠️ No Changeset found

Latest commit: 8819a6d

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-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS L-JSON Language: JSON and super languages L-HTML Language: HTML and super languages L-Grit Language: GritQL labels Jul 25, 2025
@ematipico ematipico force-pushed the refactor/verbatim-trivia branch from 5e91015 to 8819a6d Compare July 25, 2025 08:17
@ematipico ematipico requested review from a team July 25, 2025 08:17
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 25, 2025

CodSpeed Performance Report

Merging #7002 will not alter performance

Comparing refactor/verbatim-trivia (8819a6d) with main (0b1e194)1

Summary

✅ 115 untouched benchmarks

Footnotes

  1. No successful run was found on main (8f2703c) during the generation of this report, so 0b1e194 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@ematipico ematipico merged commit 875a5c7 into main Jul 25, 2025
28 checks passed
@ematipico ematipico deleted the refactor/verbatim-trivia branch July 25, 2025 12:10
vladimir-ivanov pushed a commit to vladimir-ivanov/biome that referenced this pull request Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter L-CSS Language: CSS L-Grit Language: GritQL L-HTML Language: HTML and super languages L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant