-
-
Notifications
You must be signed in to change notification settings - Fork 713
feat(parse/tailwind): handle most basenames with dashes #7068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CodSpeed Performance ReportMerging #7068 will not alter performanceComparing Summary
|
WalkthroughThis update introduces a new metadata module to the Tailwind syntax crate, providing large constant arrays of known utility class names and base names with dashes. The Tailwind parser’s lexer is modified to use a longest-prefix match against these base names when parsing, improving accuracy for class names containing dashes. Several new test cases are added to verify correct parsing of utility classes, particularly those with dashes and custom values. No changes are made to public function signatures or control flow outside the targeted lexer logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (5)
⏰ 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). (24)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (4)
crates/biome_tailwind_syntax/src/metadata.rs (4)
139-141
: Use rustdoc for public constantsThese are public APIs; prefer rustdoc so they show up in docs.
-// Static utilities that don't take parameters +/// Static utilities that don't take parameters pub const KNOWN_STATIC_UTILITIES: &[&str] = &[
986-988
: Use rustdoc for public constantsSame here, make the description discoverable in docs.
-// Functional utilities that take parameters (like w-*, bg-*, etc.) +/// Functional utilities that take parameters (like w-*, bg-*, etc.) pub const KNOWN_FUNCTIONAL_UTILITIES: &[&str] = &[
2-137
: Optional: store a length-descending view if you rely on longest-prefix scansIf the lexer scans this list linearly to find the longest match, a length-descending slice (or a trie) can cut comparisons. Can be built once at compile time or via codegen without touching parser logic.
1326-1336
: Great invariant test; consider adding uniqueness checksSorting is covered. Also consider asserting no duplicates across each list to avoid accidental drift.
Example:
let mut set = std::collections::BTreeSet::new(); for &s in KNOWN_STATIC_UTILITIES { assert!(set.insert(s), "Duplicate in KNOWN_STATIC_UTILITIES: {s}"); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (5)
crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt.snap
is excluded by!**/*.snap
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt.snap
is excluded by!**/*.snap
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt.snap
is excluded by!**/*.snap
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt.snap
is excluded by!**/*.snap
crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-2.txt.snap
is excluded by!**/*.snap
📒 Files selected for processing (7)
crates/biome_tailwind_parser/src/lexer/mod.rs
(2 hunks)crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
(1 hunks)crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
(1 hunks)crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt
(1 hunks)crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt
(1 hunks)crates/biome_tailwind_syntax/src/lib.rs
(1 hunks)crates/biome_tailwind_syntax/src/metadata.rs
(1 hunks)
🧰 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_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
crates/biome_tailwind_syntax/src/lib.rs
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
crates/biome_tailwind_parser/src/lexer/mod.rs
crates/biome_tailwind_syntax/src/metadata.rs
**/*.{rs,toml}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Format code (Rust + TOML) using
just format
Format Rust and TOML files using
just f
(alias forjust format
).
Files:
crates/biome_tailwind_syntax/src/lib.rs
crates/biome_tailwind_parser/src/lexer/mod.rs
crates/biome_tailwind_syntax/src/metadata.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_tailwind_syntax/src/lib.rs
crates/biome_tailwind_parser/src/lexer/mod.rs
crates/biome_tailwind_syntax/src/metadata.rs
🧠 Learnings (35)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to crates/biome_lint_rules/**/*.rs : Linter rules must have a `version` metadata field in their implementation, set to "next" for new rules and updated to the new version when releasing.
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/**/Cargo.toml : Update the `Cargo.toml` file to include the specified `[dev-dependencies]` for testing utilities.
📚 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_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
📚 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/*/*/{invalid*,valid*}* : Snapshot tests for rules should be placed in `tests/specs/<group>/<rule_name>/` with files prefixed by `invalid` or `valid`.
Applied to files:
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt
📚 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_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
crates/biome_tailwind_syntax/src/metadata.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_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
crates/biome_tailwind_syntax/src/metadata.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/tests/specs/*/*/*.jsonc : Files ending with `.jsonc` in snapshot tests should contain arrays of code snippets for script environments.
Applied to files:
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Add tests for watcher workspace methods in watcher.tests.rs (src/workspace/watcher.tests.rs)
Applied to files:
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
📚 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/**/lib.rs : Add the provided formatting infrastructure code inside your `lib.rs` file when creating a new formatter crate for a language (e.g., biome_html_formatter).
Applied to files:
crates/biome_tailwind_syntax/src/lib.rs
crates/biome_tailwind_syntax/src/metadata.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 : If a lint rule is ported from another ecosystem (e.g., ESLint), add a `sources` metadata field in `declare_lint_rule!` referencing the original rule.
Applied to files:
crates/biome_tailwind_syntax/src/lib.rs
crates/biome_tailwind_syntax/src/metadata.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 crates/biome_lint_rules/**/*.rs : Linter rules must have a `version` metadata field in their implementation, set to "next" for new rules and updated to the new version when releasing.
Applied to files:
crates/biome_tailwind_syntax/src/lib.rs
crates/biome_tailwind_syntax/src/metadata.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/crates/biome_diagnostics_categories/src/categories.rs : When declaring a new diagnostic category, add it to crates/biome_diagnostics_categories/src/categories.rs to ensure it is statically registered.
Applied to files:
crates/biome_tailwind_syntax/src/lib.rs
crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:50:25.072Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_aria_metadata/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:25.072Z
Learning: Applies to crates/biome_aria_metadata/**/build.rs : The `build.rs` script uses `aria-data.json` to generate ARIA metadata.
Applied to files:
crates/biome_tailwind_syntax/src/lib.rs
crates/biome_tailwind_syntax/src/metadata.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 : The `declare_lint_rule!` macro must be used to declare an analyzer rule type and implement the RuleMeta trait.
Applied to files:
crates/biome_tailwind_syntax/src/lib.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_*/src/generated/ : Create a `generated/` folder inside the `src/` folder of each new language crate (e.g., `crates/biome_html_syntax/src/generated/`).
Applied to files:
crates/biome_tailwind_syntax/src/lib.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 : If a rule provides a code action, add the `fix_kind` metadata to the `declare_lint_rule!` macro and implement the `action` function.
Applied to files:
crates/biome_tailwind_syntax/src/lib.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/**/Cargo.toml : Update the `Cargo.toml` file to include the specified `[dev-dependencies]` for testing utilities.
Applied to files:
crates/biome_tailwind_syntax/src/lib.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_tailwind_syntax/src/lib.rs
crates/biome_tailwind_parser/src/lexer/mod.rs
crates/biome_tailwind_syntax/src/metadata.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_tailwind_syntax/src/lib.rs
crates/biome_tailwind_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_tailwind_syntax/src/lib.rs
crates/biome_tailwind_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_tailwind_syntax/src/lib.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 : Import the `FormatNode` trait and implement it for your Node when creating a new AST node formatter.
Applied to files:
crates/biome_tailwind_syntax/src/lib.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 a rule needs to query multiple node types, use the `declare_node_union!` macro to define a union type.
Applied to files:
crates/biome_tailwind_syntax/src/lib.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_tailwind_syntax/src/lib.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 implementing custom syntax tree visitors, define a `Visitor` struct and implement the `Visitor` trait for efficient traversal.
Applied to files:
crates/biome_tailwind_syntax/src/lib.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_tailwind_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 : Implement the `Lexer` trait from the `biome_parser` crate for your language-specific lexer struct.
Applied to files:
crates/biome_tailwind_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_tailwind_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 must be prefixed with `parse_` and use the name defined in the grammar file (e.g., `parse_for_statement`).
Applied to files:
crates/biome_tailwind_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_tailwind_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_tailwind_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_tailwind_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_tailwind_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: Each language crate must follow the structure: biome_{lang}_syntax, biome_{lang}_parser, biome_{lang}_formatter, biome_{lang}_analyze, biome_{lang}_factory, biome_{lang}_semantic (where applicable)
Applied to files:
crates/biome_tailwind_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_tailwind_syntax/src/metadata.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_rule_options/lib/*.rs : Use boxed slices (`Box<[Box<str>]>`) instead of `Vec<String>` for string arrays in rule options to save memory.
Applied to files:
crates/biome_tailwind_syntax/src/metadata.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). (25)
- GitHub Check: Documentation
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_html_formatter)
- GitHub Check: Bench (biome_package)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_html_parser)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Check Dependencies
- GitHub Check: Bench (biome_css_formatter)
- 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: Test Node.js API
- GitHub Check: autofix
🔇 Additional comments (9)
crates/biome_tailwind_syntax/src/metadata.rs (2)
2-137
: Nice: curated dashed basenames and a sort invariantList reads sane and the dedicated sort test below guards drift. Good defensive move for prefix matching.
1257-1258
: Verify@container
as a utility token
@container
is an at-rule in CSS. As a Tailwind “utility” token it’s unusual. If this is intended for query variants, fine—otherwise it risks false positives.Would you confirm intended usage in the parser? If needed, I can cross-check against current Tailwind docs and adjust the list.
crates/biome_tailwind_syntax/src/lib.rs (1)
5-5
: Expose metadata module — LGTMClean and minimal. Consider adding a brief rustdoc on the module in
metadata.rs
(you’ve mostly done that) so consumers understand its purpose.crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt (1)
1-1
: Good coverage for dashed base + bracketed valueThis exercises the tricky path nicely.
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt (1)
1-1
: Coversborder-spacing-y
with custom valueSolid addition to catch regressions on dashed basenames.
crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt (1)
1-1
: Happy path fordrop-shadow-red-500
Keeps the lexer honest on dashed basenames with named tokens.
crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt (2)
1-1
: Test case looks goodCaptures a realistic dashed-base + bracketed value scenario.
2-2
: No stray “2” – gradient.txt is a valid one-line spec
The file only contains a single line:bg-radial-[at_50%_75%] from-sky-200 via-blue-400 to-indigo-900 to-90%
There is no second line or stray token. All OK specs are one-liners, so no change is needed.
Likely an incorrect or invalid review comment.
crates/biome_tailwind_parser/src/lexer/mod.rs (1)
9-9
: Import looks fineDirectly pulling in the metadata constant is clear and localises the change.
9925207
to
e41cc72
Compare
Summary
There are some base names in tailwind that contain dashes, like
border-spacing
. There are also named values likered-500
that contain dashes. In order to consistently parse these base names with dashes, we need to maintain a list of base names with dashes in them, at the minimum. I was hoping to be able to usebinary_search
instead ofrfind
, but the constraint that we need to find the longest match makes that a little difficult. Open to suggestions.I think that eventually, we will need to parse the user's tailwind config before parsing, but that's a problem for later. :)
Test Plan
Added tests.
Docs
Summary by CodeRabbit
New Features
Tests
Documentation