Skip to content

feat(playground): support embedded snippets#3626

Merged
siketyan merged 2 commits intonextfrom
feat/playground-embedded-snippets
Dec 9, 2025
Merged

feat(playground): support embedded snippets#3626
siketyan merged 2 commits intonextfrom
feat/playground-embedded-snippets

Conversation

@siketyan
Copy link
Member

@siketyan siketyan commented Dec 9, 2025

Summary

Added support for embedded snippets (experimental) to the playground. Though it's disabled by default on CLI, it's enabled by default on the playground.

image

@siketyan siketyan self-assigned this Dec 9, 2025
@netlify
Copy link

netlify bot commented Dec 9, 2025

Deploy Preview for biomejs ready!

Name Link
🔨 Latest commit 0ac6ed4
🔍 Latest deploy log https://app.netlify.com/projects/biomejs/deploys/69378d77c4ecf10008c04e68
😎 Deploy Preview https://deploy-preview-3626--biomejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@siketyan siketyan requested review from a team December 9, 2025 02:33
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Caution

Review failed

The head commit changed during the review from 378a112 to 0ac6ed4.

Walkthrough

This PR updates Biome dependencies to a new git revision across Cargo.toml and package.json. It also introduces a new experimentalEmbeddedSnippetsEnabled feature flag throughout the playground to control embedded language formatting behaviour in both Biome and Prettier. The flag is wired through the settings interface, configuration types, and worker threads handling code formatting.

Possibly related PRs

  • fix: codegen #3598: Updates identical Biome dependency revisions (bc0e8b4) across multiple crates in the same ecosystem.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main objective of the PR—adding embedded snippets support to the playground.
Description check ✅ Passed The description is directly related to the changeset, explaining the feature addition and its default state across environments.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.40.0)
src/pages/metadata/rules.json.js

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
codegen/src/website.rs (1)

127-133: Avoid magic boolean in format_node call

The extra false is presumably wiring into a new formatter flag (e.g. embedded snippets). Hard‑coding it is fine for now, but it is not obvious what behaviour you are opting out of.

Consider either:

  • introducing a named constant (e.g. ENABLE_EMBEDDED_SNIPPETS: bool = false;) or
  • threading whatever config/feature flag this corresponds to down into codegen,

so the intent is self‑documenting.

It is worth confirming against the updated biome_js_formatter::format_node docs that false matches the old default, to avoid unintentional schema formatting changes.

Cargo.toml (1)

19-61: Biome git rev bump is consistent across all crates

All biome_* (and xtask_codegen) dependencies now point at the same bc0e8b47… rev with unchanged features, which keeps the codegen tooling nicely in lock‑step.

If this rev changes frequently, you might eventually want to centralise it (e.g. via a shared patch/workspace mechanism) to avoid touching a couple of dozen lines every time—but that is purely a convenience refactor.

A quick rg 'bc0e8b47a276efabb0b76169d13dfc9d5325953f' -n over the repo will confirm there are no stray dependencies still pointing at the old commit.

src/playground/PlaygroundLoader.tsx (1)

421-423: Consider the URL parameter parsing logic.

The current pattern prevents disabling this setting via URL when the default is true. The logic searchParams.get("...") === "true" || default means if the parameter is "false", it falls back to the default (true), making it impossible to override to false through the URL.

This pattern is consistent with other boolean settings in this file (e.g., bracketSpacing, allowComments), so it's a broader design consideration rather than an isolated issue.

Consider a pattern that respects explicit "false" values:

-			experimentalEmbeddedSnippetsEnabled:
-				searchParams.get("experimentalEmbeddedSnippetsEnabled") === "true" ||
-				defaultPlaygroundState.settings.experimentalEmbeddedSnippetsEnabled,
+			experimentalEmbeddedSnippetsEnabled:
+				searchParams.has("experimentalEmbeddedSnippetsEnabled")
+					? searchParams.get("experimentalEmbeddedSnippetsEnabled") === "true"
+					: defaultPlaygroundState.settings.experimentalEmbeddedSnippetsEnabled,

This would allow ?experimentalEmbeddedSnippetsEnabled=false to properly disable the feature.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34ef86e and 0ac6ed4.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • Cargo.toml (1 hunks)
  • codegen/src/lintdoc.rs (1 hunks)
  • codegen/src/website.rs (1 hunks)
  • package.json (1 hunks)
  • src/playground/PlaygroundLoader.tsx (1 hunks)
  • src/playground/tabs/SettingsTab.tsx (9 hunks)
  • src/playground/types.ts (2 hunks)
  • src/playground/workers/biomeWorker.ts (2 hunks)
  • src/playground/workers/prettierWorker.ts (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/playground/PlaygroundLoader.tsx (1)
src/playground/types.ts (1)
  • defaultPlaygroundState (213-253)
src/playground/tabs/SettingsTab.tsx (1)
src/playground/utils.ts (1)
  • createPlaygroundSettingsSetter (127-144)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - biomejs
  • GitHub Check: Header rules - biomejs
  • GitHub Check: Pages changed - biomejs
  • GitHub Check: test
🔇 Additional comments (6)
codegen/src/lintdoc.rs (1)

1698-1703: CSS parsing arm correctly adapts to new parse_css signature

Using DocumentFileSource::Css(file_source) and passing file_source into parse_css keeps options and downstream analysis intact while satisfying the updated API. Behaviour for diagnostics/actions remains consistent with the other language branches.

If you have a moment, double‑check that all other parse_css call sites in this repo also pass the file_source so you do not get a surprise compilation failure elsewhere.

package.json (1)

37-37: WASM rev bump is consistent with the Rust crates

Pointing @biomejs/wasm-web at bc0e8b4 lines up with the Cargo biome revs and should keep the playground and CLI behaviour in sync.

If you update the biome git rev again, it is worth grepping for bc0e8b4 in the repo to ensure you do not miss any pinned references.

src/playground/types.ts (1)

192-192: LGTM!

The new experimental flag is correctly typed and sensibly defaulted to true for the playground. The placement alongside other experimental settings is appropriate.

Also applies to: 248-248

src/playground/workers/prettierWorker.ts (1)

63-63: LGTM!

The Prettier integration correctly maps the experimental flag to embeddedLanguageFormatting: "auto" | "off". The threading through the worker message handler and function signature is clean and complete.

Also applies to: 86-86, 122-122, 155-157

src/playground/tabs/SettingsTab.tsx (1)

174-177: LGTM!

The UI integration is thorough and follows the established patterns. The checkbox label "Experimental embedded snippets support" clearly communicates the feature's experimental nature, and the placement within the syntax settings section is appropriate.

Also applies to: 385-390, 620-621, 635-636, 648-648, 699-712

src/playground/workers/biomeWorker.ts (1)

156-156: Remove experimentalEmbeddedSnippetsEnabled from the Biome configuration object.

experimentalEmbeddedSnippetsEnabled is not a valid Biome configuration option and does not exist in the official Biome schema. This setting is a playground-specific feature used for UI controls, not a Biome configuration parameter. It should not be passed to the Biome formatter configuration at all.

Likely an incorrect or invalid review comment.

@siketyan siketyan requested a review from a team as a code owner December 9, 2025 02:45
@siketyan siketyan force-pushed the feat/playground-embedded-snippets branch from 378a112 to 0ac6ed4 Compare December 9, 2025 02:46
@siketyan siketyan merged commit e654cdb into next Dec 9, 2025
11 checks passed
@siketyan siketyan deleted the feat/playground-embedded-snippets branch December 9, 2025 06:32
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.

1 participant