feat(playground): support embedded snippets#3626
Conversation
✅ Deploy Preview for biomejs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughThis PR updates Biome dependencies to a new git revision across Cargo.toml and package.json. It also introduces a new Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
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.jsComment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
codegen/src/website.rs (1)
127-133: Avoid magic boolean informat_nodecallThe extra
falseis 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_nodedocs thatfalsematches the old default, to avoid unintentional schema formatting changes.Cargo.toml (1)
19-61: Biome git rev bump is consistent across all cratesAll
biome_*(andxtask_codegen) dependencies now point at the samebc0e8b47…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' -nover 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 logicsearchParams.get("...") === "true" || defaultmeans if the parameter is"false", it falls back to the default (true), making it impossible to override tofalsethrough 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=falseto properly disable the feature.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.lockpnpm-lock.yamlis 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 newparse_csssignatureUsing
DocumentFileSource::Css(file_source)and passingfile_sourceintoparse_csskeeps 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_csscall sites in this repo also pass thefile_sourceso you do not get a surprise compilation failure elsewhere.package.json (1)
37-37: WASM rev bump is consistent with the Rust cratesPointing
@biomejs/wasm-webatbc0e8b4lines 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
bc0e8b4in 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
truefor 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.
experimentalEmbeddedSnippetsEnabledis 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.
378a112 to
0ac6ed4
Compare
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.