+
Skip to content

Conversation

ematipico
Copy link
Member

@ematipico ematipico commented Jul 16, 2025

Summary

This PR implements the parsing of single text expressions: { expr }.

I implemented some refactors, so the parsing of double expressions and single text expressions is more or less the same.

A new HtmlParseOptions type has been introduced, which exposes options for passing text expressions and the frontmatter. The options are set using From<HtmlFileSource> for HtmlParseOptions. This approach in line with what we do across the project.

Text expressions are formatted verbatim for now, so they are currently marked as unimplemented.

This is potentially a breaking change for users who have .html files that use {{ }}, because the parser now introduces a parsing error. In this PR, we introduce a new parsing option, which is released as experimental (the whole parser is experimental, so it's safe to assume that even the option is). By enabling this option, users can turn off the erros.

Test Plan

Added new tests and updated the current ones

Docs

  • Create a PR to document the new option

biomejs/website#2875

Copy link

changeset-bot bot commented Jul 16, 2025

🦋 Changeset detected

Latest commit: 8a81ca7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

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

@github-actions github-actions bot added A-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools L-HTML Language: HTML labels Jul 16, 2025
Copy link
Contributor

github-actions bot commented Jul 16, 2025

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 50627 50627 0
Passed 49357 49357 0
Failed 1270 1270 0
Panics 0 0 0
Coverage 97.49% 97.49% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6706 6706 0
Passed 2245 2245 0
Failed 4461 4461 0
Panics 0 0 0
Coverage 33.48% 33.48% 0.00%

ts/babel

Test result main count This PR count Difference
Total 822 822 0
Passed 731 731 0
Failed 91 91 0
Panics 0 0 0
Coverage 88.93% 88.93% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18786 18786 0
Passed 14413 14413 0
Failed 4373 4373 0
Panics 0 0 0
Coverage 76.72% 76.72% 0.00%

Copy link

codspeed-hq bot commented Jul 16, 2025

CodSpeed Performance Report

Merging #6907 will not alter performance

Comparing feat/html-text-expressions (6ae5ead) with main (3f436b8)1

Summary

✅ 128 untouched benchmarks

Footnotes

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

@ematipico ematipico force-pushed the feat/html-text-expressions branch from ffc9896 to 9108c28 Compare July 24, 2025 12:04
@ematipico ematipico changed the title feat(parser/html): astro text expressions feat(parser/html): text expressions in attributes Jul 24, 2025
Copy link
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

I really need help getting #5356 to land before more things that affect HTML land.

@ematipico ematipico force-pushed the feat/html-text-expressions branch 2 times, most recently from 278fcc3 to 16333d2 Compare August 5, 2025 09:09
@github-actions github-actions bot added the A-Project Area: project label Aug 5, 2025
@ematipico ematipico force-pushed the feat/html-text-expressions branch from 16333d2 to 5e91ac0 Compare August 5, 2025 09:58
@github-actions github-actions bot added the A-CLI Area: CLI label Aug 5, 2025
@ematipico ematipico force-pushed the feat/html-text-expressions branch from 5e91ac0 to ab153e3 Compare August 5, 2025 10:11
@ematipico ematipico marked this pull request as ready for review August 5, 2025 10:13
@ematipico ematipico requested review from a team and dyc3 August 5, 2025 10:13
@ematipico ematipico force-pushed the feat/html-text-expressions branch from ab153e3 to 76d7e0a Compare August 5, 2025 10:16
@ematipico ematipico force-pushed the feat/html-text-expressions branch from 76d7e0a to 3740f61 Compare August 5, 2025 11:55
Copy link
Contributor

coderabbitai bot commented Aug 6, 2025

Caution

Review failed

The head commit changed during the review from 8a81ca7 to 6ae5ead.

Walkthrough

This update introduces comprehensive support for interpolation syntax in HTML parsing, notably enabling double-brace expressions like {{ expression }} within .html files. The configuration for this feature is now exposed via a new interpolation option in both the JSON schema and TypeScript interfaces, and is plumbed through the Rust backend, parser, and formatter layers. The lexer and parser have been refactored to distinguish between single and double brace expressions, with new syntax nodes, error diagnostics, and formatting rules. Tests and benchmarks have been updated or added to cover these scenarios, and Svelte-specific text expression support has been removed.

Suggested labels

A-Linter, D-Vue

Suggested reviewers

  • dyc3
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/html-text-expressions

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 2

🧹 Nitpick comments (5)
crates/biome_html_parser/tests/html_specs/ok/multipe_expressions.vue (1)

1-3: Filename typo – drop the “e”.

multipe_expressions.vue is missing the second “l” in “multiple”. Renaming prevents head-scratching when someone hunts for the test later.

.changeset/brave-trees-push.md (1)

5-21: Solid changeset documentation with minor style tweak.

The experimental nature is well highlighted and the examples are clear. Consider "allows parsing of .html files" instead of "allows to parse .html files" for more natural phrasing.

-Added a new **experimental option** that allows to parse `.html` files that contain interpolation syntax.
+Added a new **experimental option** that allows parsing of `.html` files that contain interpolation syntax.
crates/biome_html_parser/src/lib.rs (1)

36-36: Complete or remove the incomplete documentation.

This orphaned /// comment should either be expanded with proper documentation for the parse_html function or removed entirely.

-///
 pub fn parse_html(source: &str, options: HtmlParseOptions) -> HtmlParse {
crates/biome_html_parser/src/lexer/mod.rs (2)

636-726: Comprehensive text parsing with escape handling.

The refactored method properly handles both double-brace expressions and escaped characters. Consider extracting the escape logic into a helper method if this grows further.


204-243: Consider adding rustdoc comments.

The new text expression methods would benefit from documentation explaining the difference between single and double expressions and their use cases.

@ematipico ematipico requested a review from dyc3 August 6, 2025 14:37
coderabbitai bot added a commit that referenced this pull request Aug 6, 2025
Docstrings generation was requested by @ematipico.

* #6907 (comment)

The following files were modified:

* `crates/biome_cli/tests/cases/html.rs`
* `crates/biome_html_formatter/benches/html_formatter.rs`
* `crates/biome_html_formatter/src/astro/auxiliary/expression.rs`
* `crates/biome_html_formatter/src/generated.rs`
* `crates/biome_html_formatter/src/html/any/attribute.rs`
* `crates/biome_html_formatter/src/html/any/attribute_initializer.rs`
* `crates/biome_html_formatter/src/html/any/text_expression.rs`
* `crates/biome_html_formatter/src/html/auxiliary/double_text_expression.rs`
* `crates/biome_html_formatter/src/html/auxiliary/single_text_expression.rs`
* `crates/biome_html_formatter/src/html/auxiliary/text_expression.rs`
* `crates/biome_html_formatter/src/html/lists/attribute_list.rs`
* `crates/biome_html_formatter/tests/language.rs`
* `crates/biome_html_parser/benches/html_parser.rs`
* `crates/biome_html_parser/src/lexer/mod.rs`
* `crates/biome_html_parser/src/lib.rs`
* `crates/biome_html_parser/src/parser.rs`
* `crates/biome_html_parser/src/syntax/mod.rs`
* `crates/biome_html_parser/src/syntax/parse_error.rs`
* `crates/biome_html_syntax/src/file_source.rs`
* `crates/biome_html_syntax/src/lib.rs`
* `crates/biome_parser/src/lib.rs`
* `crates/biome_service/src/file_handlers/html.rs`
* `crates/biome_service/src/settings.rs`

This comment was marked as resolved.

@jpike88
Copy link

jpike88 commented Aug 7, 2025

exciting development... can't wait to drop prettier for angular template support (specifically inline templates)

Screenshot 2025-08-07 at 10 15 01 AM

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: 3

♻️ Duplicate comments (2)
crates/biome_html_parser/src/parser.rs (1)

99-110: Enum duplication echoes earlier issue

Another private TextExpressionKind appears here, separate from the one in token_source.rs. Unifying them will avoid transmute-style casts later.

crates/biome_html_parser/src/lexer/mod.rs (1)

224-240: Single-brace scan has same nesting caveat

Same early-cut limitation as above – worth fixing in tandem.

🧹 Nitpick comments (3)
crates/biome_html_parser/src/token_source.rs (1)

131-145: Checkpoint rewind lacks invariant comments

rewind truncates trivia_list without restoring invariants on the trailing flag; future readers might wonder why this is safe. A brief comment would prevent head-scratching.

crates/biome_html_parser/src/parser.rs (1)

128-155: From<HtmlFileSource> exhaustiveness

If a new HtmlVariant is added later this match will silently compile with a wildcard arm. Add an explicit _ => unreachable!() or a compile-time exhaustive pattern to surface future misses.

crates/biome_html_parser/src/lexer/mod.rs (1)

547-553: Utility helpers could be const fn

Both brace-detection helpers are pure byte checks – mark them #[inline(always)] const for zero-cost in hot paths.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25fdf51 and 8032922.

⛔ Files ignored due to path filters (3)
  • crates/biome_html_parser/tests/html_specs/error/astro/attribute_expression.astro.snap is excluded by !**/*.snap
  • crates/biome_html_parser/tests/html_specs/error/vue_unclosed_expression.vue.snap is excluded by !**/*.snap
  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue.snap is excluded by !**/*.snap
📒 Files selected for processing (5)
  • crates/biome_html_parser/src/lexer/mod.rs (10 hunks)
  • crates/biome_html_parser/src/parser.rs (3 hunks)
  • crates/biome_html_parser/src/syntax/mod.rs (9 hunks)
  • crates/biome_html_parser/src/token_source.rs (6 hunks)
  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_html_parser/src/syntax/mod.rs
🧰 Additional context used
📓 Path-based instructions (3)
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue
  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
🧠 Learnings (29)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/specs/html/**/*.html : Create your first `.html` test file inside `tests/specs/html`, preferably organizing tests into subfolders by kind.

Applied to files:

  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue
  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue
  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/{spec_test.rs,spec_tests.rs,language.rs} : Inside the `biome_html_formatter` crate, create a `tests` folder containing a `specs` folder and the files `spec_test.rs`, `spec_tests.rs`, and `language.rs` for test infrastructure.

Applied to files:

  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/tests/specs/*/*/*.jsonc : Files ending with `.jsonc` in snapshot tests should contain arrays of code snippets for script environments.

Applied to files:

  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/token_source*.rs : Implement a token source as a thin layer wrapping the lexer, supporting lookahead, re-lexing, and checkpoint features.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Implement the `Lexer` trait from the `biome_parser` crate for your language-specific lexer struct.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Create a `lexer/mod.rs` file inside the parser crate for each language to implement the lexer.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, if a token is mandatory and the AST has that information, use the token from the AST node (e.g., `node.l_paren_token().format()`) instead of hardcoding the token (e.g., `token("(")`).

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new variant to `LanguageKind` in `language_kind.rs` for each new language, and implement all required methods for the new variant.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/context.rs : Define the `HtmlFormatContext` type inside a file called `context.rs`, including `comments` and `source_map` fields, and implement the `FormatContext` and `CstFormatContext` traits.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new prefix (e.g., `html_`) to `LANGUAGE_PREFIXES` in `language_kind.rs` for each new language.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Use conditional syntax handling to add diagnostics if a syntax is not supported in the current file or context, and wrap invalid syntax in a `BOGUS` node if necessary.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T13:25:32.395Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Applies to benches/html_formatter.rs : Benchmark for HTML formatter must be in `benches/html_formatter.rs`

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes for enclosing syntax errors must have the word `Bogus` in their name (e.g., `HtmlBogusAttribute`).

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/comments.rs : Define the `HtmlCommentStyle` type (as `HtmlComments`) inside a file called `comments.rs` and ensure it implements the `CommentStyle` trait.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Implement the `FormatLanguage` trait for the `HtmlFormatLanguage` type.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/src/*_kinds_src.rs : Create a new file called `src/<lang>_kinds_src.rs` for each language, which must return a static `KindSrc`.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/parser*.rs : Implement the `Parser` trait for your language-specific parser struct.

Applied to files:

  • crates/biome_html_parser/src/parser.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions should take a `&mut` reference to the parser as their only parameter and return a `ParsedSyntax`.

Applied to files:

  • crates/biome_html_parser/src/parser.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Rule options must be documented in the `## Options` section of the rule's documentation, with each option having its own header and example.

Applied to files:

  • crates/biome_html_parser/src/parser.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code when formatting AST nodes. If a mandatory token or node is missing, return `None` instead.

Applied to files:

  • crates/biome_html_parser/src/parser.rs
  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Create a type alias `HtmlFormatter<'buf>` as `Formatter<'buf, HtmlFormatContext>`.

Applied to files:

  • crates/biome_html_parser/src/parser.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : When parsing lists, perform error recovery to avoid infinite loops, using the provided parser infrastructure.

Applied to files:

  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Each code block in rule documentation must specify a language and use `expect_diagnostic` for invalid examples.

Applied to files:

  • crates/biome_html_parser/src/token_source.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Consult the grammar to identify the appropriate `BOGUS` node for error recovery in your parse rule.

Applied to files:

  • crates/biome_html_parser/src/token_source.rs
⏰ 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). (23)
  • GitHub Check: Parser conformance
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Check JS Files
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
🔇 Additional comments (2)
crates/biome_html_parser/tests/html_specs/ok/interpolation.vue (1)

1-13: Looks good – test file approved

The fixture exercises both simple and compound interpolations; no red flags.

crates/biome_html_parser/src/lexer/mod.rs (1)

492-502: Token kinds {{ / }} must exist

Ensure T!["{{"] and T!["}}"] are defined in the generated kinds; otherwise formatter parity and diagnostics will blow up.

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: 2

♻️ Duplicate comments (1)
crates/biome_html_parser/src/lexer/mod.rs (1)

224-240: Single-brace scanner mirrors the same limitation

The single-brace variant has identical early-exit behaviour. Re-use a shared brace-aware routine to avoid duplication and fix both paths in one hit.

🧹 Nitpick comments (1)
crates/biome_html_parser/src/lexer/mod.rs (1)

62-75: Minor: lots of repeated brace checks

The { / } branching logic is duplicated across three contexts. Once the scanners above are refactored, consider funnelling all brace handling through them to keep the lexing surface small.

Also applies to: 104-117, 636-726

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8032922 and 725753d.

⛔ Files ignored due to path filters (1)
  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • crates/biome_html_parser/src/lexer/mod.rs (10 hunks)
  • crates/biome_html_parser/src/parser.rs (3 hunks)
  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/biome_html_parser/tests/html_specs/ok/interpolation.vue
  • crates/biome_html_parser/src/parser.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_html_parser/src/lexer/mod.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_html_parser/src/lexer/mod.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_html_parser/src/lexer/mod.rs
🧠 Learnings (24)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Implement the `Lexer` trait from the `biome_parser` crate for your language-specific lexer struct.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/token_source*.rs : Implement a token source as a thin layer wrapping the lexer, supporting lookahead, re-lexing, and checkpoint features.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Create a `lexer/mod.rs` file inside the parser crate for each language to implement the lexer.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/context.rs : Define the `HtmlFormatContext` type inside a file called `context.rs`, including `comments` and `source_map` fields, and implement the `FormatContext` and `CstFormatContext` traits.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, if a token is mandatory and the AST has that information, use the token from the AST node (e.g., `node.l_paren_token().format()`) instead of hardcoding the token (e.g., `token("(")`).

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new prefix (e.g., `html_`) to `LANGUAGE_PREFIXES` in `language_kind.rs` for each new language.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Use conditional syntax handling to add diagnostics if a syntax is not supported in the current file or context, and wrap invalid syntax in a `BOGUS` node if necessary.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new variant to `LanguageKind` in `language_kind.rs` for each new language, and implement all required methods for the new variant.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code when formatting AST nodes. If a mandatory token or node is missing, return `None` instead.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : When parsing lists, perform error recovery to avoid infinite loops, using the provided parser infrastructure.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid deep indentation by using combinators like `map`, `filter`, and `and_then` instead of nested `if let` or `match` statements.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()`.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes for enclosing syntax errors must have the word `Bogus` in their name (e.g., `HtmlBogusAttribute`).

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Consult the grammar to identify the appropriate `BOGUS` node for error recovery in your parse rule.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T13:25:32.395Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Applies to benches/html_formatter.rs : Benchmark for HTML formatter must be in `benches/html_formatter.rs`

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/comments.rs : Define the `HtmlCommentStyle` type (as `HtmlComments`) inside a file called `comments.rs` and ensure it implements the `CommentStyle` trait.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Implement the `FormatLanguage` trait for the `HtmlFormatLanguage` type.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/src/*_kinds_src.rs : Create a new file called `src/<lang>_kinds_src.rs` for each language, which must return a static `KindSrc`.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
🪛 GitHub Actions: Pull request
crates/biome_html_parser/src/lexer/mod.rs

[error] 536-536: Cannot call non-const method <HtmlLexer as Lexer>::current_byte in constant functions; also PartialEq is not stable as const trait.


[error] 537-537: Cannot call non-const method <HtmlLexer as Lexer>::byte_at in constant functions; also PartialEq is not stable as const trait.


[error] 542-542: Cannot call non-const method <HtmlLexer as Lexer>::current_byte in constant functions; also PartialEq is not stable as const trait.


[error] 543-543: Cannot call non-const method <HtmlLexer as Lexer>::byte_at in constant functions; also PartialEq is not stable as const trait.


[error] 544-544: Cannot call non-const method <HtmlLexer as Lexer>::byte_at in constant functions; also PartialEq is not stable as const trait.


[error] 549-549: Cannot call non-const method <HtmlLexer as Lexer>::current_byte and <HtmlLexer as Lexer>::byte_at in constant functions; also PartialEq is not stable as const trait.


[error] 554-554: Cannot call non-const method <HtmlLexer as Lexer>::current_byte and <HtmlLexer as Lexer>::byte_at in constant functions; also PartialEq is not stable as const trait.

🪛 GitHub Actions: autofix.ci
crates/biome_html_parser/src/lexer/mod.rs

[error] 536-538: Cannot call non-const methods current_byte and byte_at in constant functions. Calls in constant functions are limited to const functions, tuple structs, and tuple variants.


[error] 542-544: Cannot call non-const methods current_byte and byte_at in constant functions. Calls in constant functions are limited to const functions, tuple structs, and tuple variants.


[error] 549-554: Cannot call non-const methods current_byte and byte_at in constant functions. Calls in constant functions are limited to const functions, tuple structs, and tuple variants.

⏰ 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). (18)
  • GitHub Check: Test Node.js API
  • GitHub Check: Check JS Files
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Parser conformance

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: 1

🔭 Outside diff range comments (1)
crates/biome_html_parser/src/syntax/mod.rs (1)

287-316: Single-brace attributes are parsed but never consumed

is_at_attribute_start now returns true on a solitary {, yet parse_attribute has no dedicated branch for that case – parse_literal bails out, no token is eaten, and the loop spins forever on the same {.

Either handle the spread-like construct explicitly or drop { from is_at_attribute_start for now:

     if p.at(T!["{{"]) {
         /* unchanged */
+    } else if p.at(T!['{']) {
+        HtmlSyntaxFeatures::SingleTextExpressions
+            .parse_exclusive_syntax(
+                p,
+                |p| parse_single_text_expression(p, HtmlLexContext::InsideTag),
+                |p, m| disabled_interpolation(p, m.range(p)),
+            )
+            .ok();
+        Present(m.complete(p, HTML_ATTRIBUTE))
     } else {
♻️ Duplicate comments (1)
crates/biome_html_parser/src/lexer/mod.rs (1)

204-222: Double-brace scan still naïve – already flagged earlier, still applies.
Nested braces/string literals break the lexer.

🧹 Nitpick comments (1)
crates/biome_html_parser/src/lexer/mod.rs (1)

534-555: Unnecessary &mut self in predicate helpers

at_end_cdata, is_at_frontmatter_edge, is_at_opening/closing_double_text_expression don’t mutate state – a shared reference is enough and conveys intent:

-fn at_end_cdata(&mut self) -> bool {
+fn at_end_cdata(&self) -> bool {

Same for the three other helpers above.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 725753d and bc680f7.

📒 Files selected for processing (3)
  • crates/biome_html_parser/src/lexer/mod.rs (10 hunks)
  • crates/biome_html_parser/src/parser.rs (3 hunks)
  • crates/biome_html_parser/src/syntax/mod.rs (9 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_html_parser/src/parser.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
🧠 Learnings (32)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/token_source*.rs : Implement a token source as a thin layer wrapping the lexer, supporting lookahead, re-lexing, and checkpoint features.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Implement the `Lexer` trait from the `biome_parser` crate for your language-specific lexer struct.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Create a `lexer/mod.rs` file inside the parser crate for each language to implement the lexer.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, if a token is mandatory and the AST has that information, use the token from the AST node (e.g., `node.l_paren_token().format()`) instead of hardcoding the token (e.g., `token("(")`).

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/context.rs : Define the `HtmlFormatContext` type inside a file called `context.rs`, including `comments` and `source_map` fields, and implement the `FormatContext` and `CstFormatContext` traits.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new prefix (e.g., `html_`) to `LANGUAGE_PREFIXES` in `language_kind.rs` for each new language.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Use conditional syntax handling to add diagnostics if a syntax is not supported in the current file or context, and wrap invalid syntax in a `BOGUS` node if necessary.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()`.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid deep indentation by using combinators like `map`, `filter`, and `and_then` instead of nested `if let` or `match` statements.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code when formatting AST nodes. If a mandatory token or node is missing, return `None` instead.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:35.163Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:35.163Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Prefer showing a rich advice like a code frame, diff, or command to a textual explanation when possible, as these are generally easier to understand and provide additional context.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Each code block in rule documentation must specify a language and use `expect_diagnostic` for invalid examples.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : When parsing lists, perform error recovery to avoid infinite loops, using the provided parser infrastructure.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When banning certain functions or variables, always check if the variable is global using the semantic model to avoid false positives.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T13:25:32.395Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Applies to benches/html_formatter.rs : Benchmark for HTML formatter must be in `benches/html_formatter.rs`

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_constant*_*.rs : Rules that report computations always evaluated to the same value should use the `noConstant<Concept>` naming convention (e.g., `noConstantMathMinMaxClamp`).

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes for enclosing syntax errors must have the word `Bogus` in their name (e.g., `HtmlBogusAttribute`).

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/comments.rs : Define the `HtmlCommentStyle` type (as `HtmlComments`) inside a file called `comments.rs` and ensure it implements the `CommentStyle` trait.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Implement the `FormatLanguage` trait for the `HtmlFormatLanguage` type.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/src/*_kinds_src.rs : Create a new file called `src/<lang>_kinds_src.rs` for each language, which must return a static `KindSrc`.

Applied to files:

  • crates/biome_html_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions should take a `&mut` reference to the parser as their only parameter and return a `ParsedSyntax`.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Consult the grammar to identify the appropriate `BOGUS` node for error recovery in your parse rule.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes that represent a list must end with the postfix `List` (e.g., `HtmlAttributeList`).

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions must return `Present` if they consume any token and can parse the node with at least some children, and return `Absent` otherwise without progressing the parser or adding errors.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/parser*.rs : Implement the `Parser` trait for your language-specific parser struct.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : All grammar nodes must start with the prefix of the language (e.g., `HtmlSimpleAttribute`).

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
⏰ 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). (26)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Check JS Files
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Parser conformance
🔇 Additional comments (1)
crates/biome_html_parser/src/syntax/mod.rs (1)

540-572: TextExpression::parse_element stops at first token

The helper eats exactly one token per call. That’s fine once it’s invoked in a loop (see previous comment), but by itself it cannot parse strings, numbers, operators, etc. Ensure the callers iterate or redesign this helper to ― well ― parse an expression.

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: 1

♻️ Duplicate comments (1)
crates/biome_html_parser/src/syntax/mod.rs (1)

446-448: Still parses only the first inner token

parse_double_text_expression and parse_single_text_expression call TextExpression::parse_element once, so {{ a + b }} or { a + b } stop at a, leaving the parser stuck on + b ….

-    TextExpression::new_double().parse_element(p).ok();
+    while TextExpression::new_double().parse_element(p).is_present() {}
...
-    TextExpression::new_single().parse_element(p).ok();
+    while TextExpression::new_single().parse_element(p).is_present() {}

Without the loop complex expressions break parsing and can trigger infinite-loops in recovery.
Same issue was flagged earlier but is still present.

Also applies to: 496-498

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2a1c7b and 2449eb5.

📒 Files selected for processing (2)
  • crates/biome_html_parser/src/lexer/mod.rs (12 hunks)
  • crates/biome_html_parser/src/syntax/mod.rs (9 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_html_parser/src/lexer/mod.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_html_parser/src/syntax/mod.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_html_parser/src/syntax/mod.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_html_parser/src/syntax/mod.rs
🧠 Learnings (23)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: For other documentation updates (e.g., new formatter options), create a PR against the `next` branch of the website repository.
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, if a token is mandatory and the AST has that information, use the token from the AST node (e.g., `node.l_paren_token().format()`) instead of hardcoding the token (e.g., `token("(")`).

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Use conditional syntax handling to add diagnostics if a syntax is not supported in the current file or context, and wrap invalid syntax in a `BOGUS` node if necessary.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions should take a `&mut` reference to the parser as their only parameter and return a `ParsedSyntax`.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code when formatting AST nodes. If a mandatory token or node is missing, return `None` instead.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/token_source*.rs : Implement a token source as a thin layer wrapping the lexer, supporting lookahead, re-lexing, and checkpoint features.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/context.rs : Define the `HtmlFormatContext` type inside a file called `context.rs`, including `comments` and `source_map` fields, and implement the `FormatContext` and `CstFormatContext` traits.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Each code block in rule documentation must specify a language and use `expect_diagnostic` for invalid examples.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes for enclosing syntax errors must have the word `Bogus` in their name (e.g., `HtmlBogusAttribute`).

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : When parsing lists, perform error recovery to avoid infinite loops, using the provided parser infrastructure.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Consult the grammar to identify the appropriate `BOGUS` node for error recovery in your parse rule.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes that represent a list must end with the postfix `List` (e.g., `HtmlAttributeList`).

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions must return `Present` if they consume any token and can parse the node with at least some children, and return `Absent` otherwise without progressing the parser or adding errors.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions must be prefixed with `parse_` and use the name defined in the grammar file (e.g., `parse_for_statement`).

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()`.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/parser*.rs : Implement the `Parser` trait for your language-specific parser struct.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/comments.rs : Define the `HtmlCommentStyle` type (as `HtmlComments`) inside a file called `comments.rs` and ensure it implements the `CommentStyle` trait.

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : All grammar nodes must start with the prefix of the language (e.g., `HtmlSimpleAttribute`).

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
📚 Learning: 2025-08-05T13:25:32.395Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Applies to benches/html_formatter.rs : Benchmark for HTML formatter must be in `benches/html_formatter.rs`

Applied to files:

  • crates/biome_html_parser/src/syntax/mod.rs
⏰ 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). (26)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Parser conformance
  • GitHub Check: Check JS Files
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: autofix

ematipico and others added 2 commits August 9, 2025 11:36
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@ematipico ematipico changed the base branch from main to next August 9, 2025 20:16
@ematipico ematipico merged commit 7331bb9 into next Aug 9, 2025
33 checks passed
@ematipico ematipico deleted the feat/html-text-expressions branch August 9, 2025 20:17
ematipico added a commit that referenced this pull request Aug 12, 2025
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

Co-authored-by: dyc3 <1808807+dyc3@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Formatter Area: formatter A-Parser Area: parser A-Project Area: project A-Tooling Area: internal tools L-HTML Language: HTML

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载