Skip to content

refactor(fmt): make embedding generic - #12579

Merged
ematipico merged 1 commit into
mainfrom
refactor/foramtter-embedded
Oct 23, 2026
Merged

ematipico merged 1 commit into
mainfrom
refactor/foramtter-embedded

Conversation

@ematipico

Copy link
Copy Markdown
Member

Summary

Implemented via a coding agent.

This PR moves FormatEmbedded inside the biome_formatter crate. We started to have repeated code.

Test Plan

Green CI

Docs

N/A

@changeset-bot

changeset-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 88a291d

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

@ematipico
ematipico requested review from a team October 23, 2026 09:00
@github-actions github-actions Bot added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS and super languages L-HTML Language: HTML and super languages L-Markdown Language: Markdown labels Oct 23, 2026
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack β†’

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration
πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 09d2ca8 and 88a291d.

πŸ“’ Files selected for processing: 13
  • crates/biome_css_formatter/src/css/auxiliary/metavariable.rs
  • crates/biome_formatter/src/builders.rs
  • crates/biome_formatter/src/format_element/tag.rs
  • crates/biome_formatter/src/lib.rs
  • crates/biome_html_formatter/src/context.rs
  • crates/biome_html_formatter/src/html/auxiliary/embedded_content.rs
  • crates/biome_html_formatter/src/lib.rs
  • crates/biome_js_formatter/src/js/lists/template_element_list.rs
  • crates/biome_js_formatter/src/lib.rs
  • crates/biome_markdown_formatter/src/lib.rs
  • crates/biome_markdown_formatter/src/markdown/auxiliary/code_content.rs
  • crates/biome_markdown_formatter/src/markdown/auxiliary/frontmatter_content.rs
  • crates/biome_markdown_formatter/src/markdown/auxiliary/html_content.rs
πŸ’€ Files with no reviewable changes: 5
  • crates/biome_markdown_formatter/src/markdown/auxiliary/frontmatter_content.rs
  • crates/biome_markdown_formatter/src/markdown/auxiliary/html_content.rs
  • crates/biome_html_formatter/src/html/auxiliary/embedded_content.rs
  • crates/biome_markdown_formatter/src/lib.rs
  • crates/biome_markdown_formatter/src/markdown/auxiliary/code_content.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The formatter crate adds FormatEmbedded to format embedded content and emit embedded tags. CSS, HTML, and JavaScript formatter paths use this shared type instead of manually constructing buffers and tags. The Markdown formatter removes its local FormatEmbedded helper. Documentation now describes embedded-content replacement by source range.

Suggested labels: L-JavaScript

Priority: ⬇️ Low

Change: Refactor

Merge Risk: βšͺ Minimal Β· up to 88a29

The shared embedded-formatting helper appears to preserve existing output and error behavior. No actionable merge risk remains after normal checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Description check Passed The description explains that FormatEmbedded moved into biome_formatter to reduce repeated code. This matches the changeset.
Title check Passed The title clearly and concisely describes the main change: making embedding generic.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands.

@codspeed

codspeed Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 11.81%

1 warning

⚠️ 14 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚑ 1 improved benchmark
βœ… 255 untouched benchmarks
⏩ 158 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚑ e2e_open_css_in_js[plain] 21.7 ms 19.4 ms +11.81%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing refactor/foramtter-embedded (88a291d) with main (09d2ca8)2

Open in CodSpeed

Footnotes

  1. 158 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (8a5974a) during the generation of this report, so 09d2ca8 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

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 and super languages L-HTML Language: HTML and super languages L-JavaScript Language: JavaScript and super languages L-Markdown Language: Markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants