Skip to content

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Oct 24, 2025

Summary

fixes #7843

I wanted to keep the parsing of things like --color-* to remain the same where --color is the identifier, but if I just blindly did that for the --* case, then the identifier would be -, which would be confusing for lint rule authors.

Test Plan

added a snapshot test

Docs

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: f2ba2a6

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

@dyc3 dyc3 requested review from a team October 24, 2025 17:25
@github-actions github-actions bot added A-Parser Area: parser A-Tooling Area: internal tools L-CSS Language: CSS labels Oct 24, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 50762 50762 0
Passed 49558 49558 0
Failed 1162 1162 0
Panics 42 42 0
Coverage 97.63% 97.63% 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 6316 6316 0
Passed 2105 2105 0
Failed 4211 4211 0
Panics 0 0 0
Coverage 33.33% 33.33% 0.00%

ts/babel

Test result main count This PR count Difference
Total 835 835 0
Passed 742 742 0
Failed 93 93 0
Panics 0 0 0
Coverage 88.86% 88.86% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18805 18805 0
Passed 14057 14057 0
Failed 4747 4747 0
Panics 1 1 0
Coverage 74.75% 74.75% 0.00%

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 24, 2025

CodSpeed Performance Report

Merging #7852 will not alter performance

Comparing dyc3/fix-tw-dashdashstar (f2ba2a6) with main (53ffa8b)1

Summary

✅ 53 untouched
⏩ 85 skipped2

Footnotes

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

  2. 85 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

Walkthrough

This PR updates the CSS parser to accept Tailwind-style internal variable patterns such as --*: initial;. Changes: lexer identifier logic now recognises --* and certain dash-star sequences when Tailwind directives are enabled; * is treated as a valid continuation in specific ident-start scenarios; the dash before * in TwValueThemeReference grammar is now optional; prev_byte() was added to the Lexer trait for look‑behind support; property parsing was broadened to accept --*: and --color-*-: forms. Tests covering @theme { --*: initial; } and a negative test when Tailwind is disabled were added.

Possibly related PRs

Suggested reviewers

  • ematipico
  • siketyan

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and specifically summarises the primary change: fixing the parsing of the --*: initial; declaration when tailwindDirectives are enabled. This directly corresponds to the main objective from issue #7843, and the conventional commit format (fix(scope): message) makes it easy to scan in version history. The title is concise and avoids vague phrasing.
Description Check ✅ Passed The PR description provides relevant context by linking to issue #7843, explaining the motivation for the approach (preserving existing --color-* parsing whilst avoiding a confusing - identifier for the --* case), and mentioning the added snapshot test. The description is directly related to the changeset and communicates the intent reasonably well.

[pre_merge_check_pass]

The code changes directly address the requirements from issue #7843. The PR modifies the CSS lexer and parser to correctly handle the --*: initial; pattern in Tailwind contexts, adds infrastructure support via the prev_byte() method on the Lexer trait, updates the grammar to reflect optional dash handling, and includes both positive and negative test cases to verify the fix works correctly and respects the disabled-directive scenario.

[pre_merge_check_pass]

All changes are directly scoped to fixing the --*: initial; parsing issue. The lexer and parser modifications, grammar updates, test cases, infrastructure enhancements like prev_byte(), and changelog entry are all necessary components of implementing the fix described in issue #7843. No tangential or unrelated modifications are present. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/fix-tw-dashdashstar

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/biome_css_parser/src/lexer/mod.rs (1)

1292-1340: Don’t broaden ident-start globally; gate the --* start behind Tailwind.

MUL => true changes tokenisation for non‑Tailwind users. Guard it with the option to avoid regressions.

Apply this diff:

-                            MUL => true,
+                            MUL if self.options.is_tailwind_directives_enabled() => true,
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72afdfa and fc0d8a9.

⛔ Files ignored due to path filters (4)
  • crates/biome_css_factory/src/generated/node_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/nodes_mut.rs is excluded by !**/generated/**, !**/generated/** and included by **
📒 Files selected for processing (6)
  • .changeset/itchy-aliens-ask.md (1 hunks)
  • crates/biome_css_parser/src/lexer/mod.rs (2 hunks)
  • crates/biome_css_parser/src/syntax/property/mod.rs (2 hunks)
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css (1 hunks)
  • crates/biome_parser/src/lexer.rs (1 hunks)
  • xtask/codegen/css.ungram (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**

📄 CodeRabbit inference engine (CLAUDE.md)

Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}

Files:

  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css
  • crates/biome_css_parser/src/syntax/property/mod.rs
  • crates/biome_css_parser/src/lexer/mod.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css
  • crates/biome_parser/src/lexer.rs
  • crates/biome_css_parser/src/syntax/property/mod.rs
  • crates/biome_css_parser/src/lexer/mod.rs
**/tests/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place test files under a tests/ directory in each crate

Files:

  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: In changesets, only use #### or ##### headers; other header levels are not allowed
Changesets should cover user-facing changes only; internal changes do not need changesets
Use past tense for what you did and present tense for current Biome behavior in changesets
When fixing a bug in a changeset, start with an issue link (e.g., “Fixed #1234: …”)
When referencing a rule or assist in a changeset, include a link to its page on the website
Include code blocks in changesets when applicable to illustrate changes
End every sentence in a changeset with a period

Files:

  • .changeset/itchy-aliens-ask.md
xtask/codegen/*.ungram

📄 CodeRabbit inference engine (CLAUDE.md)

Define and modify language grammars in .ungram files; ASTs are generated from these

Files:

  • xtask/codegen/css.ungram
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • crates/biome_parser/src/lexer.rs
  • crates/biome_css_parser/src/syntax/property/mod.rs
  • crates/biome_css_parser/src/lexer/mod.rs
🧠 Learnings (1)
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Lexer must implement the biome_parser::Lexer trait

Applied to files:

  • crates/biome_parser/src/lexer.rs
🧬 Code graph analysis (1)
crates/biome_css_parser/src/syntax/property/mod.rs (2)
crates/biome_parser/src/lib.rs (2)
  • cur (183-185)
  • cur_text (198-200)
crates/biome_css_parser/src/syntax/mod.rs (2)
  • is_at_dashed_identifier (499-501)
  • parse_dashed_identifier (507-515)
⏰ 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 (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Parser conformance
  • GitHub Check: autofix
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_formatter)
🔇 Additional comments (3)
xtask/codegen/css.ungram (1)

1876-1885: Codegen verified and ASTs in sync.

Generated files correctly reflect the optional dash: minus_token is Option<SyntaxToken> in nodes.rs, the formatter handles it properly, and test snapshots confirm the parser works as expected. All good.

crates/biome_parser/src/lexer.rs (1)

212-219: Additive Lexer API is solid—already in use.

Verification confirms prev_byte() is a safe default method with no breaking implications. The CSS lexer is already leveraging it at line 1013 for the look-behind logic you mentioned. All in-repo implementations inherit the default without override, and no trait object assumptions are at risk. No issues found.

crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css (1)

1-5: Good snapshot test for the Tailwind --*: initial; fix.

Minimal, well-placed test that directly addresses issue #7843. The comment provides helpful context from Tailwind's documentation. This should serve as an effective verification that the parser now handles this pattern correctly.

@dyc3 dyc3 force-pushed the dyc3/fix-tw-dashdashstar branch from fc0d8a9 to aa36270 Compare October 24, 2025 17:48
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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc0d8a9 and aa36270.

⛔ Files ignored due to path filters (4)
  • crates/biome_css_factory/src/generated/node_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/nodes_mut.rs is excluded by !**/generated/**, !**/generated/** and included by **
📒 Files selected for processing (6)
  • .changeset/itchy-aliens-ask.md (1 hunks)
  • crates/biome_css_parser/src/lexer/mod.rs (2 hunks)
  • crates/biome_css_parser/src/syntax/property/mod.rs (2 hunks)
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css (1 hunks)
  • crates/biome_parser/src/lexer.rs (1 hunks)
  • xtask/codegen/css.ungram (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • .changeset/itchy-aliens-ask.md
  • xtask/codegen/css.ungram
  • crates/biome_css_parser/src/syntax/property/mod.rs
  • crates/biome_parser/src/lexer.rs
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css
🧰 Additional context used
📓 Path-based instructions (3)
crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**

📄 CodeRabbit inference engine (CLAUDE.md)

Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}

Files:

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

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

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

1010-1021: LGTM – clean handling of the Tailwind edge case.

The logic correctly distinguishes between --* (consume the second dash) and --colour-* (stop at the identifier boundary). Properly option-gated and the previous commented-out code has been removed as requested.

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

I would add one more test

@dyc3 dyc3 force-pushed the dyc3/fix-tw-dashdashstar branch from aa36270 to f2ba2a6 Compare October 25, 2025 14:17
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_css_parser/src/lexer/mod.rs (1)

1314-1314: Unconditionally allowing MUL for --* ident-start is correct.

Keeping this ungated ensures stable tokenisation and better diagnostics when Tailwind is disabled. Looks good. Based on learnings.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa36270 and f2ba2a6.

⛔ Files ignored due to path filters (5)
  • crates/biome_css_factory/src/generated/node_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_parser/tests/css_test_suite/error/tailwind/when-disabled/custom-theme.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css.snap is excluded by !**/*.snap and included by **
  • crates/biome_css_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_css_syntax/src/generated/nodes_mut.rs is excluded by !**/generated/**, !**/generated/** and included by **
📒 Files selected for processing (7)
  • .changeset/itchy-aliens-ask.md (1 hunks)
  • crates/biome_css_parser/src/lexer/mod.rs (2 hunks)
  • crates/biome_css_parser/src/syntax/property/mod.rs (3 hunks)
  • crates/biome_css_parser/tests/css_test_suite/error/tailwind/when-disabled/custom-theme.css (1 hunks)
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css (1 hunks)
  • crates/biome_parser/src/lexer.rs (1 hunks)
  • xtask/codegen/css.ungram (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .changeset/itchy-aliens-ask.md
  • crates/biome_parser/src/lexer.rs
  • xtask/codegen/css.ungram
  • crates/biome_css_parser/tests/css_test_suite/ok/tailwind/theme/custom-theme.css
🧰 Additional context used
📓 Path-based instructions (4)
crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**

📄 CodeRabbit inference engine (CLAUDE.md)

Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}

Files:

  • crates/biome_css_parser/tests/css_test_suite/error/tailwind/when-disabled/custom-theme.css
  • crates/biome_css_parser/src/lexer/mod.rs
  • crates/biome_css_parser/src/syntax/property/mod.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_css_parser/tests/css_test_suite/error/tailwind/when-disabled/custom-theme.css
  • crates/biome_css_parser/src/lexer/mod.rs
  • crates/biome_css_parser/src/syntax/property/mod.rs
**/tests/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place test files under a tests/ directory in each crate

Files:

  • crates/biome_css_parser/tests/css_test_suite/error/tailwind/when-disabled/custom-theme.css
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • crates/biome_css_parser/src/lexer/mod.rs
  • crates/biome_css_parser/src/syntax/property/mod.rs
🧠 Learnings (1)
📚 Learning: 2025-10-25T07:22:18.511Z
Learnt from: ematipico
PR: biomejs/biome#7852
File: crates/biome_css_parser/src/syntax/property/mod.rs:161-168
Timestamp: 2025-10-25T07:22:18.511Z
Learning: In the Biome CSS parser, lexer token emission should not be gated behind parser options like `is_tailwind_directives_enabled()`. The lexer must emit correct tokens regardless of parser options to enable accurate diagnostics and error messages when the syntax is used incorrectly.

Applied to files:

  • crates/biome_css_parser/src/lexer/mod.rs
  • crates/biome_css_parser/src/syntax/property/mod.rs
🧬 Code graph analysis (1)
crates/biome_css_parser/src/syntax/property/mod.rs (2)
crates/biome_css_parser/src/syntax/parse_error.rs (1)
  • tailwind_disabled (236-241)
crates/biome_css_parser/src/syntax/mod.rs (5)
  • is_at_dashed_identifier (499-501)
  • parse_any_value (336-370)
  • parse_custom_identifier_with_keywords (482-496)
  • parse_dashed_identifier (507-515)
  • parse_regular_identifier (433-435)
⏰ 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). (20)
  • GitHub Check: autofix
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: End-to-end tests
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Parser conformance
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
🔇 Additional comments (3)
crates/biome_css_parser/tests/css_test_suite/error/tailwind/when-disabled/custom-theme.css (1)

1-5: Nice negative test coverage!

This properly complements the positive test by verifying that --*: initial; fails to parse when tailwindDirectives are disabled, which confirms the fix is scoped correctly to Tailwind-enabled contexts only.

crates/biome_css_parser/src/syntax/property/mod.rs (2)

163-170: Broadened lookahead for --*: and --color-*: is spot on.

Recognises both forms without option-gating; the exclusive Tailwind path handles diagnostics when disabled. Nice.


183-199: Lexer correctly preserves * token—verification complete.

The concern has been validated: the lexer's consume_ident_part method (line 1014 in mod.rs) explicitly handles the --* sequence by only advancing past the dash, leaving the asterisk as a separate STAR token for the parser. The parser then correctly consumes it at line 193. Tailwind-exclusive wrapping and the "disabled" diagnostic path are well-shaped.

Comment on lines +1014 to 1020
// HACK: handle `--*`
if self.prev_byte() == Some(b'-') {
self.advance(1);
return Some(current as char);
}
// otherwise, handle cases like `--color-*`
return None;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Don’t swallow the * in --* during ident lexing.

This advances past *, removing it from the token stream. The parser then can’t see *, breaking the new lookaheads (--*: / --color-*:) and the Tailwind-exclusive wrapper that expects *. Let the ident consume -- and stop before * so * remains a separate token.

Fix: remove this special-case entirely and rely on the existing logic (plus the MUL start tweak).

Apply this diff:

-        if self.options.is_tailwind_directives_enabled()
-            && current == b'-'
-            && self.peek_byte() == Some(b'*')
-        {
-            // HACK: handle `--*`
-            if self.prev_byte() == Some(b'-') {
-                self.advance(1);
-                return Some(current as char);
-            }
-            // otherwise, handle cases like `--color-*`
-            return None;
-        }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In crates/biome_css_parser/src/lexer/mod.rs around lines 1014 to 1020, the ident
lexing special-case that checks for prev_byte() == Some(b'-') and calls
advance(1) is swallowing a '*' in sequences like `--*` and `--color-*`; remove
this special-case entirely so the ident consumes `--` but stops before `*`,
allowing the `*` to remain as its own token and preserving downstream lookaheads
(`--*:` / `--color-*:`) and Tailwind wrapper handling; rely on the existing
ident logic (and the existing MUL start tweak) instead of advancing past `*`.

@dyc3 dyc3 merged commit bd254c7 into main Oct 25, 2025
26 checks passed
@dyc3 dyc3 deleted the dyc3/fix-tw-dashdashstar branch October 25, 2025 14:51
@github-actions github-actions bot mentioned this pull request Oct 25, 2025
Jagget pushed a commit to Jagget/biome that referenced this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Parser Area: parser A-Tooling Area: internal tools L-CSS Language: CSS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 @theme At-Rule with Tailwind CSS internal variable (--*: initial;) causes multiple CSS parser errors

3 participants