tailwindcss/crates/oxide/src
Robin Malfait 25f7ccff80
Fix class extraction for Rails' strict locals (#19525)
Fixes: #19481

This PR improves the Ruby extractor to better handle strict locals. We
recently introduced skipping comments in the Ruby extractor (PR #19243
for #19239) by ignoring comments that start with `#` until the end of
the line.

Strict locals are implemented like this:
```ruby
<%# locals: (css: "text-amber-600") %>
```

Notice the `#` after the `<%`, we considered this a comment and ignored
it.

This PR changes that behavior slightly where we skip comments that are
preceded by `%`. This means that `<%# anything here _will_ be scanned
%>`. This should solve the strict locals case, and normal comments will
still be skipped.

We can be more strict in the future if needed, but I think that this
should be a good solution for both scenarios.

### Test plan

1. Added a test to ensure we extract candidates in strict locals
2. Added a regression test for issue #19239 where we introduced skipping
comments in the Ruby extractor
3. Other existing tests are still passing

We can also verify the extracted candidates:
(it's subtle, but you can see that the class is being extracted now)

<img width="1187" height="1376" alt="image"
src="https://github.com/user-attachments/assets/74bbfd79-9db4-4a5b-bd8d-25f1565c6bfd"
/>
2026-01-06 12:46:14 +01:00
..
extractor Fix class extraction for Rails' strict locals (#19525) 2026-01-06 12:46:14 +01:00
fixtures Improve Oxide candidate extractor [0] (#16306) 2025-03-05 11:55:24 +01:00
scanner Add Maud templating support (#18988) 2025-09-24 11:33:01 +00:00
cursor.rs A bit of cleanup (#17394) 2025-03-26 12:08:53 -04:00
fast_skip.rs Hoist oxide/crates to just crates (#13333) 2024-03-23 09:00:48 -04:00
glob.rs A bit of cleanup (#17394) 2025-03-26 12:08:53 -04:00
lib.rs Add @source not support (#17255) 2025-03-25 15:54:41 +01:00
main.rs Improve Oxide candidate extractor [0] (#16306) 2025-03-05 11:55:24 +01:00
paths.rs Fix integration tests on Windows (#14824) 2024-10-30 11:26:29 +00:00
throughput.rs Improve Oxide candidate extractor [0] (#16306) 2025-03-05 11:55:24 +01:00