-
-
Notifications
You must be signed in to change notification settings - Fork 781
feat(html/svelte): parsing of new blocks #8023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 0e554fc The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| if !is_at_attribute_start(p) { | ||
| return Absent; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below I moved the if/else if/else blocks to a match
| p.expect_with_context(T!['}'], HtmlLexContext::InsideTag); | ||
| p.expect(T!['}']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We aren't inside the tag. It was a bug
|
|
||
| p.expect_with_context(keyword, HtmlLexContext::Svelte); | ||
|
|
||
| p.expect_with_context(T!['}'], HtmlLexContext::InsideTag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We aren't inside the tag. It was a bug
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
WalkthroughThis PR adds parsing and formatting support for four Svelte constructs: { Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (10)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (6)
crates/biome_html_parser/src/lexer/tests.rs (1)
366-379: LGTM! Consider expanding test coverage.The test correctly validates
single_expression()context handling. Token lengths match input strings exactly.For future iterations, consider edge cases like empty expressions or special characters—but the current coverage is sufficient for this PR.
.changeset/mean-carrots-peel.md (1)
5-5: Consider simplifying the wording.The static analysis tool suggests using "can" instead of "is able to" for more concise wording:
-Added support Svelte syntax `{@const}`. Biome now is able to parse and format the Svelte syntax [`{@const}`](https://svelte.dev/docs/svelte/@const): +Added support Svelte syntax `{@const}`. Biome can now parse and format the Svelte syntax [`{@const}`](https://svelte.dev/docs/svelte/@const):.changeset/brown-poets-sit.md (1)
5-5: Consider simplifying the wording.The static analysis tool suggests using "can" instead of "is able to" for more concise wording:
-Added support Svelte syntax `{@render}`. Biome now is able to parse and format the Svelte syntax [`{@render}`](https://svelte.dev/docs/svelte/@render): +Added support Svelte syntax `{@render}`. Biome can now parse and format the Svelte syntax [`{@render}`](https://svelte.dev/docs/svelte/@render):.changeset/all-tips-hang.md (1)
6-6: Consider simplifying the wording.The static analysis tool suggests using "can" instead of "is able to" for more concise wording:
-Added support Svelte syntax `{@html}`. Biome now is able to parse and format the Svelte syntax [`{@html}`](https://svelte.dev/docs/svelte/@html): +Added support Svelte syntax `{@html}`. Biome can now parse and format the Svelte syntax [`{@html}`](https://svelte.dev/docs/svelte/@html):.changeset/icy-planes-leave.md (1)
5-5: Consider simplifying the wording.You could replace "is able to parse" with "can parse" for brevity.
Apply this diff:
-Added support Svelte syntax `{@attach}`. Biome now is able to parse and format the Svelte syntax [`{@attach}`](https://svelte.dev/docs/svelte/@attach): +Added support Svelte syntax `{@attach}`. Biome can now parse and format the Svelte syntax [`{@attach}`](https://svelte.dev/docs/svelte/@attach):crates/biome_html_parser/src/syntax/svelte.rs (1)
139-199: Consider extracting common parsing logic.The functions
parse_html_block,parse_render_block, andparse_const_blockfollow an identical pattern:
- Check token
- Bump with
single_expressioncontext- Parse text expression
- Expect closing brace
- Complete with node type
Whilst the duplication is minor, a helper function could reduce maintenance burden:
fn parse_simple_at_block( p: &mut HtmlParser, marker: Marker, token: HtmlSyntaxKind, node_kind: HtmlSyntaxKind, ) -> ParsedSyntax { if !p.at(token) { return Absent; } p.bump_with_context(token, HtmlLexContext::single_expression()); TextExpression::new_single() .parse_element(p) .or_add_diagnostic(p, expected_text_expression); p.expect(T!['}']); Present(marker.complete(p, node_kind)) }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (18)
crates/biome_html_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_factory/src/generated/syntax_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_formatter/tests/specs/html/svelte/attach.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_formatter/tests/specs/html/svelte/const.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_formatter/tests/specs/html/svelte/html.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_formatter/tests/specs/html/svelte/render.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/error/svelte/attach.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/error/svelte/const.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/error/svelte/html.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/error/svelte/render.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/svelte/attach.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/svelte/const.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/svelte/html.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/svelte/render.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_syntax/src/generated/kind.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_syntax/src/generated/macros.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_syntax/src/generated/nodes_mut.rsis excluded by!**/generated/**,!**/generated/**and included by**
📒 Files selected for processing (34)
.changeset/all-tips-hang.md(1 hunks).changeset/brown-poets-sit.md(1 hunks).changeset/icy-planes-leave.md(1 hunks).changeset/light-toys-check.md(1 hunks).changeset/mean-carrots-peel.md(1 hunks)crates/biome_html_formatter/src/generated.rs(3 hunks)crates/biome_html_formatter/src/html/any/attribute.rs(1 hunks)crates/biome_html_formatter/src/html/lists/attribute_list.rs(1 hunks)crates/biome_html_formatter/src/svelte/any/block.rs(1 hunks)crates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rs(1 hunks)crates/biome_html_formatter/src/svelte/auxiliary/const_block.rs(1 hunks)crates/biome_html_formatter/src/svelte/auxiliary/html_block.rs(1 hunks)crates/biome_html_formatter/src/svelte/auxiliary/mod.rs(1 hunks)crates/biome_html_formatter/src/svelte/auxiliary/render_block.rs(1 hunks)crates/biome_html_formatter/tests/specs/html/svelte/attach.svelte(1 hunks)crates/biome_html_formatter/tests/specs/html/svelte/const.svelte(1 hunks)crates/biome_html_formatter/tests/specs/html/svelte/html.svelte(1 hunks)crates/biome_html_formatter/tests/specs/html/svelte/render.svelte(1 hunks)crates/biome_html_parser/src/lexer/mod.rs(2 hunks)crates/biome_html_parser/src/lexer/tests.rs(1 hunks)crates/biome_html_parser/src/syntax/mod.rs(6 hunks)crates/biome_html_parser/src/syntax/parse_error.rs(2 hunks)crates/biome_html_parser/src/syntax/svelte.rs(5 hunks)crates/biome_html_parser/tests/html_specs/error/svelte/attach.svelte(1 hunks)crates/biome_html_parser/tests/html_specs/error/svelte/const.svelte(1 hunks)crates/biome_html_parser/tests/html_specs/error/svelte/html.svelte(1 hunks)crates/biome_html_parser/tests/html_specs/error/svelte/render.svelte(1 hunks)crates/biome_html_parser/tests/html_specs/ok/svelte/attach.svelte(1 hunks)crates/biome_html_parser/tests/html_specs/ok/svelte/const.svelte(1 hunks)crates/biome_html_parser/tests/html_specs/ok/svelte/html.svelte(1 hunks)crates/biome_html_parser/tests/html_specs/ok/svelte/render.svelte(1 hunks)crates/biome_html_parser/tests/spec_test.rs(1 hunks)xtask/codegen/html.ungram(3 hunks)xtask/codegen/src/html_kinds_src.rs(2 hunks)
🧰 Additional context used
🧠 Learnings (35)
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/cst.rs : Create FormatHtmlSyntaxNode in cst.rs implementing FormatRule<HtmlSyntaxNode> and AsFormat/IntoFormat for HtmlSyntaxNode using the provided plumbing
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/html/lists/attribute_list.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import and use the `FormatNode` trait for AST nodes
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/html/lists/attribute_list.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/lib.rs : Implement FormatLanguage for HtmlFormatLanguage with associated types: SyntaxLanguage=HtmlLanguage, Context=HtmlFormatContext, FormatRule=FormatHtmlSyntaxNode
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_parser/src/syntax/parse_error.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/html/lists/attribute_list.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_parser/src/lexer/tests.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/**/*.rs : After generation, remove usages of `format_verbatim_node` and implement real formatting with biome_formatter utilities
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/tests/specs/html/svelte/html.sveltecrates/biome_html_parser/tests/spec_test.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/html/lists/attribute_list.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rscrates/biome_html_parser/tests/html_specs/ok/svelte/render.svelte
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Create tests/language.rs defining `HtmlTestFormatLanguage` and implement the TestFormatLanguage trait
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_parser/tests/html_specs/error/svelte/attach.sveltecrates/biome_html_formatter/tests/specs/html/svelte/html.sveltecrates/biome_html_parser/tests/spec_test.rscrates/biome_html_parser/tests/html_specs/ok/svelte/html.sveltecrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_parser/src/lexer/tests.rscrates/biome_html_parser/tests/html_specs/ok/svelte/const.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/const.sveltecrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rscrates/biome_html_formatter/tests/specs/html/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/html.svelte
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Unions of nodes must start with Any* (e.g., AnyHtmlAttribute)
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rsxtask/codegen/html.ungram
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Implement the `Format` trait for your node type and use `JsFormatter` with `write!`/`format_args!` to define formatting
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Bogus nodes must be part of a variant/union (e.g., AnyHtmlAttribute includes HtmlBogusAttribute)
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/html/lists/attribute_list.rsxtask/codegen/html.ungramcrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/context.rs : Create HtmlFormatContext in context.rs with comments and source_map fields and implement FormatContext and CstFormatContext
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/lib.rs : Define the HtmlFormatter type alias: `type HtmlFormatter<'buf> = Formatter<'buf, HtmlFormatContext>;`
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/lib.rs : Expose a documented public function `format_node(options: HtmlFormatOptions, root: &HtmlSyntaxNode) -> FormatResult<Formatted<HtmlFormatContext>>` delegating to `biome_formatter::format_node`
Applied to files:
crates/biome_html_formatter/src/html/any/attribute.rscrates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rscrates/biome_html_formatter/src/generated.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to fix code; if a mandatory token/node is missing, return `None` instead
Applied to files:
crates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_parser/tests/spec_test.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When a token is mandatory and present in the AST, use the AST-provided token (e.g., `node.l_paren_token().format()`) instead of emitting a static token
Applied to files:
crates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_formatter/src/svelte/auxiliary/render_block.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_parser/src/lexer/tests.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/html_block.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/lib.rs : Add the provided AsFormat, IntoFormat, and iterator plumbing code to lib.rs
Applied to files:
crates/biome_html_formatter/src/svelte/any/block.rscrates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rscrates/biome_html_formatter/src/generated.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/tests/specs/html/**/*.html : Place HTML test cases under tests/specs/html as .html files discovered by the test macro
Applied to files:
crates/biome_html_parser/tests/html_specs/error/svelte/attach.sveltecrates/biome_html_formatter/tests/specs/html/svelte/html.sveltecrates/biome_html_parser/tests/spec_test.rscrates/biome_html_parser/tests/html_specs/ok/svelte/html.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/render.sveltecrates/biome_html_formatter/tests/specs/html/svelte/const.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/const.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/const.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/attach.sveltecrates/biome_html_formatter/tests/specs/html/svelte/render.sveltecrates/biome_html_formatter/tests/specs/html/svelte/attach.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/html.svelte
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : In tests/spec_tests.rs, generate tests with `tests_macros::gen_tests! {"tests/specs/html/**/*.html", crate::spec_test::run, ""}`
Applied to files:
crates/biome_html_parser/tests/html_specs/error/svelte/attach.sveltecrates/biome_html_formatter/tests/specs/html/svelte/html.sveltecrates/biome_html_parser/tests/spec_test.rscrates/biome_html_parser/tests/html_specs/ok/svelte/html.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/render.sveltecrates/biome_html_formatter/tests/specs/html/svelte/const.sveltecrates/biome_html_parser/src/lexer/tests.rscrates/biome_html_parser/tests/html_specs/ok/svelte/const.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/const.sveltecrates/biome_html_formatter/src/svelte/auxiliary/mod.rscrates/biome_html_formatter/tests/specs/html/svelte/render.sveltecrates/biome_html_formatter/tests/specs/html/svelte/attach.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/html.svelte
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/tests/** : Create a tests directory containing a specs subfolder and the files spec_test.rs, spec_tests.rs, and language.rs
Applied to files:
crates/biome_html_parser/tests/html_specs/error/svelte/attach.sveltecrates/biome_html_formatter/tests/specs/html/svelte/html.sveltecrates/biome_html_parser/tests/spec_test.rscrates/biome_html_parser/tests/html_specs/ok/svelte/html.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/const.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/const.sveltecrates/biome_html_formatter/tests/specs/html/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/html.svelte
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in ../biome_lsp/src/server.tests.rs
Applied to files:
crates/biome_html_parser/tests/html_specs/error/svelte/attach.sveltecrates/biome_html_parser/tests/spec_test.rscrates/biome_html_parser/tests/html_specs/error/svelte/const.sveltecrates/biome_html_formatter/tests/specs/html/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/error/svelte/html.svelte
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/tests/spec_test.rs : Implement a `run` function in tests/spec_test.rs that wires SpecSnapshot and includes!("language.rs") as shown
Applied to files:
crates/biome_html_parser/tests/html_specs/error/svelte/attach.sveltecrates/biome_html_formatter/tests/specs/html/svelte/html.sveltecrates/biome_html_parser/tests/spec_test.rscrates/biome_html_formatter/tests/specs/html/svelte/render.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/render.svelte
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Place watcher tests related to workspace methods in src/workspace/watcher.tests.rs
Applied to files:
crates/biome_html_parser/tests/spec_test.rscrates/biome_html_parser/tests/html_specs/error/svelte/const.svelte
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes for enclosing syntax errors must include the Bogus word (e.g., HtmlBogusAttribute)
Applied to files:
crates/biome_html_parser/src/syntax/parse_error.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Use p.eat for optional tokens, p.expect for required tokens; use .ok() for optional nodes and .or_add_diagnostic(...) for required nodes
Applied to files:
crates/biome_html_parser/src/syntax/parse_error.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/syntax/svelte.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Add a new LanguageKind variant (e.g., Html) in language_kind.rs and implement/cover all methods
Applied to files:
xtask/codegen/src/html_kinds_src.rscrates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/xtask/codegen/src/*_kinds_src.rs : Add src/<lang>_kinds_src.rs under xtask/codegen that returns a static KindSrc
Applied to files:
xtask/codegen/src/html_kinds_src.rscrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Add a new language prefix (e.g., html_) to LANGUAGE_PREFIXES in language_kind.rs
Applied to files:
xtask/codegen/src/html_kinds_src.rscrates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For non-mandatory tokens, use the provided helper constructors (e.g., `token`, `space_token`, `dynamic_token`)
Applied to files:
crates/biome_html_formatter/src/svelte/auxiliary/const_block.rscrates/biome_html_parser/src/lexer/tests.rscrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/{type_info,local_inference,resolver,flattening}.rs : Avoid recursive type structures and cross-module Arcs; represent links between types using TypeReference and TypeData::Reference.
Applied to files:
crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/crates/biome_*_{syntax,factory}/** : Create per-language crates biome_<lang>_syntax and biome_<lang>_factory under crates/
Applied to files:
crates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/syntax/svelte.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Lexer must implement the biome_parser::Lexer trait
Applied to files:
crates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/lexer/tests.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/comments.rs : Expose a public HtmlComments type alias: `pub type HtmlComments = Comments<HtmlLanguage>;`
Applied to files:
crates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Parse rules should return ParsedSyntax; return Absent without consuming tokens when the node cannot be predicted
Applied to files:
crates/biome_html_parser/src/syntax/svelte.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/crates/**/src/lexer/mod.rs : Create a lexer module at crates/<parser_crate>/src/lexer/mod.rs
Applied to files:
crates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/comments.rs : Define HtmlCommentStyle implementing CommentStyle in comments.rs
Applied to files:
crates/biome_html_parser/src/lexer/mod.rscrates/biome_html_formatter/src/generated.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/**/*.rs : Do not copy or clone data between module graph entries (including behind Arc). Each module must avoid holding duplicated data from another module to enable simple invalidation.
Applied to files:
crates/biome_html_formatter/src/svelte/auxiliary/mod.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use `dbg_write!` to debug and inspect the emitted IR during formatting
Applied to files:
crates/biome_html_formatter/src/svelte/auxiliary/mod.rs
🧬 Code graph analysis (10)
crates/biome_html_parser/src/syntax/parse_error.rs (1)
crates/biome_parser/src/diagnostic.rs (1)
expected_node(481-483)
crates/biome_html_formatter/src/svelte/auxiliary/const_block.rs (4)
crates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rs (1)
fmt_fields(7-24)crates/biome_html_formatter/src/svelte/auxiliary/html_block.rs (1)
fmt_fields(7-24)crates/biome_html_formatter/src/svelte/auxiliary/render_block.rs (1)
fmt_fields(7-24)crates/biome_html_syntax/src/generated/nodes.rs (21)
sv_curly_at_token(874-876)sv_curly_at_token(924-926)sv_curly_at_token(974-976)sv_curly_at_token(1024-1026)sv_curly_at_token(1249-1251)const_token(927-929)expression(441-443)expression(726-728)expression(880-882)expression(930-932)expression(1030-1032)expression(1170-1172)expression(1255-1257)r_curly_token(729-731)r_curly_token(883-885)r_curly_token(933-935)r_curly_token(983-985)r_curly_token(1033-1035)r_curly_token(1124-1126)r_curly_token(1173-1175)r_curly_token(1258-1260)
crates/biome_html_formatter/src/html/lists/attribute_list.rs (2)
crates/biome_html_formatter/src/generated.rs (16)
format(28-33)format(66-71)format(104-109)format(142-144)format(174-179)format(212-217)format(250-255)format(288-293)format(326-331)format(364-370)format(404-409)format(442-447)format(480-485)format(512-517)format(550-555)format(588-594)crates/biome_html_formatter/src/html/any/attribute.rs (1)
fmt(9-17)
crates/biome_html_formatter/src/svelte/auxiliary/render_block.rs (4)
crates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rs (1)
fmt_fields(7-24)crates/biome_html_formatter/src/svelte/auxiliary/const_block.rs (1)
fmt_fields(7-24)crates/biome_html_formatter/src/svelte/auxiliary/html_block.rs (1)
fmt_fields(7-24)crates/biome_html_syntax/src/generated/nodes.rs (21)
sv_curly_at_token(874-876)sv_curly_at_token(924-926)sv_curly_at_token(974-976)sv_curly_at_token(1024-1026)sv_curly_at_token(1249-1251)render_token(1252-1254)expression(441-443)expression(726-728)expression(880-882)expression(930-932)expression(1030-1032)expression(1170-1172)expression(1255-1257)r_curly_token(729-731)r_curly_token(883-885)r_curly_token(933-935)r_curly_token(983-985)r_curly_token(1033-1035)r_curly_token(1124-1126)r_curly_token(1173-1175)r_curly_token(1258-1260)
crates/biome_html_parser/src/syntax/mod.rs (2)
crates/biome_html_parser/src/syntax/svelte.rs (3)
parse_attach_attribute(169-184)parse_svelte_at_block(108-125)parse_svelte_hash_block(20-27)crates/biome_html_parser/src/syntax/parse_error.rs (3)
disabled_interpolation(12-14)disabled_svelte_prop(16-18)expected_closing_text_expression(20-33)
crates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rs (4)
crates/biome_html_formatter/src/svelte/auxiliary/const_block.rs (1)
fmt_fields(7-24)crates/biome_html_formatter/src/svelte/auxiliary/html_block.rs (1)
fmt_fields(7-24)crates/biome_html_formatter/src/svelte/auxiliary/render_block.rs (1)
fmt_fields(7-24)crates/biome_html_syntax/src/generated/nodes.rs (21)
sv_curly_at_token(874-876)sv_curly_at_token(924-926)sv_curly_at_token(974-976)sv_curly_at_token(1024-1026)sv_curly_at_token(1249-1251)attach_token(877-879)expression(441-443)expression(726-728)expression(880-882)expression(930-932)expression(1030-1032)expression(1170-1172)expression(1255-1257)r_curly_token(729-731)r_curly_token(883-885)r_curly_token(933-935)r_curly_token(983-985)r_curly_token(1033-1035)r_curly_token(1124-1126)r_curly_token(1173-1175)r_curly_token(1258-1260)
crates/biome_html_parser/src/lexer/tests.rs (1)
crates/biome_html_parser/src/token_source.rs (1)
single_expression(59-61)
crates/biome_html_parser/src/syntax/svelte.rs (3)
crates/biome_html_parser/src/syntax/parse_error.rs (3)
expected_child(39-41)expected_svelte_closing_block(100-102)expected_text_expression(35-37)crates/biome_html_parser/src/syntax/mod.rs (2)
parse_html_element(216-247)new_single(558-562)crates/biome_html_parser/src/token_source.rs (1)
single_expression(59-61)
crates/biome_html_formatter/src/svelte/auxiliary/html_block.rs (4)
crates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rs (1)
fmt_fields(7-24)crates/biome_html_formatter/src/svelte/auxiliary/const_block.rs (1)
fmt_fields(7-24)crates/biome_html_formatter/src/svelte/auxiliary/render_block.rs (1)
fmt_fields(7-24)crates/biome_html_syntax/src/generated/nodes.rs (22)
sv_curly_at_token(874-876)sv_curly_at_token(924-926)sv_curly_at_token(974-976)sv_curly_at_token(1024-1026)sv_curly_at_token(1249-1251)html_token(382-384)html_token(1027-1029)expression(441-443)expression(726-728)expression(880-882)expression(930-932)expression(1030-1032)expression(1170-1172)expression(1255-1257)r_curly_token(729-731)r_curly_token(883-885)r_curly_token(933-935)r_curly_token(983-985)r_curly_token(1033-1035)r_curly_token(1124-1126)r_curly_token(1173-1175)r_curly_token(1258-1260)
crates/biome_html_formatter/src/generated.rs (2)
crates/biome_html_syntax/src/file_source.rs (1)
svelte(96-100)crates/biome_html_formatter/src/lib.rs (10)
format(51-51)format(64-66)format(81-86)format(101-103)format(297-299)new(146-148)into_format(112-112)into_format(121-123)into_format(135-137)into_format(305-307)
🪛 LanguageTool
.changeset/icy-planes-leave.md
[style] ~5-~5: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...rt Svelte syntax {@attach}. Biome now is able to parse and format the Svelte syntax [`{@...
(BE_ABLE_TO)
.changeset/all-tips-hang.md
[style] ~6-~6: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...port Svelte syntax {@html}. Biome now is able to parse and format the Svelte syntax [`{@...
(BE_ABLE_TO)
.changeset/mean-carrots-peel.md
[style] ~5-~5: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...ort Svelte syntax {@const}. Biome now is able to parse and format the Svelte syntax [`{@...
(BE_ABLE_TO)
.changeset/brown-poets-sit.md
[style] ~5-~5: As a shorter alternative for ‘able to’, consider using “can”.
Context: ...rt Svelte syntax {@render}. Biome now is able to parse and format the Svelte syntax [`{@...
(BE_ABLE_TO)
⏰ 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). (10)
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: End-to-end tests
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
- GitHub Check: autofix
- GitHub Check: Parser conformance
🔇 Additional comments (33)
crates/biome_html_parser/src/lexer/tests.rs (1)
336-364: LGTM! Context change aligns with Svelte block parsing.The shift from
InsideTagtoRegularcontext for Svelte opening tests correctly reflects that these constructs appear in regular HTML content rather than being confined to tag contexts.crates/biome_html_parser/tests/html_specs/error/svelte/attach.svelte (1)
1-1: LGTM!This error test case correctly exercises the parser's handling of a malformed
{@attach}directive missing its expression.crates/biome_html_parser/tests/html_specs/error/svelte/render.svelte (1)
1-1: LGTM!This error test case correctly exercises the parser's handling of an unclosed
{@render}block.crates/biome_html_parser/tests/html_specs/error/svelte/const.svelte (1)
1-1: LGTM!This error test case correctly exercises the parser's handling of an unclosed
{@const}block.crates/biome_html_parser/tests/html_specs/error/svelte/html.svelte (1)
1-1: LGTM!This error test case correctly exercises the parser's handling of an unclosed
{@html}block.crates/biome_html_parser/src/syntax/parse_error.rs (1)
20-37: Well-structured refactoring.The separation of concerns is spot on:
expected_closing_text_expressionprovides contextual diagnostics for unclosed expressionsexpected_text_expressionoffers a simpler, general-purpose diagnostic for missing expressionsThe implementation correctly delegates to
expected_node, maintaining consistency with other diagnostic helpers in this file.crates/biome_html_formatter/tests/specs/html/svelte/const.svelte (1)
1-1: Appropriate test fixture for{@const}directive.The test case is minimal and suitable for validating const block parsing and formatting.
crates/biome_html_parser/tests/html_specs/ok/svelte/render.svelte (1)
1-1: Appropriate test fixture for{@render}directive.The test case covers the render block parsing path.
crates/biome_html_formatter/src/html/lists/attribute_list.rs (1)
72-74: Proper integration ofSvelteAttachAttribute.The match arm follows the established pattern for attribute formatting.
crates/biome_html_formatter/src/svelte/any/block.rs (1)
12-16: Proper integration of new Svelte block variants.The three new match arms follow the established formatting pattern consistently.
crates/biome_html_formatter/tests/specs/html/svelte/render.svelte (1)
1-1: Appropriate formatter test fixture for{@render}directive.The test case validates render block formatting behaviour.
crates/biome_html_parser/tests/html_specs/ok/svelte/html.svelte (1)
1-5: Good test coverage for{@html}directive.The test cases cover both standalone and inline usage patterns effectively.
crates/biome_html_formatter/src/html/any/attribute.rs (1)
15-15: Proper integration ofSvelteAttachAttributevariant.The match arm follows the established pattern for attribute formatting.
xtask/codegen/src/html_kinds_src.rs (1)
24-26: LGTM!The new keywords and node kinds are consistent with the Svelte directives being added. Nicely aligned with the grammar definitions.
Also applies to: 68-71
crates/biome_html_parser/tests/html_specs/ok/svelte/attach.svelte (1)
1-16: LGTM!Good test coverage for the
{@attach}directive—simple, function call, and callback scenarios all represented.crates/biome_html_parser/tests/html_specs/ok/svelte/const.svelte (1)
1-1: LGTM!Simple and sufficient for exercising the
{@const}parsing path.crates/biome_html_formatter/tests/specs/html/svelte/html.svelte (1)
1-5: LGTM!Test cases nicely cover dynamic and literal HTML injection scenarios for
{@html}.crates/biome_html_parser/tests/spec_test.rs (1)
145-145: LGTM!Quick test now exercises the new
{@html}directive parsing—good choice for a smoke test.crates/biome_html_formatter/tests/specs/html/svelte/attach.svelte (1)
1-16: LGTM!Formatter test cases mirror the parser tests appropriately—good consistency.
xtask/codegen/html.ungram (3)
165-165: LGTM!Correctly adds
SvelteAttachAttributeto the attribute union—this is the right place for it since it appears as an element attribute.
196-198: LGTM!The new Svelte blocks are properly added to the union alongside existing blocks.
235-265: LGTM!Grammar definitions for all four new Svelte directives are consistent and follow the established pattern. Clean and straightforward.
crates/biome_html_formatter/src/svelte/auxiliary/mod.rs (1)
1-11: LGTM!Module declarations are correctly structured and follow the codebase pattern.
crates/biome_html_formatter/src/svelte/auxiliary/attach_attribute.rs (1)
1-25: LGTM!The formatter implementation is consistent with the other Svelte block formatters and correctly orders tokens.
crates/biome_html_formatter/src/svelte/auxiliary/const_block.rs (1)
1-25: LGTM!Implementation follows the established pattern for Svelte block formatters.
crates/biome_html_formatter/src/svelte/auxiliary/html_block.rs (1)
1-25: LGTM!Formatter implementation is consistent with the established pattern.
crates/biome_html_formatter/src/svelte/auxiliary/render_block.rs (1)
1-25: LGTM!Implementation follows the consistent pattern across all Svelte block formatters.
crates/biome_html_parser/src/syntax/mod.rs (3)
354-354: LGTM!The feature-gated check for
{@tokens is correctly integrated.
488-544: LGTM!The diagnostic function rename to
expected_closing_text_expressionwith opening range context improves error reporting.
315-350: Asymmetry in attribute node wrapping confirmed—needs justification.The
T!["{{"]branch wraps its expression result inHTML_ATTRIBUTE, whilstT!['{']andT!["{@"]return the expression node directly:
parse_double_text_expressioncompletes asHTML_DOUBLE_TEXT_EXPRESSION→ wrapped inHTML_ATTRIBUTE(line 326)parse_single_text_expressioncompletes asHTML_SINGLE_TEXT_EXPRESSION→ returned directly (line 332)parse_attach_attributecompletes asSVELTE_ATTACH_ATTRIBUTE→ returned directly (line 336)Since
parse_attributeis meant to parse attributes, all three should probably have consistent node wrapping. Either wrap all three or refactor the inner functions to handle wrapping themselves. Clarify the intended structure.crates/biome_html_parser/src/lexer/mod.rs (1)
426-444: LGTM!The Svelte keyword recognition logic correctly extends support for the new directives whilst preserving existing behaviour for
{#and{/contexts.crates/biome_html_parser/src/syntax/svelte.rs (1)
169-184: LGTM!The
parse_attach_attributefunction correctly differs from block parsers by managing its own marker and usingHtmlLexContext::InsideTagfor the closing brace, as it represents an attribute rather than a content block.crates/biome_html_formatter/src/generated.rs (1)
719-756: LGTM – correctly generated formatter infrastructure.The four new Svelte node types (SvelteAttachAttribute, SvelteConstBlock, SvelteHtmlBlock, SvelteRenderBlock) are properly integrated using the established FormatRule/AsFormat/IntoFormat pattern, consistent with existing implementations in this generated file.
Also applies to: 757-794, 833-870, 1019-1056
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary
Closes #8014
Closes #8015
Closes #8016
Closes #8017
The implementation fo these new blocks/attributes was fairly simple and standard.
Test Plan
Added various tests
Docs
N/A