feat(parse/html/svelte): new svelte syntax for comments inside tags#9173
feat(parse/html/svelte): new svelte syntax for comments inside tags#9173
Conversation
🦋 Changeset detectedLatest commit: cf6d75a 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 |
Merging this PR will improve performance by 13.13%
Performance Changes
Comparing Footnotes
|
WalkthroughThis PR adds Svelte-aware JS-style comment support inside tag attributes. Changes include a new lexing context Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_html_parser/src/syntax/mod.rs (1)
484-495:⚠️ Potential issue | 🟠 MajorSvelte comment support can break after
{…}attributes.
parse_svelte_spread_or_expressionre-lexes withInsideTag, so after a{…}attribute the lexer dropsInsideTagSvelteand JS-style comments inside the tag won’t be tokenised. That undermines the new inside-tag comment support when a comment follows an expression. Consider preservingInsideTagSveltewhen Svelte is enabled.🛠️ Suggested fix (in `crates/biome_html_parser/src/syntax/svelte.rs`)
pub(crate) fn parse_svelte_spread_or_expression(p: &mut HtmlParser) -> ParsedSyntax { if !SingleTextExpressions.is_supported(p) { return Absent; } @@ - if p.at(T![...]) { + let tag_ctx = if HtmlSyntaxFeatures::Svelte.is_supported(p) { + HtmlLexContext::InsideTagSvelte + } else { + HtmlLexContext::InsideTag + }; + + if p.at(T![...]) { p.bump_with_context(T![...], HtmlLexContext::single_expression()); @@ - p.expect_with_context(T!['}'], HtmlLexContext::InsideTag); + p.expect_with_context(T!['}'], tag_ctx); Present(m.complete(p, HTML_SPREAD_ATTRIBUTE)) } else { p.rewind(checkpoint); m.abandon(p); - parse_single_text_expression(p, HtmlLexContext::InsideTag) + parse_single_text_expression(p, tag_ctx) } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_html_parser/src/syntax/mod.rs` around lines 484 - 495, The Svelte expression parser parse_svelte_spread_or_expression currently re-lexes with InsideTag, which drops InsideTagSvelte and prevents JS-style comments inside tags from being tokenized; update parse_svelte_spread_or_expression (or add a variant) to preserve or restore the InsideTagSvelte lexer mode when Svelte.is_supported is true so that comments after `{…}` attributes remain tokenized; adjust Svelte.parse_exclusive_syntax call sites (and disabled_svelte fallback) to use the preserving variant so the lexer state remains InsideTagSvelte across the re-lexing boundary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@crates/biome_html_parser/src/syntax/mod.rs`:
- Around line 484-495: The Svelte expression parser
parse_svelte_spread_or_expression currently re-lexes with InsideTag, which drops
InsideTagSvelte and prevents JS-style comments inside tags from being tokenized;
update parse_svelte_spread_or_expression (or add a variant) to preserve or
restore the InsideTagSvelte lexer mode when Svelte.is_supported is true so that
comments after `{…}` attributes remain tokenized; adjust
Svelte.parse_exclusive_syntax call sites (and disabled_svelte fallback) to use
the preserving variant so the lexer state remains InsideTagSvelte across the
re-lexing boundary.
e5b8705 to
a9fe2c0
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_html_parser/src/syntax/mod.rs (1)
447-469:⚠️ Potential issue | 🟡 MinorDuplicate match arms for
T!["{{"].Lines 447-457 and 458-469 both match
T!["{{"]. This appears to be a merge artefact — the first arm will always be taken, making the second unreachable.🐛 Suggested fix: remove the duplicate arm
match p.cur() { T!["{{"] => { let m = p.start(); DoubleTextExpressions .parse_exclusive_syntax( p, |p| parse_double_text_expression(p, HtmlLexContext::InsideTag), |p, marker| disabled_interpolation(p, marker.range(p)), ) .ok(); Present(m.complete(p, HTML_ATTRIBUTE)) } - T!["{{"] => { - let m = p.start(); - HtmlSyntaxFeatures::DoubleTextExpressions - .parse_exclusive_syntax( - p, - |p| parse_double_text_expression(p, HtmlLexContext::InsideTag), - |p, marker| disabled_interpolation(p, marker.range(p)), - ) - .ok(); - - Present(m.complete(p, HTML_ATTRIBUTE)) - } // Check for Astro directives before Vue colon shorthand🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_html_parser/src/syntax/mod.rs` around lines 447 - 469, There are duplicate match arms for T!["{{"] — remove the redundant arm so only one T!["{{"] branch remains; specifically delete the first arm that uses the bare DoubleTextExpressions and keep the namespaced HtmlSyntaxFeatures::DoubleTextExpressions variant (which calls parse_double_text_expression and disabled_interpolation and completes with Present(m.complete(p, HTML_ATTRIBUTE))) to avoid the unreachable duplicate and preserve the intended feature check.
🧹 Nitpick comments (1)
crates/biome_html_parser/src/lexer/mod.rs (1)
1500-1503: Consider extractingis_linebreakto a shared location.This function duplicates the one in
crates/biome_js_parser/src/lexer/mod.rs(lines 2071-2073). If more parsers need JS-style comment handling, it might be worth extracting to a common utility crate.Not blocking — just a thought for future maintenance.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_html_parser/src/lexer/mod.rs` around lines 1500 - 1503, The is_linebreak function is duplicated; extract it into a shared utility (e.g., a common crate or shared module) and replace the local implementations with a single public function (is_linebreak) imported where needed; update calls in biome_html_parser::lexer::is_linebreak and the other lexer that currently duplicates it to use the shared utility, ensure the function signature and visibility are appropriate (pub(crate) or pub) and run cargo check to confirm no remaining duplicates or visibility errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@crates/biome_html_parser/src/syntax/mod.rs`:
- Around line 447-469: There are duplicate match arms for T!["{{"] — remove the
redundant arm so only one T!["{{"] branch remains; specifically delete the first
arm that uses the bare DoubleTextExpressions and keep the namespaced
HtmlSyntaxFeatures::DoubleTextExpressions variant (which calls
parse_double_text_expression and disabled_interpolation and completes with
Present(m.complete(p, HTML_ATTRIBUTE))) to avoid the unreachable duplicate and
preserve the intended feature check.
---
Nitpick comments:
In `@crates/biome_html_parser/src/lexer/mod.rs`:
- Around line 1500-1503: The is_linebreak function is duplicated; extract it
into a shared utility (e.g., a common crate or shared module) and replace the
local implementations with a single public function (is_linebreak) imported
where needed; update calls in biome_html_parser::lexer::is_linebreak and the
other lexer that currently duplicates it to use the shared utility, ensure the
function signature and visibility are appropriate (pub(crate) or pub) and run
cargo check to confirm no remaining duplicates or visibility errors.
ematipico
left a comment
There was a problem hiding this comment.
Code-wise, it looks ok. I would add more few more tests as I highlighted in one of my commenets
...iome_html_parser/tests/html_specs/error/svelte/unterminated_js_multiline_comment.svelte.snap
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,31 @@ | |||
| <button | |||
There was a problem hiding this comment.
Not sure if it's valid or not, I leave that to you, but we should add tests for inline comments
<div /*i am a comment*/ class=""></div>If this is valid syntax, we must update formatting, and maybe collapse the attribute(s) on multiple lines
There was a problem hiding this comment.
We actually don't completely know what the upstream formatting is going to look like because prettier-plugin-svelte hasn't implemented it yet. I'll add tests to make sure nothing terrible happens, but ultimately I'm going to wait for the upstream behavior.
There was a problem hiding this comment.
Actually nevermind, I was looking at the wrong branch. This PR implements it sveltejs/prettier-plugin-svelte#510
There was a problem hiding this comment.
Yeah and as we can see they don't even take my example in consideration. There's no test for it. I suppose we'll have to do ourselves.
There was a problem hiding this comment.
Yeah I actually found a bug in their plugin while comparing the behavior, funnily enough. I've enhanced our tests, I believe it should cover everything
a9fe2c0 to
db5920f
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_html_parser/src/syntax/mod.rs (1)
490-497:⚠️ Potential issue | 🟠 MajorAstro expressions incorrectly route through Svelte parser—reorder branches to prioritise Astro.
Both Astro and Svelte enable
SingleTextExpressions, so line 490 matches Astro files first and routes them toparse_svelte_spread_or_expressioninstead ofparse_astro_spread_or_expression. This causes Astro{...}syntax to be parsed with Svelte semantics and can mis-tokenise subsequent directives via the Svelte lex context.Suggested fix
- T!['{'] if SingleTextExpressions.is_supported(p) => parse_svelte_spread_or_expression(p), - T!['{'] if Astro.is_supported(p) => parse_astro_spread_or_expression(p), + T!['{'] if Astro.is_supported(p) => parse_astro_spread_or_expression(p), + T!['{'] if SingleTextExpressions.is_supported(p) => parse_svelte_spread_or_expression(p),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_html_parser/src/syntax/mod.rs` around lines 490 - 497, Astro expressions are being routed to the Svelte parser because the branch checking SingleTextExpressions precedes the Astro check; swap the branch order so the T!['{'] if Astro.is_supported(p) arm comes before the T!['{'] if SingleTextExpressions.is_supported(p) arm and still retain the fallback T!['{'] => Svelte.parse_exclusive_syntax(...) behavior with the disabled_svelte fallback. Update the match so parse_astro_spread_or_expression is called when Astro.is_supported(p) is true, parse_svelte_spread_or_expression is called when SingleTextExpressions.is_supported(p) is true, and the final T!['{'] fallback remains unchanged.
🧹 Nitpick comments (4)
crates/biome_html_formatter/src/verbatim.rs (1)
276-285: Consider preserving extra blank lines after//comments.Line 281-285 collapses any
lines_after > 0into a single hard break, solines_after >= 2loses a blank line. If that’s unintentional, maplines_after == 1tohard_line_break()and>= 2toempty_line().🔧 Possible tweak
match comment.lines_after() { 0 => {} - _ => { - biome_formatter::write!(f, [hard_line_break()])?; - } + 1 => biome_formatter::write!(f, [hard_line_break()])?, + _ => biome_formatter::write!(f, [empty_line()])?, }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_html_formatter/src/verbatim.rs` around lines 276 - 285, The current CommentKind::Line handling collapses any comment.lines_after() > 0 into a single hard_line_break(), losing extra blank lines; change the match on comment.lines_after() so that 0 => no output, 1 => emit a hard_line_break(), and _ (>=2) => emit an empty_line() (via biome_formatter::write!(f, [empty_line()])?) instead of hard_line_break() so multiple blank lines are preserved; update the branch that calls biome_formatter::write!(f, [hard_line_break()]) accordingly.crates/biome_html_parser/src/parser.rs (1)
156-159:with_svelte()is missing an inline doc comment.
with_frontmatter()doesn't have one either, but it'd be good to be consistent with the codebase style here.✏️ Suggested addition
+ /// Enables Svelte-specific parsing (JS-style `//` and `/* */` comments inside tags). pub fn with_svelte(mut self) -> Self { self.svelte = true; self }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_html_parser/src/parser.rs` around lines 156 - 159, The method with_svelte() is missing an inline Rust doc comment; add a short /// doc comment above pub fn with_svelte(mut self) -> Self that explains what enabling Svelte parsing does (e.g., "Enable Svelte-specific parsing behavior" or similar), mentions that it sets the svelte flag and returns Self for chaining, and mirror the same style for with_frontmatter() so both builder methods have consistent inline docs; reference the functions by name (with_svelte and with_frontmatter) when adding the comments.crates/biome_html_parser/src/lexer/mod.rs (2)
1512-1515:is_linebreakis a local copy of an identical helper inbiome_js_parser.Not a bug — just a nudge to consider extracting it to a shared utility crate if/when this grows. For now it's fine where it is.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_html_parser/src/lexer/mod.rs` around lines 1512 - 1515, The is_linebreak function in this module duplicates an identical helper in biome_js_parser; to avoid drift, extract the logic into a shared utility (e.g., a common crate or module) and replace this local fn is_linebreak with a call to that shared helper (or add a clear TODO pointing to the shared helper) so both lexer/mod.rs and biome_js_parser reference the same implementation (identify the function by name is_linebreak to locate and update usages).
591-610: Simplify the catch-all arms inconsume_js_block_comment.The explicit
IDT | ZER | DIG | WHS | COL | SLH | MIN | MUL => self.advance(1)arm is fully subsumed by the generic_ if chr.is_ascii() => self.advance(1)arm below it — every listed dispatch category is ASCII. The only arm that must be explicit is theMUL if …terminator guard. Collapsing the rest reduces noise.♻️ Proposed simplification
fn consume_js_block_comment(&mut self) -> HtmlSyntaxKind { self.advance(2); while let Some(chr) = self.current_byte() { let dispatched = lookup_byte(chr); match dispatched { MUL if self.byte_at(1).map(lookup_byte) == Some(SLH) => { self.advance(2); return COMMENT; } - IDT | ZER | DIG | WHS | COL | SLH | MIN | MUL => self.advance(1), _ if chr.is_ascii() => self.advance(1), _ => self.advance(self.current_char_unchecked().len_utf8()), } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_html_parser/src/lexer/mod.rs` around lines 591 - 610, In consume_js_block_comment, remove the redundant match arm listing IDT | ZER | DIG | WHS | COL | SLH | MIN | MUL and rely on the existing `_ if chr.is_ascii() => self.advance(1)` catch-all, keeping the special `MUL if self.byte_at(1).map(lookup_byte) == Some(SLH) => { self.advance(2); return COMMENT; }` branch and the unicode fallback that advances by `current_char_unchecked().len_utf8()`. This simplifies the match while preserving behavior of lookup_byte, current_byte, byte_at, advance, and the diagnostic push via push_diagnostic/ParseDiagnostic and the returned COMMENT kind.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/prettier-compare/package.json`:
- Line 17: The package.json currently references a non-existent dependency
version for "prettier-plugin-svelte"; update the dependency entry for
prettier-plugin-svelte in package.json (the "prettier-plugin-svelte" key) to a
published version such as "^3.4.0" or change it to a range/placeholder that will
be released (or add a comment/PR note if you intend to publish 3.5.0 before
merge) so CI/npm install won’t fail.
- Line 17: The package.json dependency "prettier-plugin-svelte" pins a
non-existent version (^3.5.0) which will break installs; update the dependency
value in packages/prettier-compare's package.json to a published version (e.g.,
^3.4.1) or add a note in the repo docs/README that the workspace requires the
upstream 3.5.0 release before installing, and ensure any CI/package-lock updates
reflect this change; look for the "prettier-plugin-svelte" entry in package.json
to make the edit.
---
Outside diff comments:
In `@crates/biome_html_parser/src/syntax/mod.rs`:
- Around line 490-497: Astro expressions are being routed to the Svelte parser
because the branch checking SingleTextExpressions precedes the Astro check; swap
the branch order so the T!['{'] if Astro.is_supported(p) arm comes before the
T!['{'] if SingleTextExpressions.is_supported(p) arm and still retain the
fallback T!['{'] => Svelte.parse_exclusive_syntax(...) behavior with the
disabled_svelte fallback. Update the match so parse_astro_spread_or_expression
is called when Astro.is_supported(p) is true, parse_svelte_spread_or_expression
is called when SingleTextExpressions.is_supported(p) is true, and the final
T!['{'] fallback remains unchanged.
---
Nitpick comments:
In `@crates/biome_html_formatter/src/verbatim.rs`:
- Around line 276-285: The current CommentKind::Line handling collapses any
comment.lines_after() > 0 into a single hard_line_break(), losing extra blank
lines; change the match on comment.lines_after() so that 0 => no output, 1 =>
emit a hard_line_break(), and _ (>=2) => emit an empty_line() (via
biome_formatter::write!(f, [empty_line()])?) instead of hard_line_break() so
multiple blank lines are preserved; update the branch that calls
biome_formatter::write!(f, [hard_line_break()]) accordingly.
In `@crates/biome_html_parser/src/lexer/mod.rs`:
- Around line 1512-1515: The is_linebreak function in this module duplicates an
identical helper in biome_js_parser; to avoid drift, extract the logic into a
shared utility (e.g., a common crate or module) and replace this local fn
is_linebreak with a call to that shared helper (or add a clear TODO pointing to
the shared helper) so both lexer/mod.rs and biome_js_parser reference the same
implementation (identify the function by name is_linebreak to locate and update
usages).
- Around line 591-610: In consume_js_block_comment, remove the redundant match
arm listing IDT | ZER | DIG | WHS | COL | SLH | MIN | MUL and rely on the
existing `_ if chr.is_ascii() => self.advance(1)` catch-all, keeping the special
`MUL if self.byte_at(1).map(lookup_byte) == Some(SLH) => { self.advance(2);
return COMMENT; }` branch and the unicode fallback that advances by
`current_char_unchecked().len_utf8()`. This simplifies the match while
preserving behavior of lookup_byte, current_byte, byte_at, advance, and the
diagnostic push via push_diagnostic/ParseDiagnostic and the returned COMMENT
kind.
In `@crates/biome_html_parser/src/parser.rs`:
- Around line 156-159: The method with_svelte() is missing an inline Rust doc
comment; add a short /// doc comment above pub fn with_svelte(mut self) -> Self
that explains what enabling Svelte parsing does (e.g., "Enable Svelte-specific
parsing behavior" or similar), mentions that it sets the svelte flag and returns
Self for chaining, and mirror the same style for with_frontmatter() so both
builder methods have consistent inline docs; reference the functions by name
(with_svelte and with_frontmatter) when adding the comments.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
crates/biome_html_formatter/tests/specs/html/svelte/comments-in-component-tags.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_formatter/tests/specs/html/svelte/comments-in-tags.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/error/svelte/unterminated_js_multiline_comment.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_component_tags.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_tag.svelte.snapis excluded by!**/*.snapand included by**pnpm-lock.yamlis excluded by!**/pnpm-lock.yamland included by**
📒 Files selected for processing (16)
.changeset/chatty-jeans-shine.mdcrates/biome_html_formatter/src/comments.rscrates/biome_html_formatter/src/verbatim.rscrates/biome_html_formatter/tests/specs/html/svelte/comments-in-component-tags.sveltecrates/biome_html_formatter/tests/specs/html/svelte/comments-in-tags.sveltecrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_parser/src/lexer/tests.rscrates/biome_html_parser/src/parser.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/syntax/vue.rscrates/biome_html_parser/src/token_source.rscrates/biome_html_parser/tests/html_specs/error/svelte/unterminated_js_multiline_comment.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_component_tags.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_tag.sveltepackages/prettier-compare/package.json
✅ Files skipped from review due to trivial changes (1)
- crates/biome_html_formatter/tests/specs/html/svelte/comments-in-tags.svelte
🚧 Files skipped from review as they are similar to previous changes (3)
- crates/biome_html_parser/src/lexer/tests.rs
- .changeset/chatty-jeans-shine.md
- crates/biome_html_parser/src/syntax/svelte.rs
db5920f to
cf6d75a
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/prettier-compare/package.json (1)
17-17: Please confirmprettier-plugin-svelte3.5.0 is actually published.
If it isn’t on npm yet, installs will fail; consider pinning to the latest published version until the release lands.#!/bin/bash python - <<'PY' import json, urllib.request data = json.load(urllib.request.urlopen("https://registry.npmjs.org/prettier-plugin-svelte")) print("latest:", data["dist-tags"]["latest"]) print("has 3.5.0:", "3.5.0" in data.get("versions", {})) PY🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/prettier-compare/package.json` at line 17, Check whether the dependency entry "prettier-plugin-svelte": "^3.5.0" in package.json points to a published npm release; if 3.5.0 is not published, change the package.json dependency to a published version (e.g., pin to the current dist-tag/latest version) or use a valid semver that resolves to an existing version, and update any lockfile (npm install / yarn install) to regenerate lock entries; reference the dependency string "prettier-plugin-svelte" in package.json when making the change and run the provided npm/registry check to verify the new version exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@packages/prettier-compare/package.json`:
- Line 17: Check whether the dependency entry "prettier-plugin-svelte": "^3.5.0"
in package.json points to a published npm release; if 3.5.0 is not published,
change the package.json dependency to a published version (e.g., pin to the
current dist-tag/latest version) or use a valid semver that resolves to an
existing version, and update any lockfile (npm install / yarn install) to
regenerate lock entries; reference the dependency string
"prettier-plugin-svelte" in package.json when making the change and run the
provided npm/registry check to verify the new version exists.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
crates/biome_html_formatter/tests/specs/html/svelte/comments-in-component-tags.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_formatter/tests/specs/html/svelte/comments-in-tags.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/error/svelte/unterminated_js_multiline_comment.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_component_tags.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_tag.svelte.snapis excluded by!**/*.snapand included by**pnpm-lock.yamlis excluded by!**/pnpm-lock.yamland included by**
📒 Files selected for processing (16)
.changeset/chatty-jeans-shine.mdcrates/biome_html_formatter/src/comments.rscrates/biome_html_formatter/src/verbatim.rscrates/biome_html_formatter/tests/specs/html/svelte/comments-in-component-tags.sveltecrates/biome_html_formatter/tests/specs/html/svelte/comments-in-tags.sveltecrates/biome_html_parser/src/lexer/mod.rscrates/biome_html_parser/src/lexer/tests.rscrates/biome_html_parser/src/parser.rscrates/biome_html_parser/src/syntax/mod.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/syntax/vue.rscrates/biome_html_parser/src/token_source.rscrates/biome_html_parser/tests/html_specs/error/svelte/unterminated_js_multiline_comment.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_component_tags.sveltecrates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_tag.sveltepackages/prettier-compare/package.json
🚧 Files skipped from review as they are similar to previous changes (7)
- .changeset/chatty-jeans-shine.md
- crates/biome_html_parser/tests/html_specs/ok/svelte/js_comments_in_tag.svelte
- crates/biome_html_parser/src/syntax/mod.rs
- crates/biome_html_parser/src/parser.rs
- crates/biome_html_parser/src/lexer/tests.rs
- crates/biome_html_formatter/tests/specs/html/svelte/comments-in-component-tags.svelte
- crates/biome_html_formatter/tests/specs/html/svelte/comments-in-tags.svelte
Summary
In sveltejs/svelte#17671, Svelte just added support for comments inside HTML tags. This PR updates our HTML parser to accept this syntax, and properly treat these comments as trivia.
Test Plan
snapshots
Docs