Handle Live Component classes in Twig templates#20110
Handle Live Component classes in Twig templates#20110officialasishkumar wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThis PR introduces a Twig pre-processor for the TailwindCSS scanner that handles Symfony Live Components directives. The implementation detects 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 4/5Safe to merge; the change is well-scoped to .twig files and does not alter any other extraction path. The implementation is clean and tests cover the key scenarios including nested parens and multi-directive chains. One edge case: an unclosed addClass( causes the outer scan loop to exit early, silently abandoning any directives that follow it in the same file. Real templates are well-formed so this is unlikely to matter in practice, but the fix is trivial. crates/oxide/src/extractor/pre_processors/twig.rs — the early-break path on unclosed parens is worth a second look. Reviews (1): Last reviewed commit: "Handle Live Component classes in Twig te..." | Re-trigger Greptile |
| if end >= content.len() { | ||
| break; | ||
| } |
There was a problem hiding this comment.
An unclosed directive like
addClass(foo (no closing )) causes the outer loop to break entirely, silently skipping every subsequent addClass/removeClass directive in the same file. In practice templates are well-formed, but a more resilient approach would be to advance cursor past the unmatched directive and continue rather than aborting.
| if end >= content.len() { | |
| break; | |
| } | |
| if end >= content.len() { | |
| // Unclosed parenthesis — skip past the directive name and | |
| // keep scanning so later directives are still processed. | |
| cursor += directive_len; | |
| continue; | |
| } |
Summary
Fixes #19458.
addClass(...)andremoveClass(...)loading directives.Test plan
CARGO_BUILD_JOBS=1 cargo test -p tailwindcss-oxide --lib twig -- --nocapture