diff --git a/.changeset/tailwind-legacy-important.md b/.changeset/tailwind-legacy-important.md new file mode 100644 index 000000000000..6c53d9f40bcd --- /dev/null +++ b/.changeset/tailwind-legacy-important.md @@ -0,0 +1,5 @@ +--- +"@biomejs/biome": patch +--- + +The Tailwind parser now accepts the legacy leading `!` important marker (`!flex`, `hover:!p-4`). diff --git a/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/sort_v4.rs b/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/sort_v4.rs index d781b74e5958..58f9b0589883 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/sort_v4.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_sorted_classes/sort_v4.rs @@ -1,10 +1,10 @@ use std::cmp::Ordering; -use biome_rowan::{AstNode, AstNodeList, SyntaxNodeText, TokenText}; +use biome_rowan::{AstNode, AstNodeList, SyntaxNodeText, TextRange, TextSize, TokenText}; use biome_string_case::Collator; use biome_tailwind_syntax::{ AnyTwCandidate, AnyTwFullCandidate, AnyTwModifier, AnyTwValue, CssGenericComponentValueList, - TwRoot, + TailwindSyntaxNode, TailwindSyntaxToken, TwRoot, }; use super::tailwind_preset_v4::{ @@ -53,18 +53,8 @@ pub fn sort_class_list(root: &TwRoot) -> String { .collect(); // `Vec::sort_by` is stable, so Unknown-vs-Unknown comparisons returning - // `Equal` keep input order. Known entries whose keys tie — possible - // when variants share a rank (`@sm/main:flex` with `@sm:flex`) — - // break the tie on full candidate text, mirroring Tailwind's final - // candidate-string comparison. - keyed.sort_by(|a, b| { - compare(&a.0, &b.0).then_with(|| match (&a.0, &b.0) { - (SortKey::Known { .. }, SortKey::Known { .. }) => { - TwNameCollator.cmp(a.1.chars(), b.1.chars()) - } - _ => Ordering::Equal, - }) - }); + // `Equal` keep input order. + keyed.sort_by(|a, b| compare(&a.0, &b.0)); // Sort is in-place; total text length is unchanged. Pre-size the output // so chunked emission never re-allocates. @@ -92,11 +82,153 @@ enum SortKey { /// Total declaration count — Tailwind's tie-break after the /// signature (wider utilities sort first). count: u8, - name: NameKey, - important: bool, + /// The whole candidate text (variants, sign, name, `!`). + /// Tailwind's last tiebreak compares this text with + /// [TwNameCollator]. + text: CandidateText, }, } +/// A candidate's whole text as an allocation-free view into the syntax +/// tree, ordered the way Tailwind's `compare()` orders raw candidates. +// TODO: equality compares text chunk-wise and cannot short-circuit on +// syntax kind mismatches; switch to a structural node comparison once a +// generic `is_node_equal` is available. +#[derive(Clone, Debug)] +struct CandidateText(TailwindSyntaxNode); + +impl PartialEq for CandidateText { + fn eq(&self, other: &Self) -> bool { + self.text() == other.text() + } +} + +impl Eq for CandidateText {} + +impl CandidateText { + fn text(&self) -> SyntaxNodeText { + self.0.text_trimmed() + } + + /// [TwNameCollator] order over the whole text. Two candidates in one + /// bucket usually share their entire variant prefix (`hover:p-2` / + /// `hover:p-4`), so the shared prefix is skipped bytewise and only the + /// tail from the first difference goes through the collator — backed + /// up to the start of a digit run (`p-12` / `p-1a` compare `12` with + /// `1`) or of a multi-byte character, so the result is exactly the + /// collator's. + fn compare(&self, other: &Self) -> Ordering { + let mut a = TextChunks::new(&self.0); + let mut b = TextChunks::new(&other.0); + // Bytes shared so far, and how many of the last shared bytes are + // ASCII digits, or belong to a multi-byte character the two texts + // may diverge inside of (only one of the two can be non-zero). + let mut shared = 0usize; + let mut trailing_digits = 0usize; + let mut trailing_char_bytes = 0usize; + loop { + let (Some(x), Some(y)) = (a.rest(), b.rest()) else { + return match (a.rest().is_some(), b.rest().is_some()) { + (false, false) => Ordering::Equal, + (false, true) => Ordering::Less, + (true, false) => Ordering::Greater, + (true, true) => unreachable!(), + }; + }; + let n = x.len().min(y.len()); + let diverged = x[..n].iter().zip(&y[..n]).position(|(p, q)| p != q); + let matched = diverged.unwrap_or(n); + for &byte in &x[..matched] { + if byte.is_ascii_digit() { + trailing_digits += 1; + trailing_char_bytes = 0; + } else if byte.is_ascii() { + trailing_digits = 0; + trailing_char_bytes = 0; + } else if (byte & 0xC0) == 0x80 { + // Continuation byte: still inside the character. + trailing_char_bytes += 1; + } else { + // Lead byte: a new multi-byte character starts here. + trailing_digits = 0; + trailing_char_bytes = 1; + } + } + shared += matched; + if diverged.is_some() { + break; + } + a.advance(n); + b.advance(n); + } + // Both texts share every byte before `restart`, so it is a + // character boundary in both. + let restart = TextSize::from((shared - trailing_digits - trailing_char_bytes) as u32); + let tail = |text: SyntaxNodeText| text.slice(TextRange::new(restart, text.len())); + TwNameCollator.cmp(tail(self.text()).chars(), tail(other.text()).chars()) + } +} + +/// Cursor over the byte chunks of a node's trimmed text, one token at a +/// time, without allocating. +struct TextChunks { + range: TextRange, + /// The current token and the part of its text inside `range`, in + /// token-local offsets. + current: Option<(TailwindSyntaxToken, TextRange)>, + offset: usize, +} + +impl TextChunks { + fn new(node: &TailwindSyntaxNode) -> Self { + let mut chunks = Self { + range: node.text_trimmed_range(), + current: None, + offset: 0, + }; + chunks.enter(node.first_token()); + chunks + } + + /// Make `token` current, skipping ahead over tokens with no text inside + /// the trimmed range; a token past the range ends the walk. + fn enter(&mut self, mut token: Option) { + self.offset = 0; + self.current = None; + while let Some(candidate) = token { + if candidate.text_range().start() >= self.range.end() { + return; + } + if let Some(inside) = candidate.text_range().intersect(self.range) + && !inside.is_empty() + { + let local = inside - candidate.text_range().start(); + self.current = Some((candidate, local)); + return; + } + token = candidate.next_token(); + } + } + + /// The unread bytes of the current chunk, or `None` at the end. + fn rest(&self) -> Option<&[u8]> { + let (token, local) = self.current.as_ref()?; + Some(&token.text().as_bytes()[usize::from(local.start()) + self.offset..usize::from(local.end())]) + } + + fn advance(&mut self, bytes: usize) { + self.offset += bytes; + let done = self + .current + .as_ref() + .is_some_and(|(_, local)| self.offset >= usize::from(local.len())); + if done { + let next = self.current.as_ref().and_then(|(token, _)| token.next_token()); + self.enter(next); + } + } +} + /// A classified candidate whose variants are resolved but not yet /// weighted — weighting needs the whole list. /// [PendingSortKey::into_sort_key] finishes the [SortKey] once the @@ -107,8 +239,7 @@ enum PendingSortKey { Known { signature: Signature, count: u8, - name: NameKey, - important: bool, + text: CandidateText, variants: Vec, }, } @@ -120,7 +251,7 @@ enum PendingSortKey { /// the `propertySort` that Tailwind's `compileAstNodes` computes per /// candidate. /// -/// This is the primary Tailwind sort key; `count`, name, and importance +/// This is the primary Tailwind sort key; `count` and the candidate text /// only break signature ties. #[derive(Clone, Debug)] enum Signature { @@ -192,41 +323,20 @@ impl Ord for Signature { } } -/// The candidate's name — the negative sign plus the `base-value/modifier` -/// text, without variants or the important suffix — held as an -/// allocation-free view into the syntax tree. Candidates inside one -/// (property, count) bucket order by natural comparison of this name, -/// which is the order Tailwind emits utilities in: `getClassOrder` ranks -/// `m-2 m-4 m-auto m-px` and `block flow-root inline-block` by name, not -/// by utility registration order. -// TODO: the derived equality compares text chunk-wise and cannot -// short-circuit on syntax kind mismatches; switch to a structural node -// comparison once a generic `is_node_equal` is available. -#[derive(Clone, Debug, Default, Eq, PartialEq)] -struct NameKey { - negative: bool, - text: Option, -} - -impl NameKey { - fn compare(&self, other: &Self) -> Ordering { - fn chars(key: &NameKey) -> impl Iterator + '_ { - let sign = key.negative.then_some('-'); - let text = key.text.as_ref().map(|text| text.chars()).into_iter().flatten(); - sign.into_iter().chain(text) - } - TwNameCollator.cmp(chars(self), chars(other)) - } -} - -/// Orders candidate names the way Tailwind's own `compare()` does: -/// plain code-point order, except that digit sequences compare as -/// integers (`p-75` < `p-700`, `red-50` < `red-100`). Code-point order -/// places `-` before digits, digits before `[`, and `[` before letters -/// (`-m-4` < `m-4`, `w-4` < `w-[1px]` < `w-auto`), matching the order -/// Tailwind emits candidates in — which is why this does not reuse +/// Orders candidates inside one (variant weight, signature, count) +/// bucket the way Tailwind's own `compare()` does on the whole +/// candidate text: plain code-point order, except that digit sequences +/// compare as integers (`p-75` < `p-700`, `red-50` < `red-100`). Code-point +/// order places `!` and `-` before digits, digits before `[`, and `[` +/// before letters (`-m-4` < `m-4`, `w-4` < `w-[1px]` < `w-auto`, +/// `flex` < `flex!`), matching the order Tailwind emits candidates in — +/// which is why this does not reuse /// [biome_string_case::CldrAsciiCollator]: CLDR collation places /// punctuation before digits and interleaves letter case. +/// +/// Because the text starts with the variants, two candidates whose +/// variants weigh the same but read differently (`hover:sm:flex` and +/// `sm:hover:block`) order by their variant spelling before their name. struct TwNameCollator; impl Collator for TwNameCollator { @@ -254,10 +364,13 @@ impl PendingSortKey { return Self::Unknown; }; + // The legacy leading `!` and the trailing `!` are each fine on + // their own; Tailwind rejects a candidate spelling both. + if node.legacy_important_token().is_some() && node.excl_token().is_some() { + return Self::Unknown; + } + let is_negative = node.negative_token().is_some(); - // An important candidate (`flex!`) sorts exactly where its plain - // twin does; `compare` breaks exact-key ties plain-first. - let is_important = node.excl_token().is_some(); let Ok(inner) = node.candidate() else { return Self::Unknown; @@ -391,11 +504,7 @@ impl PendingSortKey { Some((signature, count)) => Self::Known { signature, count, - name: NameKey { - negative: is_negative, - text: Some(inner.syntax().text_trimmed()), - }, - important: is_important, + text: CandidateText(node.syntax().clone()), variants, }, } @@ -409,8 +518,7 @@ impl PendingSortKey { Self::Known { signature, count, - name, - important, + text, variants, } => { let Some(variant_weight) = variant_groups.weight_for(&variants) else { @@ -420,8 +528,7 @@ impl PendingSortKey { variant_weight, signature, count, - name, - important, + text, } } } @@ -444,15 +551,13 @@ fn compare(a: &SortKey, b: &SortKey) -> Ordering { variant_weight: v1, signature: s1, count: c1, - name: n1, - important: i1, + text: t1, }, SortKey::Known { variant_weight: v2, signature: s2, count: c2, - name: n2, - important: i2, + text: t2, }, // Variants sort outermost — a plain utility before any // variant (`flex hover:flex sm:flex`). @@ -462,12 +567,10 @@ fn compare(a: &SortKey, b: &SortKey) -> Ordering { // Wider utilities (e.g. `sr-only` setting 9 properties) win // a signature tie so they sort before narrower utilities. .then_with(|| c2.cmp(c1)) - // Candidates with one placement order by name, the way + // Bucket ties order by the whole candidate text, the way // Tailwind emits them (`m-2 m-4 m-auto m-px`, - // `collapse invisible visible`). - .then_with(|| n1.compare(n2)) - // A plain utility precedes its important twin (`flex flex!`). - .then_with(|| i1.cmp(i2)), + // `collapse invisible visible`, `flex flex!`). + .then_with(|| t1.compare(t2)), } } @@ -690,30 +793,26 @@ mod tests { use super::*; use biome_tailwind_parser::parse_tailwind; + /// A known key with the given placement whose text is the placeholder + /// candidate `x`, for tests that only exercise the placement. fn known(property_idx: u16, property_count: u8) -> SortKey { + let parsed = parse_tailwind("x"); + let candidate = parsed.tree().candidates().iter().next().unwrap(); SortKey::Known { variant_weight: VariantWeight::default(), signature: Signature::Property(property_idx), count: property_count, - name: NameKey::default(), - important: false, + text: CandidateText(candidate.syntax().clone()), } } - /// The name of a known key — sign plus candidate text — materialized - /// for assertion messages. + /// The candidate text of a known key, materialized for assertion + /// messages. fn name_text(key: &SortKey) -> String { - let SortKey::Known { name, .. } = key else { + let SortKey::Known { text, .. } = key else { panic!("expected a known key"); }; - let mut out = String::new(); - if name.negative { - out.push('-'); - } - if let Some(text) = &name.text { - out.push_str(&text.to_string()); - } - out + text.text().to_string() } fn nat_cmp(a: &str, b: &str) -> Ordering { @@ -738,6 +837,45 @@ mod tests { /// way `sort_class_list` does. Needed to exercise variant-against-variant /// ordering: [classify] builds groups per candidate, so every lone /// variant lands in group 0 and compares equal to any other. + #[test] + fn candidate_text_compare_matches_the_collator() { + // Every pair from a corpus that hits the fast path's edges: shared + // variant prefixes, digit runs cut at the divergence (`p-12` / + // `p-1a`), prefixes of one another, divergence inside a multi-byte + // character (`w-é` / `w-è` share the lead byte), and both `!` + // spellings. + let corpus = "p-1 p-12 p-1a p-2 p-4 p-40 p-400 p-4! !p-4 hover:p-4 hover:p-2 \ + hover:sm:flex sm:hover:flex sm:hover:block hover:sm:block \ + @sm:block @sm/main:flex @sm:flex bg-red-500/50 bg-red-500/[.35] \ + bg-red-500/[.3] w-1/2 w-1/3 w-[1px] w-[10px] w-auto -m-4 m-4 -m-px \ + [color:red] [color:red]! w-é w-è w-éa w-éb w-ü w-ǖ flex \ + flex! !flex text-red-500 text-red-50 text-red-5000 p-4/50 hover:!p-4"; + let parsed = parse_tailwind(corpus); + let texts: Vec = parsed + .tree() + .candidates() + .iter() + .map(|c| CandidateText(c.syntax().clone())) + .collect(); + for a in &texts { + for b in &texts { + let expected = TwNameCollator.cmp(a.text().chars(), b.text().chars()); + assert_eq!( + a.compare(b), + expected, + "{} vs {}", + a.text(), + b.text() + ); + } + } + } + + /// Sort a class string end to end. + fn sort(input: &str) -> String { + sort_class_list(&parse_tailwind(input).tree()) + } + fn classify_all(input: &str) -> Vec { let parsed = parse_tailwind(input); let pending: Vec = parsed @@ -819,18 +957,24 @@ mod tests { #[test] fn compare_breaks_exact_key_tie_plain_before_important() { - let plain = known(5, 1); - let important = SortKey::Known { - variant_weight: VariantWeight::default(), - signature: Signature::Property(5), - count: 1, - name: NameKey::default(), - important: true, - }; + let plain = classify("flex"); + let important = classify("flex!"); assert_eq!(compare(&plain, &important), Ordering::Less); assert_eq!(compare(&important, &plain), Ordering::Greater); } + #[test] + fn compare_breaks_bucket_tie_by_variant_spelling_before_name() { + // `hover:sm:` and `sm:hover:` weigh the same, so Tailwind falls + // through to the whole candidate text, where the variant spelling + // comes before the utility name. + assert_eq!( + sort("sm:hover:block hover:sm:flex"), + "hover:sm:flex sm:hover:block" + ); + assert_eq!(sort("@sm:block @sm/main:flex"), "@sm/main:flex @sm:block"); + } + #[test] fn compare_orders_by_first_differing_signature_index() { // `container` touches `--tw-container-component`, which precedes @@ -853,7 +997,7 @@ mod tests { #[test] fn compare_breaks_bucket_tie_by_name_before_importance() { - // `p-2! p-4`: the name decides, the important suffix does not + // `p-2! p-4`: the name decides; the important suffix does not // pull `p-4` ahead of `p-2!`. let important_two = classify("p-2!"); let plain_four = classify("p-4"); @@ -1101,10 +1245,7 @@ mod tests { let display_idx = *PROPERTY_INDEX.get("display").unwrap(); let key = classify("[display:block]"); let SortKey::Known { - signature, - count, - important: false, - .. + signature, count, .. } = &key else { panic!("expected a plain known key"); @@ -1140,50 +1281,39 @@ mod tests { variant_weight, signature, count, - name, - important: false, + .. } = classify("flex") else { panic!("expected `flex` to classify as a plain known key"); }; - assert_eq!( - classify("flex!"), - SortKey::Known { - variant_weight, - signature, - count, - name, - important: true, - } - ); + let SortKey::Known { + variant_weight: important_weight, + signature: important_signature, + count: important_count, + text, + } = classify("flex!") + else { + panic!("expected `flex!` to classify as a known key"); + }; + assert_eq!(important_weight, variant_weight); + assert_eq!(important_signature, signature); + assert_eq!(important_count, count); + assert_eq!(text.text(), "flex!"); } #[test] fn important_suffix_classifies_functional_and_arbitrary_candidates() { - assert!(matches!( - classify("p-4!"), - SortKey::Known { - important: true, - .. - } - )); - assert!(matches!( - classify("[display:block]!"), - SortKey::Known { - important: true, - .. - } - )); + assert!(matches!(classify("p-4!"), SortKey::Known { .. })); + assert!(matches!(classify("[display:block]!"), SortKey::Known { .. })); + assert_eq!(sort("p-4! p-4 [display:block]! [display:block]"), "[display:block] [display:block]! p-4 p-4!"); } #[test] fn variants_classify_and_keep_importance() { // A recognized variant places the candidate; `!` still rides // through as the final tiebreak. - assert!(matches!( - classify("hover:flex!"), - SortKey::Known { important: true, .. } - )); + assert!(matches!(classify("hover:flex!"), SortKey::Known { .. })); + assert_eq!(sort("hover:flex! hover:flex"), "hover:flex hover:flex!"); // A variant sorts after its variantless twin. assert_eq!( compare(&classify("flex"), &classify("hover:flex")), @@ -1244,13 +1374,21 @@ mod tests { #[test] fn variants_resolving_equal_lengths_share_a_rank() { - // `min-[40rem]` and `sm` both resolve 40rem, so their keys tie; - // `sort_class_list` breaks the tie on candidate text. + // `min-[40rem]` and `sm` both resolve 40rem, so their variant + // weights tie and the candidate text decides. let keys = classify_all("min-[40rem]:flex sm:flex"); - assert_eq!(compare(&keys[0], &keys[1]), Ordering::Equal); - // A container modifier does not participate in ordering. + assert_eq!(weight_of(&keys[0]), weight_of(&keys[1])); + assert_eq!(compare(&keys[0], &keys[1]), Ordering::Less); + // A container modifier does not participate in the weight. let keys = classify_all("@sm/main:flex @sm:flex"); - assert_eq!(compare(&keys[0], &keys[1]), Ordering::Equal); + assert_eq!(weight_of(&keys[0]), weight_of(&keys[1])); + } + + fn weight_of(key: &SortKey) -> &VariantWeight { + let SortKey::Known { variant_weight, .. } = key else { + panic!("expected a known key"); + }; + variant_weight } #[test] @@ -1340,9 +1478,9 @@ mod tests { // The sign comes from the full candidate, outside the inner // candidate node. assert_eq!(text_of("-mt-2"), "-mt-2"); - // The important suffix is not part of the name; it is a separate - // final tiebreak. - assert_eq!(text_of("p-4!"), "p-4"); + // The important suffix and the variants ride along too. + assert_eq!(text_of("p-4!"), "p-4!"); + assert_eq!(text_of("hover:p-4"), "hover:p-4"); } // endregion: sort key classification diff --git a/crates/biome_js_analyze/tests/sort_v4/cases.jsonc b/crates/biome_js_analyze/tests/sort_v4/cases.jsonc index eb1424f57637..f9490d94d3e9 100644 --- a/crates/biome_js_analyze/tests/sort_v4/cases.jsonc +++ b/crates/biome_js_analyze/tests/sort_v4/cases.jsonc @@ -269,6 +269,18 @@ "bg-red-500! flex p-4", // theme value + important "flex! block", // static bucket + important "[display:block]! [color:red]", // arbitrary candidate + important + + // The legacy leading `!` (`!flex`) still parses as important and, + // like everything else in a bucket, orders by the whole text — so + // `!` (0x21) puts it ahead of its plain twin and of every letter. + // Expected order cross-checked against tailwindcss 4.3.3. + "flex! !flex flex", // `!flex flex flex!` + "block !flex flex", // `!flex block flex` + "p-4 !p-2 p-2! !p-4", // `!p-2 !p-4 p-2! p-4` + "hover:flex hover:!p-4 !flex md:p-4 md:!flex", + "!-m-4 -m-4 !m-4 m-4", // sign after the `!` + "!bg-red-500/50 bg-red-500/50 ![color:red] [color:red]", + "!flex! flex !hover:flex", // both `!`s or `!` before variants: unknown, front "mt-4 -mt-2!", // negative + important "not-a-class! flex", // unknown base stays front even with `!` // ─── variants ────────────────────────────────────────────────── @@ -287,6 +299,13 @@ "md:flex sm:flex flex max-lg:flex max-sm:flex min-lg:flex", // responsive, min/max "md:hover:flex hover:flex flex md:flex", // compound + // Variant stacks that weigh the same tie on the whole candidate + // text, so the variant spelling decides before the utility name. + // Expected order cross-checked against tailwindcss 4.3.3. + "sm:hover:block hover:sm:flex", // `h` < `s` beats `block` < `flex` + "hover:sm:p-4 sm:hover:p-2", + "@sm:block @sm/main:flex", // `/` < `:` beats `block` < `flex` + // ─── container-query and child variants ──────────────────────── // `@sm`/`@md` glue the container root to a size; `@max-*` descend, // `*`/`**` are the child / descendant variants. Cross-checked diff --git a/crates/biome_js_analyze/tests/sort_v4/cases.snap b/crates/biome_js_analyze/tests/sort_v4/cases.snap index 54a0eab1a846..4e7a1a9b45be 100644 --- a/crates/biome_js_analyze/tests/sort_v4/cases.snap +++ b/crates/biome_js_analyze/tests/sort_v4/cases.snap @@ -438,6 +438,27 @@ sorted: block flex! input: [display:block]! [color:red] sorted: [display:block]! [color:red] --- +input: flex! !flex flex +sorted: !flex flex flex! +--- +input: block !flex flex +sorted: !flex block flex +--- +input: p-4 !p-2 p-2! !p-4 +sorted: !p-2 !p-4 p-2! p-4 +--- +input: hover:flex hover:!p-4 !flex md:p-4 md:!flex +sorted: !flex hover:flex hover:!p-4 md:!flex md:p-4 +--- +input: !-m-4 -m-4 !m-4 m-4 +sorted: !-m-4 !m-4 -m-4 m-4 +--- +input: !bg-red-500/50 bg-red-500/50 ![color:red] [color:red] +sorted: !bg-red-500/50 bg-red-500/50 ![color:red] [color:red] +--- +input: !flex! flex !hover:flex +sorted: !flex! !hover:flex flex +--- input: mt-4 -mt-2! sorted: -mt-2! mt-4 --- @@ -474,6 +495,15 @@ sorted: flex max-lg:flex max-sm:flex sm:flex md:flex min-lg:flex input: md:hover:flex hover:flex flex md:flex sorted: flex hover:flex md:flex md:hover:flex --- +input: sm:hover:block hover:sm:flex +sorted: hover:sm:flex sm:hover:block +--- +input: hover:sm:p-4 sm:hover:p-2 +sorted: hover:sm:p-4 sm:hover:p-2 +--- +input: @sm:block @sm/main:flex +sorted: @sm/main:flex @sm:block +--- input: flex sm:flex @sm:flex @md:flex @max-lg:flex sorted: flex sm:flex @max-lg:flex @sm:flex @md:flex --- diff --git a/crates/biome_js_analyze/tests/specs/nursery/useTailwindShorthandClasses/invalid.jsx b/crates/biome_js_analyze/tests/specs/nursery/useTailwindShorthandClasses/invalid.jsx index 8b7c58db6c0f..80065ec5a1c2 100644 --- a/crates/biome_js_analyze/tests/specs/nursery/useTailwindShorthandClasses/invalid.jsx +++ b/crates/biome_js_analyze/tests/specs/nursery/useTailwindShorthandClasses/invalid.jsx @@ -7,6 +7,8 @@ export function Component() {
+
+
); } diff --git a/crates/biome_js_analyze/tests/specs/nursery/useTailwindShorthandClasses/invalid.jsx.snap b/crates/biome_js_analyze/tests/specs/nursery/useTailwindShorthandClasses/invalid.jsx.snap index 74896dad317f..5d406aec60a8 100644 --- a/crates/biome_js_analyze/tests/specs/nursery/useTailwindShorthandClasses/invalid.jsx.snap +++ b/crates/biome_js_analyze/tests/specs/nursery/useTailwindShorthandClasses/invalid.jsx.snap @@ -13,6 +13,8 @@ export function Component() {
+
+
); } @@ -204,7 +206,7 @@ invalid.jsx:8:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━ > 8 │
│ ^^^^^^^^^^ 9 │
- 10 │ + 10 │
i Compressible utility used here. @@ -213,7 +215,7 @@ invalid.jsx:8:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━ > 8 │
│ ^^^^^^^^^^ 9 │
- 10 │ + 10 │
i Compressible utility used here. @@ -222,7 +224,7 @@ invalid.jsx:8:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━ > 8 │
│ ^^^^^^^^^^ 9 │
- 10 │ + 10 │
i Using fewer classes reduces duplication and improves readability. @@ -237,7 +239,7 @@ invalid.jsx:8:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━ 8 │ - → → → 8 │ + → → → 9 9 │
- 10 10 │ + 10 10 │
``` @@ -251,8 +253,8 @@ invalid.jsx:9:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━ 8 │
> 9 │
│ ^^^^^^^^^^^^^^ - 10 │ - 11 │ ); + 10 │
+ 11 │
i Compressible utility used here. @@ -260,8 +262,8 @@ invalid.jsx:9:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━ 8 │
> 9 │
│ ^^^^^^^^^^^^^^ - 10 │ - 11 │ ); + 10 │
+ 11 │
i Using fewer classes reduces duplication and improves readability. @@ -275,8 +277,81 @@ invalid.jsx:9:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━ 8 8 │
9 │ - → → → 9 │ + → → → - 10 10 │ - 11 11 │ ); + 10 10 │
+ 11 11 │
+ + +``` + +``` +invalid.jsx:10:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + i These Tailwind classes can be replaced with a shorthand class. + + 8 │
+ 9 │
+ > 10 │
+ │ ^^^^^^^^^ + 11 │
+ 12 │ + + i Compressible utility used here. + + 8 │
+ 9 │
+ > 10 │
+ │ ^^^^^^^^^ + 11 │
+ 12 │ + + i Using fewer classes reduces duplication and improves readability. + + i This rule is still being actively worked on, so it may be missing features or have rough edges. Visit https://github.com/biomejs/biome/issues/11342 for more information or to report possible bugs. + + i This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information. + + i Unsafe fix: Use the Tailwind shorthand classes. + + 10 │ → → → + │ ------------ + +``` + +``` +invalid.jsx:11:20 lint/nursery/useTailwindShorthandClasses FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + i These Tailwind classes can be replaced with a shorthand class. + + 9 │
+ 10 │
+ > 11 │
+ │ ^^^^^^^^^^^^^^^ + 12 │ + 13 │ ); + + i Compressible utility used here. + + 9 │
+ 10 │
+ > 11 │
+ │ ^^^^^^^^^^^^^^^ + 12 │ + 13 │ ); + + i Using fewer classes reduces duplication and improves readability. + + i This rule is still being actively worked on, so it may be missing features or have rough edges. Visit https://github.com/biomejs/biome/issues/11342 for more information or to report possible bugs. + + i This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information. + + i Unsafe fix: Use the Tailwind shorthand classes. + + 9 9 │
+ 10 10 │
+ 11 │ - → → → + 11 │ + → → → + 12 12 │ + 13 13 │ ); ``` diff --git a/crates/biome_tailwind_factory/src/generated/node_factory.rs b/crates/biome_tailwind_factory/src/generated/node_factory.rs index 25d5cf8515a3..4d32580b00c2 100644 --- a/crates/biome_tailwind_factory/src/generated/node_factory.rs +++ b/crates/biome_tailwind_factory/src/generated/node_factory.rs @@ -314,6 +314,7 @@ pub fn tw_full_candidate( TwFullCandidateBuilder { variants, candidate, + legacy_important_token: None, negative_token: None, excl_token: None, } @@ -321,10 +322,15 @@ pub fn tw_full_candidate( pub struct TwFullCandidateBuilder { variants: TwVariantList, candidate: AnyTwCandidate, + legacy_important_token: Option, negative_token: Option, excl_token: Option, } impl TwFullCandidateBuilder { + pub fn with_legacy_important_token(mut self, legacy_important_token: SyntaxToken) -> Self { + self.legacy_important_token = Some(legacy_important_token); + self + } pub fn with_negative_token(mut self, negative_token: SyntaxToken) -> Self { self.negative_token = Some(negative_token); self @@ -338,6 +344,8 @@ impl TwFullCandidateBuilder { TailwindSyntaxKind::TW_FULL_CANDIDATE, [ Some(SyntaxElement::Node(self.variants.into_syntax())), + self.legacy_important_token + .map(|token| SyntaxElement::Token(token)), self.negative_token.map(|token| SyntaxElement::Token(token)), Some(SyntaxElement::Node(self.candidate.into_syntax())), self.excl_token.map(|token| SyntaxElement::Token(token)), diff --git a/crates/biome_tailwind_factory/src/generated/syntax_factory.rs b/crates/biome_tailwind_factory/src/generated/syntax_factory.rs index e5917f1afad6..1ed6bfb74ec4 100644 --- a/crates/biome_tailwind_factory/src/generated/syntax_factory.rs +++ b/crates/biome_tailwind_factory/src/generated/syntax_factory.rs @@ -680,7 +680,7 @@ impl SyntaxFactory for TailwindSyntaxFactory { } TW_FULL_CANDIDATE => { let mut elements = (&children).into_iter(); - let mut slots: RawNodeSlots<4usize> = RawNodeSlots::default(); + let mut slots: RawNodeSlots<5usize> = RawNodeSlots::default(); let mut current_element = elements.next(); if let Some(element) = ¤t_element && TwVariantList::can_cast(element.kind()) @@ -689,6 +689,13 @@ impl SyntaxFactory for TailwindSyntaxFactory { current_element = elements.next(); } slots.next_slot(); + if let Some(element) = ¤t_element + && element.kind() == T![!] + { + slots.mark_present(); + current_element = elements.next(); + } + slots.next_slot(); if let Some(element) = ¤t_element && element.kind() == T ! [-] { diff --git a/crates/biome_tailwind_logic/src/use_tailwind_shorthand_classes.rs b/crates/biome_tailwind_logic/src/use_tailwind_shorthand_classes.rs index 0a30f3cceda6..edd482cfe9f9 100644 --- a/crates/biome_tailwind_logic/src/use_tailwind_shorthand_classes.rs +++ b/crates/biome_tailwind_logic/src/use_tailwind_shorthand_classes.rs @@ -475,6 +475,9 @@ fn apply_auto_fix( to_modify.variants(), AnyTwCandidate::TwStaticCandidate(new_static), ); + if let Some(legacy_important) = to_modify.legacy_important_token() { + new_full = new_full.with_legacy_important_token(legacy_important); + } if let Some(excl_token) = to_modify.excl_token() { new_full = new_full.with_excl_token(excl_token); } @@ -510,12 +513,17 @@ fn apply_auto_fix( new_static = new_static.with_modifier(modifier); } let new_static = new_static.build(); - let new_full = make::tw_full_candidate( + let mut new_full = make::tw_full_candidate( to_modify.variants(), AnyTwCandidate::TwStaticCandidate(new_static), - ) - .build(); - mutation.replace_node(to_modify, new_full); + ); + if let Some(legacy_important) = to_modify.legacy_important_token() { + new_full = new_full.with_legacy_important_token(legacy_important); + } + if let Some(excl_token) = to_modify.excl_token() { + new_full = new_full.with_excl_token(excl_token); + } + mutation.replace_node(to_modify, new_full.build()); } _ => return None, } diff --git a/crates/biome_tailwind_parser/src/syntax/mod.rs b/crates/biome_tailwind_parser/src/syntax/mod.rs index a476e71c4144..c9cd4adbbfc5 100644 --- a/crates/biome_tailwind_parser/src/syntax/mod.rs +++ b/crates/biome_tailwind_parser/src/syntax/mod.rs @@ -72,6 +72,11 @@ fn parse_full_candidate(p: &mut TailwindParser) -> ParsedSyntax { variants.complete(p, TW_VARIANT_LIST); } + // Tailwind's legacy important spelling puts the `!` right before the + // utility, after the variants and before the sign (`hover:!flex`, + // `!-m-4`). + let legacy_important = p.eat(T![!]); + if p.at(T![-]) { p.bump_with_context(T![-], TailwindLexContext::SawNegative); } @@ -94,7 +99,12 @@ fn parse_full_candidate(p: &mut TailwindParser) -> ParsedSyntax { } } - if p.at(T![!]) { + // The trailing `!` must be glued to the utility; whitespace before it + // means the next class starts with the legacy `!` instead. + if p.at(T![!]) && !p.source().had_trivia_before() { + if legacy_important { + p.error(duplicate_important(p, p.cur_range())); + } p.bump(T![!]); } diff --git a/crates/biome_tailwind_parser/src/syntax/parse_error.rs b/crates/biome_tailwind_parser/src/syntax/parse_error.rs index 9f227a7b4dc7..2cec116c1dbc 100644 --- a/crates/biome_tailwind_parser/src/syntax/parse_error.rs +++ b/crates/biome_tailwind_parser/src/syntax/parse_error.rs @@ -19,3 +19,13 @@ pub(crate) fn expected_value(p: &TailwindParser, range: TextRange) -> ParseDiagn pub(crate) fn expected_modifier(p: &TailwindParser, range: TextRange) -> ParseDiagnostic { expected_node("modifier", range, p).into_diagnostic(p) } + +/// A candidate spelled important twice: with the legacy leading `!` and +/// the trailing `!` (`!flex!`). Tailwind rejects the combination. +pub(crate) fn duplicate_important(p: &TailwindParser, range: TextRange) -> ParseDiagnostic { + p.err_builder( + "A candidate can't be marked important with both a leading and a trailing `!`.", + range, + ) + .with_hint("Keep only the trailing `!` (`flex!`); the leading form is legacy syntax.") +} diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/arbitrary-candidate/missing-property.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/arbitrary-candidate/missing-property.txt.snap index 6f992d6ffe07..4c48128685b4 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/arbitrary-candidate/missing-property.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/arbitrary-candidate/missing-property.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwBogusCandidate { items: [ @@ -46,14 +47,15 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..11 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_BOGUS_CANDIDATE@0..11 + 2: (empty) + 3: TW_BOGUS_CANDIDATE@0..11 0: L_BRACKET@0..1 "[" [] [] 1: TW_SELECTOR@1..6 ":40px" [] [] 2: R_BRACKET@6..8 "]" [] [Whitespace(" ")] 3: TW_BASE@8..9 "w" [] [] 4: DASH@9..10 "-" [] [] 5: TW_NUMBER@10..11 "5" [] [] - 3: (empty) + 4: (empty) 2: EOF@11..12 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/arbitrary-candidate/missing-value-in-arbitrary.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/arbitrary-candidate/missing-value-in-arbitrary.txt.snap index 690425bf6fad..b31f2abad55d 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/arbitrary-candidate/missing-value-in-arbitrary.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/arbitrary-candidate/missing-value-in-arbitrary.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@0..1 "[" [] [], @@ -32,6 +33,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@9..10 "w" [] [], @@ -57,24 +59,26 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..9 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@0..9 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@0..9 0: L_BRACKET@0..1 "[" [] [] 1: TW_PROPERTY@1..6 "width" [] [] 2: COLON@6..7 ":" [] [] 3: CSS_GENERIC_COMPONENT_VALUE_LIST@7..7 4: R_BRACKET@7..9 "]" [] [Whitespace(" ")] 5: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@9..12 0: TW_VARIANT_LIST@9..9 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@9..12 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@9..12 0: TW_BASE@9..10 "w" [] [] 1: DASH@10..11 "-" [] [] 2: TW_NUMBER_VALUE@11..12 0: TW_NUMBER@11..12 "5" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@12..13 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/candidate-modifier-before-colon.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/candidate-modifier-before-colon.txt.snap index c79a756b813c..732101664ff4 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/candidate-modifier-before-colon.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/candidate-modifier-before-colon.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwBogusCandidate { items: [ @@ -47,7 +48,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..15 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_BOGUS_CANDIDATE@0..15 + 2: (empty) + 3: TW_BOGUS_CANDIDATE@0..15 0: L_BRACKET@0..1 "[" [] [] 1: TW_SELECTOR@1..8 "foo:bar" [] [] 2: R_BRACKET@8..9 "]" [] [] @@ -55,7 +57,7 @@ TwRoot { 4: TW_VALUE@10..13 "mod" [] [] 5: COLON@13..14 ":" [] [] 6: TW_BASE@14..15 "x" [] [] - 3: (empty) + 4: (empty) 2: EOF@15..16 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/css-arbitrary-values.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/css-arbitrary-values.txt.snap index 8b472b8fa9e1..e464e634a56e 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/css-arbitrary-values.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/css-arbitrary-values.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..1 "w" [] [], @@ -56,6 +57,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@17..19 "bg" [] [], @@ -98,6 +100,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@34..36 "bg" [] [], @@ -144,7 +147,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..17 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..17 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..17 0: TW_BASE@0..1 "w" [] [] 1: DASH@1..2 "-" [] [] 2: TW_ARBITRARY_VALUE@2..17 @@ -166,11 +170,12 @@ TwRoot { 3: R_PAREN@14..15 ")" [] [] 2: R_BRACKET@15..17 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@17..34 0: TW_VARIANT_LIST@17..17 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@17..34 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@17..34 0: TW_BASE@17..19 "bg" [] [] 1: DASH@19..20 "-" [] [] 2: TW_ARBITRARY_VALUE@20..34 @@ -195,11 +200,12 @@ TwRoot { 3: R_PAREN@31..32 ")" [] [] 2: R_BRACKET@32..34 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@34..82 0: TW_VARIANT_LIST@34..34 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@34..82 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@34..82 0: TW_BASE@34..36 "bg" [] [] 1: DASH@36..37 "-" [] [] 2: TW_BOGUS_VALUE@37..82 @@ -216,7 +222,7 @@ TwRoot { 1: R_PAREN@80..81 ")" [] [] 2: R_BRACKET@81..82 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@82..83 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/css-number-exponents.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/css-number-exponents.txt.snap index 21f30ab9ceb5..67b00b1f71e3 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/css-number-exponents.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/css-number-exponents.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..1 "w" [] [], @@ -39,6 +40,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@7..8 "w" [] [], @@ -75,7 +77,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..7 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..7 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..7 0: TW_BASE@0..1 "w" [] [] 1: DASH@1..2 "-" [] [] 2: TW_ARBITRARY_VALUE@2..7 @@ -86,11 +89,12 @@ TwRoot { 1: IDENT@4..5 "e" [] [] 2: R_BRACKET@5..7 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@7..14 0: TW_VARIANT_LIST@7..7 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@7..14 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@7..14 0: TW_BASE@7..8 "w" [] [] 1: DASH@8..9 "-" [] [] 2: TW_ARBITRARY_VALUE@9..14 @@ -104,7 +108,7 @@ TwRoot { 1: (empty) 2: R_BRACKET@13..14 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@14..15 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/duplicate-important.txt b/crates/biome_tailwind_parser/tests/tailwind_specs/error/duplicate-important.txt new file mode 100644 index 000000000000..0b16abee9086 --- /dev/null +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/duplicate-important.txt @@ -0,0 +1,2 @@ +!flex! p-4 md:!flex! flex +!hover:flex p-4 \ No newline at end of file diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/duplicate-important.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/duplicate-important.txt.snap new file mode 100644 index 000000000000..3674b99b8815 --- /dev/null +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/duplicate-important.txt.snap @@ -0,0 +1,197 @@ +--- +source: crates/biome_tailwind_parser/tests/spec_test.rs +expression: snapshot +--- + +## Input + +```text +!flex! p-4 md:!flex! flex +!hover:flex p-4 +``` + + +## AST + +``` +TwRoot { + bom_token: missing (optional), + candidates: TwCandidateList [ + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@0..1 "!" [] [], + negative_token: missing (optional), + candidate: TwStaticCandidate { + base_token: TW_BASE@1..5 "flex" [] [], + modifier: missing (optional), + }, + excl_token: BANG@5..7 "!" [] [Whitespace(" ")], + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: missing (optional), + negative_token: missing (optional), + candidate: TwFunctionalCandidate { + base_token: TW_BASE@7..8 "p" [] [], + minus_token: DASH@8..9 "-" [] [], + value: TwNumberValue { + value_token: TW_NUMBER@9..11 "4" [] [Whitespace(" ")], + }, + modifier: missing (optional), + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [ + TwVariantExpression { + segments: TwVariantSegmentList [ + TwNamedVariantSegment { + value_token: TW_VARIANT_SEGMENT@11..13 "md" [] [], + }, + ], + glued_value: missing (optional), + modifier: missing (optional), + }, + COLON@13..14 ":" [] [], + ], + legacy_important_token: BANG@14..15 "!" [] [], + negative_token: missing (optional), + candidate: TwStaticCandidate { + base_token: TW_BASE@15..19 "flex" [] [], + modifier: missing (optional), + }, + excl_token: BANG@19..21 "!" [] [Whitespace(" ")], + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: missing (optional), + negative_token: missing (optional), + candidate: TwStaticCandidate { + base_token: TW_BASE@21..25 "flex" [] [], + modifier: missing (optional), + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@25..27 "!" [Newline("\n")] [], + negative_token: missing (optional), + candidate: TwBogusCandidate { + items: [ + TW_BASE@27..32 "hover" [] [], + COLON@32..33 ":" [] [], + TW_BASE@33..38 "flex" [] [Whitespace(" ")], + TW_BASE@38..39 "p" [] [], + DASH@39..40 "-" [] [], + TW_NUMBER@40..41 "4" [] [], + ], + }, + excl_token: missing (optional), + }, + ], + eof_token: EOF@41..41 "" [] [], +} +``` + +## CST + +``` +0: TW_ROOT@0..41 + 0: (empty) + 1: TW_CANDIDATE_LIST@0..41 + 0: TW_FULL_CANDIDATE@0..7 + 0: TW_VARIANT_LIST@0..0 + 1: BANG@0..1 "!" [] [] + 2: (empty) + 3: TW_STATIC_CANDIDATE@1..5 + 0: TW_BASE@1..5 "flex" [] [] + 1: (empty) + 4: BANG@5..7 "!" [] [Whitespace(" ")] + 1: TW_FULL_CANDIDATE@7..11 + 0: TW_VARIANT_LIST@7..7 + 1: (empty) + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@7..11 + 0: TW_BASE@7..8 "p" [] [] + 1: DASH@8..9 "-" [] [] + 2: TW_NUMBER_VALUE@9..11 + 0: TW_NUMBER@9..11 "4" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 2: TW_FULL_CANDIDATE@11..21 + 0: TW_VARIANT_LIST@11..14 + 0: TW_VARIANT_EXPRESSION@11..13 + 0: TW_VARIANT_SEGMENT_LIST@11..13 + 0: TW_NAMED_VARIANT_SEGMENT@11..13 + 0: TW_VARIANT_SEGMENT@11..13 "md" [] [] + 1: (empty) + 2: (empty) + 1: COLON@13..14 ":" [] [] + 1: BANG@14..15 "!" [] [] + 2: (empty) + 3: TW_STATIC_CANDIDATE@15..19 + 0: TW_BASE@15..19 "flex" [] [] + 1: (empty) + 4: BANG@19..21 "!" [] [Whitespace(" ")] + 3: TW_FULL_CANDIDATE@21..25 + 0: TW_VARIANT_LIST@21..21 + 1: (empty) + 2: (empty) + 3: TW_STATIC_CANDIDATE@21..25 + 0: TW_BASE@21..25 "flex" [] [] + 1: (empty) + 4: (empty) + 4: TW_FULL_CANDIDATE@25..41 + 0: TW_VARIANT_LIST@25..25 + 1: BANG@25..27 "!" [Newline("\n")] [] + 2: (empty) + 3: TW_BOGUS_CANDIDATE@27..41 + 0: TW_BASE@27..32 "hover" [] [] + 1: COLON@32..33 ":" [] [] + 2: TW_BASE@33..38 "flex" [] [Whitespace(" ")] + 3: TW_BASE@38..39 "p" [] [] + 4: DASH@39..40 "-" [] [] + 5: TW_NUMBER@40..41 "4" [] [] + 4: (empty) + 2: EOF@41..41 "" [] [] + +``` + +## Diagnostics + +``` +duplicate-important.txt:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A candidate can't be marked important with both a leading and a trailing `!`. + + > 1 │ !flex! p-4 md:!flex! flex + │ ^ + 2 │ !hover:flex p-4 + + i Keep only the trailing `!` (`flex!`); the leading form is legacy syntax. + +duplicate-important.txt:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × A candidate can't be marked important with both a leading and a trailing `!`. + + > 1 │ !flex! p-4 md:!flex! flex + │ ^ + 2 │ !hover:flex p-4 + + i Keep only the trailing `!` (`flex!`); the leading form is legacy syntax. + +duplicate-important.txt:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a candidate but instead found 'hover:flex p-4'. + + 1 │ !flex! p-4 md:!flex! flex + > 2 │ !hover:flex p-4 + │ ^^^^^^^^^^^^^^ + + i Expected a candidate here. + + 1 │ !flex! p-4 md:!flex! flex + > 2 │ !hover:flex p-4 + │ ^^^^^^^^^^^^^^ + +``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/formfeed-separators.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/formfeed-separators.txt.snap index 3659db3fce13..614e0f002490 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/formfeed-separators.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/formfeed-separators.txt.snap @@ -18,6 +18,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@0..5 "flex" [] [Whitespace("\u{c}")], @@ -38,6 +39,7 @@ TwRoot { }, COLON@10..11 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@11..16 "flex" [] [Whitespace("\u{b}")], @@ -58,6 +60,7 @@ TwRoot { }, COLON@21..22 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@22..27 "flex" [] [Whitespace(" ")], @@ -67,6 +70,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@27..36 "uppercase" [] [], @@ -88,10 +92,11 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..5 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_STATIC_CANDIDATE@0..5 + 2: (empty) + 3: TW_STATIC_CANDIDATE@0..5 0: TW_BASE@0..5 "flex" [] [Whitespace("\u{c}")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@5..16 0: TW_VARIANT_LIST@5..11 0: TW_VARIANT_EXPRESSION@5..10 @@ -102,10 +107,11 @@ TwRoot { 2: (empty) 1: COLON@10..11 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@11..16 + 2: (empty) + 3: TW_STATIC_CANDIDATE@11..16 0: TW_BASE@11..16 "flex" [] [Whitespace("\u{b}")] 1: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@16..27 0: TW_VARIANT_LIST@16..22 0: TW_VARIANT_EXPRESSION@16..21 @@ -116,17 +122,19 @@ TwRoot { 2: (empty) 1: COLON@21..22 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@22..27 + 2: (empty) + 3: TW_STATIC_CANDIDATE@22..27 0: TW_BASE@22..27 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@27..36 0: TW_VARIANT_LIST@27..27 1: (empty) - 2: TW_STATIC_CANDIDATE@27..36 + 2: (empty) + 3: TW_STATIC_CANDIDATE@27..36 0: TW_BASE@27..36 "uppercase" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@36..36 "" [] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-0.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-0.txt.snap index b91985629b57..f4783a035a52 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-0.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-0.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "text" [] [], @@ -46,13 +47,14 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..6 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..6 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..6 0: TW_BASE@0..4 "text" [] [] 1: DASH@4..5 "-" [] [] 2: TW_BOGUS_VALUE@5..6 0: L_BRACKET@5..6 "[" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@6..7 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-1.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-1.txt.snap index 3d041ea2e2a4..29b009fa776f 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-1.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-1.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "text" [] [], @@ -47,14 +48,15 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..13 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..13 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..13 0: TW_BASE@0..4 "text" [] [] 1: DASH@4..5 "-" [] [] 2: TW_BOGUS_VALUE@5..13 0: L_BRACKET@5..6 "[" [] [] 1: TW_SELECTOR@6..13 "#ff0000" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@13..14 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-2.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-2.txt.snap index b787c953170b..945907ff3dbf 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-2.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-value-2.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "text" [] [], @@ -52,7 +53,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..25 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..25 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..25 0: TW_BASE@0..4 "text" [] [] 1: DASH@4..5 "-" [] [] 2: TW_BOGUS_VALUE@5..25 @@ -64,7 +66,7 @@ TwRoot { 5: DASH@17..18 "-" [] [] 6: TW_VALUE@18..25 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@25..26 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-variant.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-variant.txt.snap index 4b4ed9e5a927..57708d0b697c 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-variant.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/incomplete-arbitrary-variant.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "aria" [] [], @@ -47,14 +48,15 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..17 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..17 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..17 0: TW_BASE@0..4 "aria" [] [] 1: DASH@4..5 "-" [] [] 2: TW_BOGUS_VALUE@5..17 0: L_BRACKET@5..6 "[" [] [] 1: TW_SELECTOR@6..17 "foo:text-sm" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@17..18 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/invalid-variant-segment.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/invalid-variant-segment.txt.snap index 55f007f41651..df9e32241e8e 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/invalid-variant-segment.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/invalid-variant-segment.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwBogusCandidate { items: [ @@ -46,14 +47,15 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..12 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_BOGUS_CANDIDATE@0..12 + 2: (empty) + 3: TW_BOGUS_CANDIDATE@0..12 0: TW_BASE@0..5 "group" [] [] 1: DASH@5..6 "-" [] [] 2: TW_NUMBER@6..6 "" [] [] 3: PERCENT@6..7 "%" [] [] 4: COLON@7..8 ":" [] [] 5: TW_BASE@8..12 "flex" [] [] - 3: (empty) + 4: (empty) 2: EOF@12..13 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-modifier-value-1.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-modifier-value-1.txt.snap index 94d428676538..fa9a0ee2cec2 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-modifier-value-1.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-modifier-value-1.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -53,7 +54,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..14 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..13 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..13 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_NAMED_VALUE@3..12 @@ -62,7 +64,7 @@ TwRoot { 0: SLASH@12..13 "/" [] [] 1: TW_BOGUS_MODIFIER@13..13 0: ERROR_TOKEN@13..13 "" [] [] - 3: BANG@13..14 "!" [] [] + 4: BANG@13..14 "!" [] [] 2: EOF@14..15 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-modifier-value.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-modifier-value.txt.snap index 5ad70d5b60b5..60ae6bc65a15 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-modifier-value.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-modifier-value.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwBogusCandidate { items: [ @@ -46,13 +47,14 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..13 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_BOGUS_CANDIDATE@0..13 + 2: (empty) + 3: TW_BOGUS_CANDIDATE@0..13 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_NAMED_VALUE@3..12 0: TW_VALUE@3..12 "green-500" [] [] 3: SLASH@12..13 "/" [] [] - 3: (empty) + 4: (empty) 2: EOF@13..14 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-value.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-value.txt.snap index 9158aa34a88b..63f690bf9917 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-value.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/missing-value.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwBogusCandidate { items: [ @@ -42,10 +43,11 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..5 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_BOGUS_CANDIDATE@0..5 + 2: (empty) + 3: TW_BOGUS_CANDIDATE@0..5 0: TW_BASE@0..4 "text" [] [] 1: DASH@4..5 "-" [] [] - 3: (empty) + 4: (empty) 2: EOF@5..6 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/error/unterminated-container-size.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/error/unterminated-container-size.txt.snap index 3cb192992705..dc27f4e7e664 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/error/unterminated-container-size.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/error/unterminated-container-size.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "@min" [] [], @@ -51,7 +52,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..26 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..26 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..26 0: TW_BASE@0..4 "@min" [] [] 1: DASH@4..5 "-" [] [] 2: TW_BOGUS_VALUE@5..26 @@ -62,7 +64,7 @@ TwRoot { 4: L_BRACKET@22..23 "[" [] [] 5: TW_SELECTOR@23..26 "959" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@26..27 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-functions.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-functions.txt.snap index ddb8a48ca3a5..93352e614d06 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-functions.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-functions.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..1 "w" [] [], @@ -78,6 +79,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@34..36 "bg" [] [], @@ -122,6 +124,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@56..58 "bg" [] [], @@ -177,6 +180,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@96..102 "shadow" [] [], @@ -235,6 +239,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@137..146 "grid-cols" [] [], @@ -309,7 +314,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..34 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..34 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..34 0: TW_BASE@0..1 "w" [] [] 1: DASH@1..2 "-" [] [] 2: TW_ARBITRARY_VALUE@2..34 @@ -344,11 +350,12 @@ TwRoot { 3: R_PAREN@31..32 ")" [] [] 2: R_BRACKET@32..34 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@34..56 0: TW_VARIANT_LIST@34..34 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@34..56 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@34..56 0: TW_BASE@34..36 "bg" [] [] 1: DASH@36..37 "-" [] [] 2: TW_ARBITRARY_VALUE@37..56 @@ -374,11 +381,12 @@ TwRoot { 3: R_PAREN@53..54 ")" [] [] 2: R_BRACKET@54..56 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@56..96 0: TW_VARIANT_LIST@56..56 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@56..96 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@56..96 0: TW_BASE@56..58 "bg" [] [] 1: DASH@58..59 "-" [] [] 2: TW_ARBITRARY_VALUE@59..96 @@ -411,11 +419,12 @@ TwRoot { 3: R_PAREN@93..94 ")" [] [] 2: R_BRACKET@94..96 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@96..137 0: TW_VARIANT_LIST@96..96 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@96..137 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@96..137 0: TW_BASE@96..102 "shadow" [] [] 1: DASH@102..103 "-" [] [] 2: TW_ARBITRARY_VALUE@103..137 @@ -451,11 +460,12 @@ TwRoot { 3: R_PAREN@134..135 ")" [] [] 2: R_BRACKET@135..137 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@137..174 0: TW_VARIANT_LIST@137..137 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@137..174 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@137..174 0: TW_BASE@137..146 "grid-cols" [] [] 1: DASH@146..147 "-" [] [] 2: TW_ARBITRARY_VALUE@147..174 @@ -492,7 +502,7 @@ TwRoot { 3: R_PAREN@172..173 ")" [] [] 2: R_BRACKET@173..174 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@174..175 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-math-functions.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-math-functions.txt.snap index 3b17641129ab..f10621ed6ff2 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-math-functions.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-math-functions.txt.snap @@ -20,6 +20,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..1 "w" [] [], @@ -64,6 +65,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@22..23 "w" [] [], @@ -106,6 +108,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@42..43 "w" [] [], @@ -148,6 +151,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@62..63 "w" [] [], @@ -199,6 +203,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@89..90 "w" [] [], @@ -241,6 +246,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@108..109 "w" [] [], @@ -283,6 +289,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@127..128 "w" [] [], @@ -316,6 +323,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@142..143 "w" [] [], @@ -349,6 +357,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@157..158 "w" [] [], @@ -382,6 +391,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@172..173 "w" [] [], @@ -414,6 +424,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@186..187 "w" [] [], @@ -446,6 +457,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@200..201 "w" [] [], @@ -478,6 +490,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@212..213 "w" [] [], @@ -518,6 +531,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@228..229 "w" [] [], @@ -558,6 +572,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@242..243 "w" [] [], @@ -590,6 +605,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@254..255 "w" [] [], @@ -630,6 +646,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@270..271 "w" [] [], @@ -662,6 +679,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@282..283 "w" [] [], @@ -694,6 +712,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@293..294 "w" [] [], @@ -727,6 +746,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@310..312 "w" [Newline("\n")] [], @@ -815,6 +835,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@355..356 "w" [] [], @@ -934,6 +955,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@415..416 "w" [] [], @@ -1013,6 +1035,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@447..448 "w" [] [], @@ -1081,6 +1104,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@481..482 "w" [] [], @@ -1148,6 +1172,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@512..513 "w" [] [], @@ -1224,7 +1249,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..22 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..22 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..22 0: TW_BASE@0..1 "w" [] [] 1: DASH@1..2 "-" [] [] 2: TW_ARBITRARY_VALUE@2..22 @@ -1250,11 +1276,12 @@ TwRoot { 3: R_PAREN@19..20 ")" [] [] 2: R_BRACKET@20..22 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@22..42 0: TW_VARIANT_LIST@22..22 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@22..42 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@22..42 0: TW_BASE@22..23 "w" [] [] 1: DASH@23..24 "-" [] [] 2: TW_ARBITRARY_VALUE@24..42 @@ -1279,11 +1306,12 @@ TwRoot { 3: R_PAREN@39..40 ")" [] [] 2: R_BRACKET@40..42 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@42..62 0: TW_VARIANT_LIST@42..42 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@42..62 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@42..62 0: TW_BASE@42..43 "w" [] [] 1: DASH@43..44 "-" [] [] 2: TW_ARBITRARY_VALUE@44..62 @@ -1308,11 +1336,12 @@ TwRoot { 3: R_PAREN@59..60 ")" [] [] 2: R_BRACKET@60..62 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@62..89 0: TW_VARIANT_LIST@62..62 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@62..89 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@62..89 0: TW_BASE@62..63 "w" [] [] 1: DASH@63..64 "-" [] [] 2: TW_ARBITRARY_VALUE@64..89 @@ -1343,11 +1372,12 @@ TwRoot { 3: R_PAREN@86..87 ")" [] [] 2: R_BRACKET@87..89 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@89..108 0: TW_VARIANT_LIST@89..89 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@89..108 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@89..108 0: TW_BASE@89..90 "w" [] [] 1: DASH@90..91 "-" [] [] 2: TW_ARBITRARY_VALUE@91..108 @@ -1372,11 +1402,12 @@ TwRoot { 3: R_PAREN@105..106 ")" [] [] 2: R_BRACKET@106..108 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@108..127 0: TW_VARIANT_LIST@108..108 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@108..127 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@108..127 0: TW_BASE@108..109 "w" [] [] 1: DASH@109..110 "-" [] [] 2: TW_ARBITRARY_VALUE@110..127 @@ -1401,11 +1432,12 @@ TwRoot { 3: R_PAREN@124..125 ")" [] [] 2: R_BRACKET@125..127 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@127..142 0: TW_VARIANT_LIST@127..127 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@127..142 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@127..142 0: TW_BASE@127..128 "w" [] [] 1: DASH@128..129 "-" [] [] 2: TW_ARBITRARY_VALUE@129..142 @@ -1424,11 +1456,12 @@ TwRoot { 3: R_PAREN@139..140 ")" [] [] 2: R_BRACKET@140..142 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 7: TW_FULL_CANDIDATE@142..157 0: TW_VARIANT_LIST@142..142 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@142..157 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@142..157 0: TW_BASE@142..143 "w" [] [] 1: DASH@143..144 "-" [] [] 2: TW_ARBITRARY_VALUE@144..157 @@ -1447,11 +1480,12 @@ TwRoot { 3: R_PAREN@154..155 ")" [] [] 2: R_BRACKET@155..157 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 8: TW_FULL_CANDIDATE@157..172 0: TW_VARIANT_LIST@157..157 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@157..172 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@157..172 0: TW_BASE@157..158 "w" [] [] 1: DASH@158..159 "-" [] [] 2: TW_ARBITRARY_VALUE@159..172 @@ -1470,11 +1504,12 @@ TwRoot { 3: R_PAREN@169..170 ")" [] [] 2: R_BRACKET@170..172 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 9: TW_FULL_CANDIDATE@172..186 0: TW_VARIANT_LIST@172..172 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@172..186 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@172..186 0: TW_BASE@172..173 "w" [] [] 1: DASH@173..174 "-" [] [] 2: TW_ARBITRARY_VALUE@174..186 @@ -1492,11 +1527,12 @@ TwRoot { 3: R_PAREN@183..184 ")" [] [] 2: R_BRACKET@184..186 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 10: TW_FULL_CANDIDATE@186..200 0: TW_VARIANT_LIST@186..186 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@186..200 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@186..200 0: TW_BASE@186..187 "w" [] [] 1: DASH@187..188 "-" [] [] 2: TW_ARBITRARY_VALUE@188..200 @@ -1514,11 +1550,12 @@ TwRoot { 3: R_PAREN@197..198 ")" [] [] 2: R_BRACKET@198..200 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 11: TW_FULL_CANDIDATE@200..212 0: TW_VARIANT_LIST@200..200 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@200..212 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@200..212 0: TW_BASE@200..201 "w" [] [] 1: DASH@201..202 "-" [] [] 2: TW_ARBITRARY_VALUE@202..212 @@ -1536,11 +1573,12 @@ TwRoot { 3: R_PAREN@209..210 ")" [] [] 2: R_BRACKET@210..212 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 12: TW_FULL_CANDIDATE@212..228 0: TW_VARIANT_LIST@212..212 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@212..228 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@212..228 0: TW_BASE@212..213 "w" [] [] 1: DASH@213..214 "-" [] [] 2: TW_ARBITRARY_VALUE@214..228 @@ -1563,11 +1601,12 @@ TwRoot { 3: R_PAREN@225..226 ")" [] [] 2: R_BRACKET@226..228 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 13: TW_FULL_CANDIDATE@228..242 0: TW_VARIANT_LIST@228..228 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@228..242 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@228..242 0: TW_BASE@228..229 "w" [] [] 1: DASH@229..230 "-" [] [] 2: TW_ARBITRARY_VALUE@230..242 @@ -1590,11 +1629,12 @@ TwRoot { 3: R_PAREN@239..240 ")" [] [] 2: R_BRACKET@240..242 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 14: TW_FULL_CANDIDATE@242..254 0: TW_VARIANT_LIST@242..242 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@242..254 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@242..254 0: TW_BASE@242..243 "w" [] [] 1: DASH@243..244 "-" [] [] 2: TW_ARBITRARY_VALUE@244..254 @@ -1612,11 +1652,12 @@ TwRoot { 3: R_PAREN@251..252 ")" [] [] 2: R_BRACKET@252..254 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 15: TW_FULL_CANDIDATE@254..270 0: TW_VARIANT_LIST@254..254 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@254..270 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@254..270 0: TW_BASE@254..255 "w" [] [] 1: DASH@255..256 "-" [] [] 2: TW_ARBITRARY_VALUE@256..270 @@ -1639,11 +1680,12 @@ TwRoot { 3: R_PAREN@267..268 ")" [] [] 2: R_BRACKET@268..270 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 16: TW_FULL_CANDIDATE@270..282 0: TW_VARIANT_LIST@270..270 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@270..282 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@270..282 0: TW_BASE@270..271 "w" [] [] 1: DASH@271..272 "-" [] [] 2: TW_ARBITRARY_VALUE@272..282 @@ -1661,11 +1703,12 @@ TwRoot { 3: R_PAREN@279..280 ")" [] [] 2: R_BRACKET@280..282 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 17: TW_FULL_CANDIDATE@282..293 0: TW_VARIANT_LIST@282..282 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@282..293 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@282..293 0: TW_BASE@282..283 "w" [] [] 1: DASH@283..284 "-" [] [] 2: TW_ARBITRARY_VALUE@284..293 @@ -1683,11 +1726,12 @@ TwRoot { 3: R_PAREN@290..291 ")" [] [] 2: R_BRACKET@291..293 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 18: TW_FULL_CANDIDATE@293..310 0: TW_VARIANT_LIST@293..293 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@293..310 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@293..310 0: TW_BASE@293..294 "w" [] [] 1: DASH@294..295 "-" [] [] 2: TW_ARBITRARY_VALUE@295..310 @@ -1706,11 +1750,12 @@ TwRoot { 3: R_PAREN@308..309 ")" [] [] 2: R_BRACKET@309..310 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 19: TW_FULL_CANDIDATE@310..355 0: TW_VARIANT_LIST@310..310 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@310..355 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@310..355 0: TW_BASE@310..312 "w" [Newline("\n")] [] 1: DASH@312..313 "-" [] [] 2: TW_ARBITRARY_VALUE@313..355 @@ -1764,11 +1809,12 @@ TwRoot { 3: R_PAREN@352..353 ")" [] [] 2: R_BRACKET@353..355 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 20: TW_FULL_CANDIDATE@355..415 0: TW_VARIANT_LIST@355..355 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@355..415 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@355..415 0: TW_BASE@355..356 "w" [] [] 1: DASH@356..357 "-" [] [] 2: TW_ARBITRARY_VALUE@357..415 @@ -1842,11 +1888,12 @@ TwRoot { 3: R_PAREN@412..413 ")" [] [] 2: R_BRACKET@413..415 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 21: TW_FULL_CANDIDATE@415..447 0: TW_VARIANT_LIST@415..415 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@415..447 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@415..447 0: TW_BASE@415..416 "w" [] [] 1: DASH@416..417 "-" [] [] 2: TW_ARBITRARY_VALUE@417..447 @@ -1893,11 +1940,12 @@ TwRoot { 3: R_PAREN@444..445 ")" [] [] 2: R_BRACKET@445..447 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 22: TW_FULL_CANDIDATE@447..481 0: TW_VARIANT_LIST@447..447 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@447..481 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@447..481 0: TW_BASE@447..448 "w" [] [] 1: DASH@448..449 "-" [] [] 2: TW_ARBITRARY_VALUE@449..481 @@ -1938,11 +1986,12 @@ TwRoot { 3: R_PAREN@478..479 ")" [] [] 2: R_BRACKET@479..481 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 23: TW_FULL_CANDIDATE@481..512 0: TW_VARIANT_LIST@481..481 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@481..512 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@481..512 0: TW_BASE@481..482 "w" [] [] 1: DASH@482..483 "-" [] [] 2: TW_ARBITRARY_VALUE@483..512 @@ -1982,11 +2031,12 @@ TwRoot { 3: R_PAREN@509..510 ")" [] [] 2: R_BRACKET@510..512 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 24: TW_FULL_CANDIDATE@512..540 0: TW_VARIANT_LIST@512..512 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@512..540 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@512..540 0: TW_BASE@512..513 "w" [] [] 1: DASH@513..514 "-" [] [] 2: TW_ARBITRARY_VALUE@514..540 @@ -2025,7 +2075,7 @@ TwRoot { 3: R_PAREN@538..539 ")" [] [] 2: R_BRACKET@539..540 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@540..541 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-number-exponents.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-number-exponents.txt.snap index c495807c5407..0b02c73d0e4a 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-number-exponents.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-number-exponents.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..1 "w" [] [], @@ -39,6 +40,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@10..11 "w" [] [], @@ -59,6 +61,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@20..21 "w" [] [], @@ -90,7 +93,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..10 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..10 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..10 0: TW_BASE@0..1 "w" [] [] 1: DASH@1..2 "-" [] [] 2: TW_ARBITRARY_VALUE@2..10 @@ -101,11 +105,12 @@ TwRoot { 1: IDENT@6..8 "px" [] [] 2: R_BRACKET@8..10 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@10..20 0: TW_VARIANT_LIST@10..10 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@10..20 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@10..20 0: TW_BASE@10..11 "w" [] [] 1: DASH@11..12 "-" [] [] 2: TW_ARBITRARY_VALUE@12..20 @@ -116,11 +121,12 @@ TwRoot { 1: PERCENT@17..18 "%" [] [] 2: R_BRACKET@18..20 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@20..28 0: TW_VARIANT_LIST@20..20 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@20..28 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@20..28 0: TW_BASE@20..21 "w" [] [] 1: DASH@21..22 "-" [] [] 2: TW_ARBITRARY_VALUE@22..28 @@ -130,7 +136,7 @@ TwRoot { 0: CSS_NUMBER_LITERAL@23..27 "1e-2" [] [] 2: R_BRACKET@27..28 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@28..29 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-urls.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-urls.txt.snap index 1132782f908a..6b3ac12e44b6 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-urls.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-urls.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -43,6 +44,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@29..31 "bg" [] [], @@ -67,6 +69,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@73..75 "bg" [] [], @@ -110,6 +113,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@101..103 "bg" [] [], @@ -146,7 +150,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..29 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..29 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..29 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_ARBITRARY_VALUE@3..29 @@ -160,11 +165,12 @@ TwRoot { 3: R_PAREN@26..27 ")" [] [] 2: R_BRACKET@27..29 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@29..73 0: TW_VARIANT_LIST@29..29 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@29..73 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@29..73 0: TW_BASE@29..31 "bg" [] [] 1: DASH@31..32 "-" [] [] 2: TW_ARBITRARY_VALUE@32..73 @@ -178,11 +184,12 @@ TwRoot { 3: R_PAREN@70..71 ")" [] [] 2: R_BRACKET@71..73 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@73..101 0: TW_VARIANT_LIST@73..73 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@73..101 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@73..101 0: TW_BASE@73..75 "bg" [] [] 1: DASH@75..76 "-" [] [] 2: TW_ARBITRARY_VALUE@76..101 @@ -207,11 +214,12 @@ TwRoot { 3: R_PAREN@98..99 ")" [] [] 2: R_BRACKET@99..101 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@101..132 0: TW_VARIANT_LIST@101..101 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@101..132 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@101..132 0: TW_BASE@101..103 "bg" [] [] 1: DASH@103..104 "-" [] [] 2: TW_ARBITRARY_VALUE@104..132 @@ -225,7 +233,7 @@ TwRoot { 3: R_PAREN@130..131 ")" [] [] 2: R_BRACKET@131..132 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@132..133 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-values.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-values.txt.snap index c0d2a81c8bf5..a9aedf38aedb 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-values.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/css-values.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..1 "w" [] [], @@ -39,6 +40,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@9..10 "w" [] [], @@ -59,6 +61,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@19..20 "w" [] [], @@ -79,6 +82,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@30..31 "w" [] [], @@ -99,6 +103,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@40..41 "w" [] [], @@ -119,6 +124,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@49..50 "w" [] [], @@ -139,6 +145,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@59..61 "bg" [] [], @@ -158,6 +165,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@72..78 "shadow" [] [], @@ -186,6 +194,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@93..95 "bg" [] [], @@ -230,6 +239,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@113..114 "w" [] [], @@ -274,6 +284,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@135..137 "bg" [] [], @@ -298,6 +309,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@164..165 "[" [] [], @@ -316,6 +328,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@177..178 "[" [] [], @@ -365,6 +378,7 @@ TwRoot { }, COLON@209..210 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@210..212 "mt" [] [], @@ -390,7 +404,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..9 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..9 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..9 0: TW_BASE@0..1 "w" [] [] 1: DASH@1..2 "-" [] [] 2: TW_ARBITRARY_VALUE@2..9 @@ -401,11 +416,12 @@ TwRoot { 1: IDENT@5..7 "px" [] [] 2: R_BRACKET@7..9 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@9..19 0: TW_VARIANT_LIST@9..9 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@9..19 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@9..19 0: TW_BASE@9..10 "w" [] [] 1: DASH@10..11 "-" [] [] 2: TW_ARBITRARY_VALUE@11..19 @@ -416,11 +432,12 @@ TwRoot { 1: IDENT@15..17 "px" [] [] 2: R_BRACKET@17..19 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@19..30 0: TW_VARIANT_LIST@19..19 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@19..30 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@19..30 0: TW_BASE@19..20 "w" [] [] 1: DASH@20..21 "-" [] [] 2: TW_ARBITRARY_VALUE@21..30 @@ -431,11 +448,12 @@ TwRoot { 1: IDENT@25..28 "rem" [] [] 2: R_BRACKET@28..30 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@30..40 0: TW_VARIANT_LIST@30..30 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@30..40 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@30..40 0: TW_BASE@30..31 "w" [] [] 1: DASH@31..32 "-" [] [] 2: TW_ARBITRARY_VALUE@32..40 @@ -446,11 +464,12 @@ TwRoot { 1: IDENT@35..38 "rem" [] [] 2: R_BRACKET@38..40 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@40..49 0: TW_VARIANT_LIST@40..40 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@40..49 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@40..49 0: TW_BASE@40..41 "w" [] [] 1: DASH@41..42 "-" [] [] 2: TW_ARBITRARY_VALUE@42..49 @@ -461,11 +480,12 @@ TwRoot { 1: PERCENT@46..47 "%" [] [] 2: R_BRACKET@47..49 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@49..59 0: TW_VARIANT_LIST@49..49 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@49..59 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@49..59 0: TW_BASE@49..50 "w" [] [] 1: DASH@50..51 "-" [] [] 2: TW_ARBITRARY_VALUE@51..59 @@ -476,11 +496,12 @@ TwRoot { 1: IDENT@54..57 "foo" [] [] 2: R_BRACKET@57..59 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@59..72 0: TW_VARIANT_LIST@59..59 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@59..72 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@59..72 0: TW_BASE@59..61 "bg" [] [] 1: DASH@61..62 "-" [] [] 2: TW_ARBITRARY_VALUE@62..72 @@ -490,11 +511,12 @@ TwRoot { 0: CSS_COLOR_LITERAL@63..70 "#ff0000" [] [] 2: R_BRACKET@70..72 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 7: TW_FULL_CANDIDATE@72..93 0: TW_VARIANT_LIST@72..72 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@72..93 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@72..93 0: TW_BASE@72..78 "shadow" [] [] 1: DASH@78..79 "-" [] [] 2: TW_ARBITRARY_VALUE@79..93 @@ -511,11 +533,12 @@ TwRoot { 1: IDENT@89..91 "px" [] [] 2: R_BRACKET@91..93 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 8: TW_FULL_CANDIDATE@93..113 0: TW_VARIANT_LIST@93..93 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@93..113 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@93..113 0: TW_BASE@93..95 "bg" [] [] 1: DASH@95..96 "-" [] [] 2: TW_ARBITRARY_VALUE@96..113 @@ -541,11 +564,12 @@ TwRoot { 3: R_PAREN@110..111 ")" [] [] 2: R_BRACKET@111..113 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 9: TW_FULL_CANDIDATE@113..135 0: TW_VARIANT_LIST@113..113 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@113..135 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@113..135 0: TW_BASE@113..114 "w" [] [] 1: DASH@114..115 "-" [] [] 2: TW_ARBITRARY_VALUE@115..135 @@ -571,11 +595,12 @@ TwRoot { 3: R_PAREN@132..133 ")" [] [] 2: R_BRACKET@133..135 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 10: TW_FULL_CANDIDATE@135..164 0: TW_VARIANT_LIST@135..135 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@135..164 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@135..164 0: TW_BASE@135..137 "bg" [] [] 1: DASH@137..138 "-" [] [] 2: TW_ARBITRARY_VALUE@138..164 @@ -589,11 +614,12 @@ TwRoot { 3: R_PAREN@161..162 ")" [] [] 2: R_BRACKET@162..164 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 11: TW_FULL_CANDIDATE@164..177 0: TW_VARIANT_LIST@164..164 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@164..177 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@164..177 0: L_BRACKET@164..165 "[" [] [] 1: TW_PROPERTY@165..170 "width" [] [] 2: COLON@170..171 ":" [] [] @@ -603,11 +629,12 @@ TwRoot { 1: IDENT@173..175 "px" [] [] 4: R_BRACKET@175..177 "]" [] [Whitespace(" ")] 5: (empty) - 3: (empty) + 4: (empty) 12: TW_FULL_CANDIDATE@177..204 0: TW_VARIANT_LIST@177..177 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@177..204 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@177..204 0: L_BRACKET@177..178 "[" [] [] 1: TW_PROPERTY@178..184 "margin" [] [] 2: COLON@184..185 ":" [] [] @@ -632,7 +659,7 @@ TwRoot { 3: R_PAREN@201..202 ")" [] [] 4: R_BRACKET@202..204 "]" [] [Whitespace(" ")] 5: (empty) - 3: (empty) + 4: (empty) 13: TW_FULL_CANDIDATE@204..214 0: TW_VARIANT_LIST@204..210 0: TW_ARBITRARY_VARIANT@204..209 @@ -641,13 +668,14 @@ TwRoot { 2: R_BRACKET@208..209 "]" [] [] 1: COLON@209..210 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@210..214 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@210..214 0: TW_BASE@210..212 "mt" [] [] 1: DASH@212..213 "-" [] [] 2: TW_NUMBER_VALUE@213..214 0: TW_NUMBER@213..214 "2" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@214..215 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt.snap index 8c80dfe84efb..dc186a963c88 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..9 "bg-radial" [] [], @@ -46,6 +47,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@23..27 "from" [] [], @@ -59,6 +61,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@36..39 "via" [] [], @@ -72,6 +75,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@49..51 "to" [] [], @@ -85,6 +89,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@63..65 "to" [] [], @@ -111,7 +116,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..23 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..23 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..23 0: TW_BASE@0..9 "bg-radial" [] [] 1: DASH@9..10 "-" [] [] 2: TW_ARBITRARY_VALUE@10..23 @@ -127,48 +133,52 @@ TwRoot { 1: PERCENT@20..21 "%" [] [] 2: R_BRACKET@21..23 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@23..36 0: TW_VARIANT_LIST@23..23 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@23..36 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@23..36 0: TW_BASE@23..27 "from" [] [] 1: DASH@27..28 "-" [] [] 2: TW_NAMED_VALUE@28..36 0: TW_VALUE@28..36 "sky-200" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@36..49 0: TW_VARIANT_LIST@36..36 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@36..49 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@36..49 0: TW_BASE@36..39 "via" [] [] 1: DASH@39..40 "-" [] [] 2: TW_NAMED_VALUE@40..49 0: TW_VALUE@40..49 "blue-400" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@49..63 0: TW_VARIANT_LIST@49..49 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@49..63 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@49..63 0: TW_BASE@49..51 "to" [] [] 1: DASH@51..52 "-" [] [] 2: TW_NAMED_VALUE@52..63 0: TW_VALUE@52..63 "indigo-900" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@63..69 0: TW_VARIANT_LIST@63..63 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@63..69 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@63..69 0: TW_BASE@63..65 "to" [] [] 1: DASH@65..66 "-" [] [] 2: TW_PERCENTAGE_VALUE@66..69 0: TW_NUMBER@66..68 "90" [] [] 1: PERCENT@68..69 "%" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@69..70 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/image-url.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/image-url.txt.snap index 921d07c8904c..0eb1a42a67b2 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/image-url.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/image-url.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -55,7 +56,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..28 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..28 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..28 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_ARBITRARY_VALUE@3..28 @@ -69,7 +71,7 @@ TwRoot { 3: R_PAREN@26..27 ")" [] [] 2: R_BRACKET@27..28 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@28..29 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/inset.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/inset.txt.snap index 1b267b9fefd5..4acbf824f79c 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/inset.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/inset.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..7 "inset-x" [] [], @@ -39,6 +40,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@15..22 "inset-y" [] [], @@ -71,7 +73,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..15 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..15 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..15 0: TW_BASE@0..7 "inset-x" [] [] 1: DASH@7..8 "-" [] [] 2: TW_ARBITRARY_VALUE@8..15 @@ -82,11 +85,12 @@ TwRoot { 1: IDENT@11..13 "px" [] [] 2: R_BRACKET@13..15 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@15..29 0: TW_VARIANT_LIST@15..15 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@15..29 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@15..29 0: TW_BASE@15..22 "inset-y" [] [] 1: DASH@22..23 "-" [] [] 2: TW_ARBITRARY_VALUE@23..29 @@ -97,7 +101,7 @@ TwRoot { 1: IDENT@26..28 "px" [] [] 2: R_BRACKET@28..29 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@29..30 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/misc-xy.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/misc-xy.txt.snap index 5ccd8c0410d4..703725e8d59e 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/misc-xy.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/misc-xy.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..7 "space-x" [] [], @@ -39,6 +40,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@15..22 "space-y" [] [], @@ -59,6 +61,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@30..38 "divide-x" [] [], @@ -79,6 +82,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@45..53 "divide-y" [] [], @@ -111,7 +115,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..15 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..15 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..15 0: TW_BASE@0..7 "space-x" [] [] 1: DASH@7..8 "-" [] [] 2: TW_ARBITRARY_VALUE@8..15 @@ -122,11 +127,12 @@ TwRoot { 1: IDENT@11..13 "px" [] [] 2: R_BRACKET@13..15 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@15..30 0: TW_VARIANT_LIST@15..15 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@15..30 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@15..30 0: TW_BASE@15..22 "space-y" [] [] 1: DASH@22..23 "-" [] [] 2: TW_ARBITRARY_VALUE@23..30 @@ -137,11 +143,12 @@ TwRoot { 1: IDENT@26..28 "px" [] [] 2: R_BRACKET@28..30 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@30..45 0: TW_VARIANT_LIST@30..30 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@30..45 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@30..45 0: TW_BASE@30..38 "divide-x" [] [] 1: DASH@38..39 "-" [] [] 2: TW_ARBITRARY_VALUE@39..45 @@ -152,11 +159,12 @@ TwRoot { 1: IDENT@41..43 "px" [] [] 2: R_BRACKET@43..45 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@45..59 0: TW_VARIANT_LIST@45..45 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@45..59 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@45..59 0: TW_BASE@45..53 "divide-y" [] [] 1: DASH@53..54 "-" [] [] 2: TW_ARBITRARY_VALUE@54..59 @@ -167,7 +175,7 @@ TwRoot { 1: IDENT@56..58 "px" [] [] 2: R_BRACKET@58..59 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@59..60 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/shadow.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/shadow.txt.snap index 17f33c51e60a..647a9b6ac56f 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/shadow.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/shadow.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..6 "shadow" [] [], @@ -59,7 +60,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..20 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..20 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..20 0: TW_BASE@0..6 "shadow" [] [] 1: DASH@6..7 "-" [] [] 2: TW_ARBITRARY_VALUE@7..20 @@ -76,7 +78,7 @@ TwRoot { 1: IDENT@17..19 "px" [] [] 2: R_BRACKET@19..20 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@20..21 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-0.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-0.txt.snap index 570796604bbc..e722c62a9c32 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-0.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-0.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@0..1 "[" [] [], @@ -53,7 +54,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..14 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@0..14 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@0..14 0: L_BRACKET@0..1 "[" [] [] 1: TW_PROPERTY@1..6 "color" [] [] 2: COLON@6..7 ":" [] [] @@ -65,7 +67,7 @@ TwRoot { 0: SLASH@11..12 "/" [] [] 1: TW_NUMBER_VALUE@12..14 0: TW_NUMBER@12..14 "50" [] [] - 3: (empty) + 4: (empty) 2: EOF@14..15 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-1.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-1.txt.snap index e1a55a72a75c..40c51229b96d 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-1.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-1.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@0..1 "[" [] [], @@ -66,7 +67,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..38 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@0..38 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@0..38 0: L_BRACKET@0..1 "[" [] [] 1: TW_PROPERTY@1..13 "--pattern-fg" [] [] 2: COLON@13..14 ":" [] [] @@ -86,7 +88,7 @@ TwRoot { 0: SLASH@36..37 "/" [] [] 1: TW_NUMBER_VALUE@37..38 0: TW_NUMBER@37..38 "5" [] [] - 3: (empty) + 4: (empty) 2: EOF@38..39 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-2.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-2.txt.snap index d860fdab22ca..2b4cafa7b69d 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-2.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-2.txt.snap @@ -30,6 +30,7 @@ TwRoot { }, COLON@4..5 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@5..6 "[" [] [], @@ -84,7 +85,8 @@ TwRoot { 2: (empty) 1: COLON@4..5 ":" [] [] 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@5..41 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@5..41 0: L_BRACKET@5..6 "[" [] [] 1: TW_PROPERTY@6..18 "--pattern-fg" [] [] 2: COLON@18..19 ":" [] [] @@ -104,7 +106,7 @@ TwRoot { 0: SLASH@38..39 "/" [] [] 1: TW_NUMBER_VALUE@39..41 0: TW_NUMBER@39..41 "10" [] [] - 3: (empty) + 4: (empty) 2: EOF@41..42 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-3.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-3.txt.snap index 4948f4f79427..8e8f38cf2818 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-3.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-3.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@0..1 "[" [] [], @@ -48,7 +49,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..17 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@0..17 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@0..17 0: L_BRACKET@0..1 "[" [] [] 1: TW_PROPERTY@1..11 "background" [] [] 2: COLON@11..12 ":" [] [] @@ -57,7 +59,7 @@ TwRoot { 0: IDENT@12..16 "blue" [] [] 4: R_BRACKET@16..17 "]" [] [] 5: (empty) - 3: (empty) + 4: (empty) 2: EOF@17..18 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-css-function.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-css-function.txt.snap index 61fbebc7df2b..14b06b49cbd7 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-css-function.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-candidate-css-function.txt.snap @@ -30,6 +30,7 @@ TwRoot { }, COLON@5..6 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@6..7 "[" [] [], @@ -71,7 +72,8 @@ TwRoot { 2: (empty) 1: COLON@5..6 ":" [] [] 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@6..30 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@6..30 0: L_BRACKET@6..7 "[" [] [] 1: TW_PROPERTY@7..11 "mask" [] [] 2: COLON@11..12 ":" [] [] @@ -84,7 +86,7 @@ TwRoot { 3: R_PAREN@28..29 ")" [] [] 4: R_BRACKET@29..30 "]" [] [] 5: (empty) - 3: (empty) + 4: (empty) 2: EOF@30..31 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-modifier-colon.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-modifier-colon.txt.snap index ebaf384e27ae..379f4af1a107 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-modifier-colon.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/arbitrary-modifier-colon.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -94,6 +95,7 @@ TwRoot { }, COLON@49..50 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@50..55 "flex" [] [Whitespace(" ")], @@ -135,6 +137,7 @@ TwRoot { }, COLON@69..70 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@70..74 "flex" [] [], @@ -156,7 +159,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..32 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..32 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..32 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_NAMED_VALUE@3..10 @@ -181,7 +185,7 @@ TwRoot { 0: IDENT@22..29 "--alpha" [] [] 3: R_PAREN@29..30 ")" [] [] 2: R_BRACKET@30..32 "]" [] [Whitespace(" ")] - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@32..55 0: TW_VARIANT_LIST@32..50 0: TW_VARIANT_EXPRESSION@32..49 @@ -206,10 +210,11 @@ TwRoot { 2: R_BRACKET@48..49 "]" [] [] 1: COLON@49..50 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@50..55 + 2: (empty) + 3: TW_STATIC_CANDIDATE@50..55 0: TW_BASE@50..55 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@55..74 0: TW_VARIANT_LIST@55..70 0: TW_VARIANT_EXPRESSION@55..69 @@ -234,10 +239,11 @@ TwRoot { 2: R_BRACKET@68..69 "]" [] [] 1: COLON@69..70 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@70..74 + 2: (empty) + 3: TW_STATIC_CANDIDATE@70..74 0: TW_BASE@70..74 "flex" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@74..75 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/bare-modifier.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/bare-modifier.txt.snap index 43debc9ac5e0..ee38fdfca163 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/bare-modifier.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/bare-modifier.txt.snap @@ -18,6 +18,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@0..11 "@container" [] [Whitespace(" ")], @@ -27,6 +28,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@11..21 "@container" [] [], @@ -41,6 +43,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@30..36 "shadow" [] [], @@ -55,6 +58,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@40..44 "flex" [] [], @@ -69,6 +73,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@48..59 "drop-shadow" [] [], @@ -94,6 +99,7 @@ TwRoot { }, COLON@73..74 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@74..79 "flex" [] [Whitespace(" ")], @@ -114,6 +120,7 @@ TwRoot { }, COLON@82..83 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@83..93 "@container" [] [], @@ -140,50 +147,55 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..11 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_STATIC_CANDIDATE@0..11 + 2: (empty) + 3: TW_STATIC_CANDIDATE@0..11 0: TW_BASE@0..11 "@container" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@11..30 0: TW_VARIANT_LIST@11..11 1: (empty) - 2: TW_STATIC_CANDIDATE@11..30 + 2: (empty) + 3: TW_STATIC_CANDIDATE@11..30 0: TW_BASE@11..21 "@container" [] [] 1: TW_MODIFIER@21..30 0: SLASH@21..22 "/" [] [] 1: TW_NAMED_VALUE@22..30 0: TW_VALUE@22..30 "sidebar" [] [Whitespace(" ")] - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@30..40 0: TW_VARIANT_LIST@30..30 1: (empty) - 2: TW_STATIC_CANDIDATE@30..40 + 2: (empty) + 3: TW_STATIC_CANDIDATE@30..40 0: TW_BASE@30..36 "shadow" [] [] 1: TW_MODIFIER@36..40 0: SLASH@36..37 "/" [] [] 1: TW_NUMBER_VALUE@37..40 0: TW_NUMBER@37..40 "50" [] [Whitespace(" ")] - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@40..48 0: TW_VARIANT_LIST@40..40 1: (empty) - 2: TW_STATIC_CANDIDATE@40..48 + 2: (empty) + 3: TW_STATIC_CANDIDATE@40..48 0: TW_BASE@40..44 "flex" [] [] 1: TW_MODIFIER@44..48 0: SLASH@44..45 "/" [] [] 1: TW_NUMBER_VALUE@45..48 0: TW_NUMBER@45..48 "50" [] [Whitespace(" ")] - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@48..63 0: TW_VARIANT_LIST@48..48 1: (empty) - 2: TW_STATIC_CANDIDATE@48..63 + 2: (empty) + 3: TW_STATIC_CANDIDATE@48..63 0: TW_BASE@48..59 "drop-shadow" [] [] 1: TW_MODIFIER@59..63 0: SLASH@59..60 "/" [] [] 1: TW_NUMBER_VALUE@60..63 0: TW_NUMBER@60..63 "50" [] [Whitespace(" ")] - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@63..79 0: TW_VARIANT_LIST@63..74 0: TW_VARIANT_EXPRESSION@63..73 @@ -194,10 +206,11 @@ TwRoot { 2: (empty) 1: COLON@73..74 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@74..79 + 2: (empty) + 3: TW_STATIC_CANDIDATE@74..79 0: TW_BASE@74..79 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@79..98 0: TW_VARIANT_LIST@79..83 0: TW_VARIANT_EXPRESSION@79..82 @@ -208,13 +221,14 @@ TwRoot { 2: (empty) 1: COLON@82..83 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@83..98 + 2: (empty) + 3: TW_STATIC_CANDIDATE@83..98 0: TW_BASE@83..93 "@container" [] [] 1: TW_MODIFIER@93..98 0: SLASH@93..94 "/" [] [] 1: TW_NAMED_VALUE@94..98 0: TW_VALUE@94..98 "main" [] [] - 3: (empty) + 4: (empty) 2: EOF@98..98 "" [] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/css-arbitrary-candidates.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/css-arbitrary-candidates.txt.snap index 5d614a8bc9a1..e5f2e74b9fca 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/css-arbitrary-candidates.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/candidates/css-arbitrary-candidates.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@0..1 "[" [] [], @@ -61,6 +62,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@26..27 "[" [] [], @@ -83,6 +85,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@69..70 "[" [] [], @@ -125,6 +128,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwArbitraryCandidate { l_brack_token: L_BRACKET@92..93 "[" [] [], @@ -197,7 +201,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..26 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@0..26 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@0..26 0: L_BRACKET@0..1 "[" [] [] 1: TW_PROPERTY@1..6 "width" [] [] 2: COLON@6..7 ":" [] [] @@ -222,11 +227,12 @@ TwRoot { 3: R_PAREN@23..24 ")" [] [] 4: R_BRACKET@24..26 "]" [] [Whitespace(" ")] 5: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@26..69 0: TW_VARIANT_LIST@26..26 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@26..69 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@26..69 0: L_BRACKET@26..27 "[" [] [] 1: TW_PROPERTY@27..43 "background-image" [] [] 2: COLON@43..44 ":" [] [] @@ -239,11 +245,12 @@ TwRoot { 3: R_PAREN@66..67 ")" [] [] 4: R_BRACKET@67..69 "]" [] [Whitespace(" ")] 5: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@69..92 0: TW_VARIANT_LIST@69..69 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@69..92 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@69..92 0: L_BRACKET@69..70 "[" [] [] 1: TW_PROPERTY@70..75 "color" [] [] 2: COLON@75..76 ":" [] [] @@ -268,11 +275,12 @@ TwRoot { 3: R_PAREN@89..90 ")" [] [] 4: R_BRACKET@90..92 "]" [] [Whitespace(" ")] 5: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@92..141 0: TW_VARIANT_LIST@92..92 1: (empty) - 2: TW_ARBITRARY_CANDIDATE@92..141 + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@92..141 0: L_BRACKET@92..93 "[" [] [] 1: TW_PROPERTY@93..114 "grid-template-columns" [] [] 2: COLON@114..115 ":" [] [] @@ -308,7 +316,7 @@ TwRoot { 3: R_PAREN@139..140 ")" [] [] 4: R_BRACKET@140..141 "]" [] [] 5: (empty) - 3: (empty) + 4: (empty) 2: EOF@141..142 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/data-attribute.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/data-attribute.txt.snap index 253e80e47d3a..18b3dea7ddc2 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/data-attribute.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/data-attribute.txt.snap @@ -34,6 +34,7 @@ TwRoot { }, COLON@11..12 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@12..16 "text" [] [], @@ -69,13 +70,14 @@ TwRoot { 2: (empty) 1: COLON@11..12 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@12..24 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@12..24 0: TW_BASE@12..16 "text" [] [] 1: DASH@16..17 "-" [] [] 2: TW_NAMED_VALUE@17..24 0: TW_VALUE@17..24 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@24..25 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/gradients/precise-control.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/gradients/precise-control.txt.snap index b306af1e6e67..6b03e9e08c6e 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/gradients/precise-control.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/gradients/precise-control.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -32,6 +33,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@17..21 "from" [] [], @@ -45,6 +47,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@33..37 "from" [] [], @@ -59,6 +62,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@42..45 "via" [] [], @@ -72,6 +76,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@54..57 "via" [] [], @@ -86,6 +91,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@62..64 "to" [] [], @@ -99,6 +105,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@77..79 "to" [] [], @@ -125,76 +132,83 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..17 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..17 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..17 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_NAMED_VALUE@3..17 0: TW_VALUE@3..17 "gradient-to-r" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@17..33 0: TW_VARIANT_LIST@17..17 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@17..33 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@17..33 0: TW_BASE@17..21 "from" [] [] 1: DASH@21..22 "-" [] [] 2: TW_NAMED_VALUE@22..33 0: TW_VALUE@22..33 "indigo-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@33..42 0: TW_VARIANT_LIST@33..33 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@33..42 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@33..42 0: TW_BASE@33..37 "from" [] [] 1: DASH@37..38 "-" [] [] 2: TW_PERCENTAGE_VALUE@38..42 0: TW_NUMBER@38..40 "10" [] [] 1: PERCENT@40..42 "%" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@42..54 0: TW_VARIANT_LIST@42..42 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@42..54 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@42..54 0: TW_BASE@42..45 "via" [] [] 1: DASH@45..46 "-" [] [] 2: TW_NAMED_VALUE@46..54 0: TW_VALUE@46..54 "sky-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@54..62 0: TW_VARIANT_LIST@54..54 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@54..62 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@54..62 0: TW_BASE@54..57 "via" [] [] 1: DASH@57..58 "-" [] [] 2: TW_PERCENTAGE_VALUE@58..62 0: TW_NUMBER@58..60 "30" [] [] 1: PERCENT@60..62 "%" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@62..77 0: TW_VARIANT_LIST@62..62 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@62..77 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@62..77 0: TW_BASE@62..64 "to" [] [] 1: DASH@64..65 "-" [] [] 2: TW_NAMED_VALUE@65..77 0: TW_VALUE@65..77 "emerald-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@77..83 0: TW_VARIANT_LIST@77..77 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@77..83 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@77..83 0: TW_BASE@77..79 "to" [] [] 1: DASH@79..80 "-" [] [] 2: TW_PERCENTAGE_VALUE@80..83 0: TW_NUMBER@80..82 "90" [] [] 1: PERCENT@82..83 "%" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@83..84 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/gradients/simple.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/gradients/simple.txt.snap index 54d81e0978dd..ae84dd42ac8e 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/gradients/simple.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/gradients/simple.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -32,6 +33,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@17..21 "from" [] [], @@ -45,6 +47,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@33..36 "via" [] [], @@ -58,6 +61,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@48..50 "to" [] [], @@ -83,43 +87,47 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..17 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..17 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..17 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_NAMED_VALUE@3..17 0: TW_VALUE@3..17 "gradient-to-r" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@17..33 0: TW_VARIANT_LIST@17..17 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@17..33 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@17..33 0: TW_BASE@17..21 "from" [] [] 1: DASH@21..22 "-" [] [] 2: TW_NAMED_VALUE@22..33 0: TW_VALUE@22..33 "indigo-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@33..48 0: TW_VARIANT_LIST@33..33 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@33..48 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@33..48 0: TW_BASE@33..36 "via" [] [] 1: DASH@36..37 "-" [] [] 2: TW_NAMED_VALUE@37..48 0: TW_VALUE@37..48 "purple-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@48..59 0: TW_VARIANT_LIST@48..48 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@48..59 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@48..59 0: TW_BASE@48..50 "to" [] [] 1: DASH@50..51 "-" [] [] 2: TW_NAMED_VALUE@51..59 0: TW_VALUE@51..59 "pink-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@59..60 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/group-data.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/group-data.txt.snap index 6c4c38df361f..439c7bfc8550 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/group-data.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/group-data.txt.snap @@ -40,6 +40,7 @@ TwRoot { }, COLON@29..30 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@30..36 "hidden" [] [], @@ -76,10 +77,11 @@ TwRoot { 2: (empty) 1: COLON@29..30 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@30..36 + 2: (empty) + 3: TW_STATIC_CANDIDATE@30..36 0: TW_BASE@30..36 "hidden" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@36..37 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/2-classes.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/2-classes.txt.snap index e4e14c66b19c..7f11818836e8 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/2-classes.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/2-classes.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@0..7 "border" [] [Whitespace(" ")], @@ -28,6 +29,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: DASH@7..8 "-" [] [], candidate: TwFunctionalCandidate { base_token: TW_BASE@8..11 "top" [] [], @@ -53,20 +55,22 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..7 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_STATIC_CANDIDATE@0..7 + 2: (empty) + 3: TW_STATIC_CANDIDATE@0..7 0: TW_BASE@0..7 "border" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@7..13 0: TW_VARIANT_LIST@7..7 - 1: DASH@7..8 "-" [] [] - 2: TW_FUNCTIONAL_CANDIDATE@8..13 + 1: (empty) + 2: DASH@7..8 "-" [] [] + 3: TW_FUNCTIONAL_CANDIDATE@8..13 0: TW_BASE@8..11 "top" [] [] 1: DASH@11..12 "-" [] [] 2: TW_NUMBER_VALUE@12..13 0: TW_NUMBER@12..13 "2" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@13..14 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/arbitrary-value-0.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/arbitrary-value-0.txt.snap index 88fbde17eed1..4be53ef6b5ca 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/arbitrary-value-0.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/arbitrary-value-0.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -50,7 +51,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..12 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..12 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..12 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_ARBITRARY_VALUE@3..12 @@ -60,7 +62,7 @@ TwRoot { 0: CSS_COLOR_LITERAL@4..11 "#ff0000" [] [] 2: R_BRACKET@11..12 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@12..13 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/arbitrary-value-1.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/arbitrary-value-1.txt.snap index 40549bad8a3a..8c81306948ec 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/arbitrary-value-1.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/arbitrary-value-1.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "px" [] [], @@ -51,7 +52,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..9 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..9 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..9 0: TW_BASE@0..2 "px" [] [] 1: DASH@2..3 "-" [] [] 2: TW_ARBITRARY_VALUE@3..9 @@ -62,7 +64,7 @@ TwRoot { 1: IDENT@6..8 "px" [] [] 2: R_BRACKET@8..9 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@9..10 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt.snap index 832fd2371b6e..ad9c17b59665 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..11 "drop-shadow" [] [], @@ -44,13 +45,14 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..19 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..19 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..19 0: TW_BASE@0..11 "drop-shadow" [] [] 1: DASH@11..12 "-" [] [] 2: TW_NAMED_VALUE@12..19 0: TW_VALUE@12..19 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@19..20 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt.snap index 58ecbe25cb15..c2174543cc82 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..11 "drop-shadow" [] [], @@ -50,7 +51,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..21 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..21 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..21 0: TW_BASE@0..11 "drop-shadow" [] [] 1: DASH@11..12 "-" [] [] 2: TW_ARBITRARY_VALUE@12..21 @@ -60,7 +62,7 @@ TwRoot { 0: CSS_COLOR_LITERAL@13..20 "#000000" [] [] 2: R_BRACKET@20..21 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@21..22 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt.snap index f01a2fb30258..b52f0222a5cb 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..16 "border-spacing-y" [] [], @@ -51,7 +52,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..22 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..22 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..22 0: TW_BASE@0..16 "border-spacing-y" [] [] 1: DASH@16..17 "-" [] [] 2: TW_ARBITRARY_VALUE@17..22 @@ -62,7 +64,7 @@ TwRoot { 1: IDENT@19..21 "px" [] [] 2: R_BRACKET@21..22 "]" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@22..23 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-0.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-0.txt.snap index 2c6d06d76536..965e3407720a 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-0.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-0.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "text" [] [], @@ -44,13 +45,14 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..7 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..7 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..7 0: TW_BASE@0..4 "text" [] [] 1: DASH@4..5 "-" [] [] 2: TW_NAMED_VALUE@5..7 0: TW_VALUE@5..7 "md" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@7..8 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-1.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-1.txt.snap index d0a2815c0b2c..222e4c137a20 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-1.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-1.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -44,13 +45,14 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..10 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..10 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..10 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_NAMED_VALUE@3..10 0: TW_VALUE@3..10 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@10..11 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-2.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-2.txt.snap index 846176ebe9d3..f43c4b5bbc65 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-2.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/basic-2.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..12 "break-before" [] [], @@ -32,6 +33,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@18..29 "break-after" [] [], @@ -45,6 +47,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@35..44 "mix-blend" [] [], @@ -70,33 +73,36 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..18 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..18 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..18 0: TW_BASE@0..12 "break-before" [] [] 1: DASH@12..13 "-" [] [] 2: TW_NAMED_VALUE@13..18 0: TW_VALUE@13..18 "auto" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@18..35 0: TW_VARIANT_LIST@18..18 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@18..35 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@18..35 0: TW_BASE@18..29 "break-after" [] [] 1: DASH@29..30 "-" [] [] 2: TW_NAMED_VALUE@30..35 0: TW_VALUE@30..35 "page" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@35..51 0: TW_VARIANT_LIST@35..35 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@35..51 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@35..51 0: TW_BASE@35..44 "mix-blend" [] [] 1: DASH@44..45 "-" [] [] 2: TW_NAMED_VALUE@45..51 0: TW_VALUE@45..51 "normal" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@51..52 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/border.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/border.txt.snap index b5be6492867b..5814850f87b3 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/border.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/border.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..6 "border" [] [], @@ -32,6 +33,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@17..23 "border" [] [], @@ -45,6 +47,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@33..39 "border" [] [], @@ -70,33 +73,36 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..17 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..17 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..17 0: TW_BASE@0..6 "border" [] [] 1: DASH@6..7 "-" [] [] 2: TW_NAMED_VALUE@7..17 0: TW_VALUE@7..17 "slate-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@17..33 0: TW_VARIANT_LIST@17..17 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@17..33 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@17..33 0: TW_BASE@17..23 "border" [] [] 1: DASH@23..24 "-" [] [] 2: TW_NAMED_VALUE@24..33 0: TW_VALUE@24..33 "teal-600" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@33..45 0: TW_VARIANT_LIST@33..33 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@33..45 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@33..45 0: TW_BASE@33..39 "border" [] [] 1: DASH@39..40 "-" [] [] 2: TW_NAMED_VALUE@40..45 0: TW_VALUE@40..45 "solid" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@45..46 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/css-value.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/css-value.txt.snap index 70d52897d564..5e578308c86a 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/css-value.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/css-value.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "text" [] [], @@ -46,7 +47,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..17 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..17 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..17 0: TW_BASE@0..4 "text" [] [] 1: DASH@4..5 "-" [] [] 2: TW_CSS_VARIABLE_VALUE@5..17 @@ -54,7 +56,7 @@ TwRoot { 1: TW_VALUE@6..16 "--my-color" [] [] 2: R_PAREN@16..17 ")" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@17..18 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/important.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/important.txt.snap index 36c587d8e34d..3355676231d0 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/important.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/important.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "text" [] [], @@ -44,13 +45,14 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..8 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..7 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..7 0: TW_BASE@0..4 "text" [] [] 1: DASH@4..5 "-" [] [] 2: TW_NAMED_VALUE@5..7 0: TW_VALUE@5..7 "lg" [] [] 3: (empty) - 3: BANG@7..8 "!" [] [] + 4: BANG@7..8 "!" [] [] 2: EOF@8..9 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/legacy-important.txt b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/legacy-important.txt new file mode 100644 index 000000000000..6faa07298d3c --- /dev/null +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/legacy-important.txt @@ -0,0 +1 @@ +!flex hover:!p-4 !-m-4 ![color:red] !bg-red-500/50 !@container/main !w-full flex! !flex \ No newline at end of file diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/legacy-important.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/legacy-important.txt.snap new file mode 100644 index 000000000000..90f41d62c612 --- /dev/null +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/legacy-important.txt.snap @@ -0,0 +1,270 @@ +--- +source: crates/biome_tailwind_parser/tests/spec_test.rs +expression: snapshot +--- + +## Input + +```text +!flex hover:!p-4 !-m-4 ![color:red] !bg-red-500/50 !@container/main !w-full flex! !flex +``` + + +## AST + +``` +TwRoot { + bom_token: missing (optional), + candidates: TwCandidateList [ + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@0..1 "!" [] [], + negative_token: missing (optional), + candidate: TwStaticCandidate { + base_token: TW_BASE@1..6 "flex" [] [Whitespace(" ")], + modifier: missing (optional), + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [ + TwVariantExpression { + segments: TwVariantSegmentList [ + TwNamedVariantSegment { + value_token: TW_VARIANT_SEGMENT@6..11 "hover" [] [], + }, + ], + glued_value: missing (optional), + modifier: missing (optional), + }, + COLON@11..12 ":" [] [], + ], + legacy_important_token: BANG@12..13 "!" [] [], + negative_token: missing (optional), + candidate: TwFunctionalCandidate { + base_token: TW_BASE@13..14 "p" [] [], + minus_token: DASH@14..15 "-" [] [], + value: TwNumberValue { + value_token: TW_NUMBER@15..17 "4" [] [Whitespace(" ")], + }, + modifier: missing (optional), + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@17..18 "!" [] [], + negative_token: DASH@18..19 "-" [] [], + candidate: TwFunctionalCandidate { + base_token: TW_BASE@19..20 "m" [] [], + minus_token: DASH@20..21 "-" [] [], + value: TwNumberValue { + value_token: TW_NUMBER@21..23 "4" [] [Whitespace(" ")], + }, + modifier: missing (optional), + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@23..24 "!" [] [], + negative_token: missing (optional), + candidate: TwArbitraryCandidate { + l_brack_token: L_BRACKET@24..25 "[" [] [], + property_token: TW_PROPERTY@25..30 "color" [] [], + colon_token: COLON@30..31 ":" [] [], + value: CssGenericComponentValueList [ + CssIdentifier { + ident_token: IDENT@31..34 "red" [] [], + }, + ], + r_brack_token: R_BRACKET@34..36 "]" [] [Whitespace(" ")], + modifier: missing (optional), + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@36..37 "!" [] [], + negative_token: missing (optional), + candidate: TwFunctionalCandidate { + base_token: TW_BASE@37..39 "bg" [] [], + minus_token: DASH@39..40 "-" [] [], + value: TwNamedValue { + value_token: TW_VALUE@40..47 "red-500" [] [], + }, + modifier: TwModifier { + slash_token: SLASH@47..48 "/" [] [], + value: TwNumberValue { + value_token: TW_NUMBER@48..51 "50" [] [Whitespace(" ")], + }, + }, + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@51..52 "!" [] [], + negative_token: missing (optional), + candidate: TwStaticCandidate { + base_token: TW_BASE@52..62 "@container" [] [], + modifier: TwModifier { + slash_token: SLASH@62..63 "/" [] [], + value: TwNamedValue { + value_token: TW_VALUE@63..68 "main" [] [Whitespace(" ")], + }, + }, + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@68..69 "!" [] [], + negative_token: missing (optional), + candidate: TwFunctionalCandidate { + base_token: TW_BASE@69..70 "w" [] [], + minus_token: DASH@70..71 "-" [] [], + value: TwNamedValue { + value_token: TW_VALUE@71..76 "full" [] [Whitespace(" ")], + }, + modifier: missing (optional), + }, + excl_token: missing (optional), + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: missing (optional), + negative_token: missing (optional), + candidate: TwStaticCandidate { + base_token: TW_BASE@76..80 "flex" [] [], + modifier: missing (optional), + }, + excl_token: BANG@80..82 "!" [] [Whitespace(" ")], + }, + TwFullCandidate { + variants: TwVariantList [], + legacy_important_token: BANG@82..83 "!" [] [], + negative_token: missing (optional), + candidate: TwStaticCandidate { + base_token: TW_BASE@83..87 "flex" [] [], + modifier: missing (optional), + }, + excl_token: missing (optional), + }, + ], + eof_token: EOF@87..87 "" [] [], +} +``` + +## CST + +``` +0: TW_ROOT@0..87 + 0: (empty) + 1: TW_CANDIDATE_LIST@0..87 + 0: TW_FULL_CANDIDATE@0..6 + 0: TW_VARIANT_LIST@0..0 + 1: BANG@0..1 "!" [] [] + 2: (empty) + 3: TW_STATIC_CANDIDATE@1..6 + 0: TW_BASE@1..6 "flex" [] [Whitespace(" ")] + 1: (empty) + 4: (empty) + 1: TW_FULL_CANDIDATE@6..17 + 0: TW_VARIANT_LIST@6..12 + 0: TW_VARIANT_EXPRESSION@6..11 + 0: TW_VARIANT_SEGMENT_LIST@6..11 + 0: TW_NAMED_VARIANT_SEGMENT@6..11 + 0: TW_VARIANT_SEGMENT@6..11 "hover" [] [] + 1: (empty) + 2: (empty) + 1: COLON@11..12 ":" [] [] + 1: BANG@12..13 "!" [] [] + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@13..17 + 0: TW_BASE@13..14 "p" [] [] + 1: DASH@14..15 "-" [] [] + 2: TW_NUMBER_VALUE@15..17 + 0: TW_NUMBER@15..17 "4" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 2: TW_FULL_CANDIDATE@17..23 + 0: TW_VARIANT_LIST@17..17 + 1: BANG@17..18 "!" [] [] + 2: DASH@18..19 "-" [] [] + 3: TW_FUNCTIONAL_CANDIDATE@19..23 + 0: TW_BASE@19..20 "m" [] [] + 1: DASH@20..21 "-" [] [] + 2: TW_NUMBER_VALUE@21..23 + 0: TW_NUMBER@21..23 "4" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 3: TW_FULL_CANDIDATE@23..36 + 0: TW_VARIANT_LIST@23..23 + 1: BANG@23..24 "!" [] [] + 2: (empty) + 3: TW_ARBITRARY_CANDIDATE@24..36 + 0: L_BRACKET@24..25 "[" [] [] + 1: TW_PROPERTY@25..30 "color" [] [] + 2: COLON@30..31 ":" [] [] + 3: CSS_GENERIC_COMPONENT_VALUE_LIST@31..34 + 0: CSS_IDENTIFIER@31..34 + 0: IDENT@31..34 "red" [] [] + 4: R_BRACKET@34..36 "]" [] [Whitespace(" ")] + 5: (empty) + 4: (empty) + 4: TW_FULL_CANDIDATE@36..51 + 0: TW_VARIANT_LIST@36..36 + 1: BANG@36..37 "!" [] [] + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@37..51 + 0: TW_BASE@37..39 "bg" [] [] + 1: DASH@39..40 "-" [] [] + 2: TW_NAMED_VALUE@40..47 + 0: TW_VALUE@40..47 "red-500" [] [] + 3: TW_MODIFIER@47..51 + 0: SLASH@47..48 "/" [] [] + 1: TW_NUMBER_VALUE@48..51 + 0: TW_NUMBER@48..51 "50" [] [Whitespace(" ")] + 4: (empty) + 5: TW_FULL_CANDIDATE@51..68 + 0: TW_VARIANT_LIST@51..51 + 1: BANG@51..52 "!" [] [] + 2: (empty) + 3: TW_STATIC_CANDIDATE@52..68 + 0: TW_BASE@52..62 "@container" [] [] + 1: TW_MODIFIER@62..68 + 0: SLASH@62..63 "/" [] [] + 1: TW_NAMED_VALUE@63..68 + 0: TW_VALUE@63..68 "main" [] [Whitespace(" ")] + 4: (empty) + 6: TW_FULL_CANDIDATE@68..76 + 0: TW_VARIANT_LIST@68..68 + 1: BANG@68..69 "!" [] [] + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@69..76 + 0: TW_BASE@69..70 "w" [] [] + 1: DASH@70..71 "-" [] [] + 2: TW_NAMED_VALUE@71..76 + 0: TW_VALUE@71..76 "full" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 7: TW_FULL_CANDIDATE@76..82 + 0: TW_VARIANT_LIST@76..76 + 1: (empty) + 2: (empty) + 3: TW_STATIC_CANDIDATE@76..80 + 0: TW_BASE@76..80 "flex" [] [] + 1: (empty) + 4: BANG@80..82 "!" [] [Whitespace(" ")] + 8: TW_FULL_CANDIDATE@82..87 + 0: TW_VARIANT_LIST@82..82 + 1: BANG@82..83 "!" [] [] + 2: (empty) + 3: TW_STATIC_CANDIDATE@83..87 + 0: TW_BASE@83..87 "flex" [] [] + 1: (empty) + 4: (empty) + 2: EOF@87..87 "" [] [] + +``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/modifier.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/modifier.txt.snap index 796cf9745958..642c58926f57 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/modifier.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/modifier.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..2 "bg" [] [], @@ -49,7 +50,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..13 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..13 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..13 0: TW_BASE@0..2 "bg" [] [] 1: DASH@2..3 "-" [] [] 2: TW_NAMED_VALUE@3..10 @@ -58,7 +60,7 @@ TwRoot { 0: SLASH@10..11 "/" [] [] 1: TW_NUMBER_VALUE@11..13 0: TW_NUMBER@11..13 "10" [] [] - 3: (empty) + 4: (empty) 2: EOF@13..14 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/multiple-spaces.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/multiple-spaces.txt.snap index 0a866cb177d7..f524794c78f5 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/multiple-spaces.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/multiple-spaces.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@0..20 "border" [] [Whitespace(" ")], @@ -39,6 +40,7 @@ TwRoot { }, COLON@25..26 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@26..33 "outline" [] [], @@ -64,10 +66,11 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..20 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_STATIC_CANDIDATE@0..20 + 2: (empty) + 3: TW_STATIC_CANDIDATE@0..20 0: TW_BASE@0..20 "border" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@20..38 0: TW_VARIANT_LIST@20..26 0: TW_VARIANT_EXPRESSION@20..25 @@ -78,13 +81,14 @@ TwRoot { 2: (empty) 1: COLON@25..26 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@26..38 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@26..38 0: TW_BASE@26..33 "outline" [] [] 1: DASH@33..34 "-" [] [] 2: TW_NAMED_VALUE@34..38 0: TW_VALUE@34..38 "none" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@38..39 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/multiple.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/multiple.txt.snap index 31a237b1ddf0..a0cf8f436400 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/multiple.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/multiple.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@0..7 "border" [] [Whitespace(" ")], @@ -39,6 +40,7 @@ TwRoot { }, COLON@12..13 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@13..20 "outline" [] [], @@ -64,10 +66,11 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..7 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_STATIC_CANDIDATE@0..7 + 2: (empty) + 3: TW_STATIC_CANDIDATE@0..7 0: TW_BASE@0..7 "border" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@7..25 0: TW_VARIANT_LIST@7..13 0: TW_VARIANT_EXPRESSION@7..12 @@ -78,13 +81,14 @@ TwRoot { 2: (empty) 1: COLON@12..13 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@13..25 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@13..25 0: TW_BASE@13..20 "outline" [] [] 1: DASH@20..21 "-" [] [] 2: TW_NAMED_VALUE@21..25 0: TW_VALUE@21..25 "none" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@25..26 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/negative.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/negative.txt.snap index d6dec2cb46ec..155e5a74158b 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/negative.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/negative.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: DASH@0..1 "-" [] [], candidate: TwFunctionalCandidate { base_token: TW_BASE@1..4 "top" [] [], @@ -32,6 +33,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: DASH@7..8 "-" [] [], candidate: TwFunctionalCandidate { base_token: TW_BASE@8..10 "mb" [] [], @@ -56,6 +58,7 @@ TwRoot { }, COLON@18..19 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: DASH@19..20 "-" [] [], candidate: TwFunctionalCandidate { base_token: TW_BASE@20..22 "mt" [] [], @@ -80,24 +83,26 @@ TwRoot { 1: TW_CANDIDATE_LIST@0..24 0: TW_FULL_CANDIDATE@0..7 0: TW_VARIANT_LIST@0..0 - 1: DASH@0..1 "-" [] [] - 2: TW_FUNCTIONAL_CANDIDATE@1..7 + 1: (empty) + 2: DASH@0..1 "-" [] [] + 3: TW_FUNCTIONAL_CANDIDATE@1..7 0: TW_BASE@1..4 "top" [] [] 1: DASH@4..5 "-" [] [] 2: TW_NUMBER_VALUE@5..7 0: TW_NUMBER@5..7 "4" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@7..13 0: TW_VARIANT_LIST@7..7 - 1: DASH@7..8 "-" [] [] - 2: TW_FUNCTIONAL_CANDIDATE@8..13 + 1: (empty) + 2: DASH@7..8 "-" [] [] + 3: TW_FUNCTIONAL_CANDIDATE@8..13 0: TW_BASE@8..10 "mb" [] [] 1: DASH@10..11 "-" [] [] 2: TW_NUMBER_VALUE@11..13 0: TW_NUMBER@11..13 "2" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@13..24 0: TW_VARIANT_LIST@13..19 0: TW_VARIANT_EXPRESSION@13..18 @@ -107,14 +112,15 @@ TwRoot { 1: (empty) 2: (empty) 1: COLON@18..19 ":" [] [] - 1: DASH@19..20 "-" [] [] - 2: TW_FUNCTIONAL_CANDIDATE@20..24 + 1: (empty) + 2: DASH@19..20 "-" [] [] + 3: TW_FUNCTIONAL_CANDIDATE@20..24 0: TW_BASE@20..22 "mt" [] [] 1: DASH@22..23 "-" [] [] 2: TW_NUMBER_VALUE@23..24 0: TW_NUMBER@23..24 "2" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@24..25 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/number-value.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/number-value.txt.snap index 44d4d5a78901..77934fb8b89b 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/number-value.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/number-value.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..1 "w" [] [], @@ -44,13 +45,14 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..3 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..3 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..3 0: TW_BASE@0..1 "w" [] [] 1: DASH@1..2 "-" [] [] 2: TW_NUMBER_VALUE@2..3 0: TW_NUMBER@2..3 "3" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@3..4 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/percentage-value.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/percentage-value.txt.snap index 2f9107b82336..3bc768855c89 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/percentage-value.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/percentage-value.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..8 "progress" [] [], @@ -45,14 +46,15 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..12 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..12 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..12 0: TW_BASE@0..8 "progress" [] [] 1: DASH@8..9 "-" [] [] 2: TW_PERCENTAGE_VALUE@9..12 0: TW_NUMBER@9..11 "50" [] [] 1: PERCENT@11..12 "%" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@12..13 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/ratio-value.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/ratio-value.txt.snap index bdba749709a5..a2d69ddd6f9e 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/ratio-value.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/ratio-value.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..1 "w" [] [], @@ -49,7 +50,8 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..5 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..5 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..5 0: TW_BASE@0..1 "w" [] [] 1: DASH@1..2 "-" [] [] 2: TW_NUMBER_VALUE@2..3 @@ -58,7 +60,7 @@ TwRoot { 0: SLASH@3..4 "/" [] [] 1: TW_NUMBER_VALUE@4..5 0: TW_NUMBER@4..5 "4" [] [] - 3: (empty) + 4: (empty) 2: EOF@5..6 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/static.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/static.txt.snap index 12909affcb83..00fbf81c0e0b 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/static.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/static.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@0..9 "underline" [] [], @@ -40,10 +41,11 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..9 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_STATIC_CANDIDATE@0..9 + 2: (empty) + 3: TW_STATIC_CANDIDATE@0..9 0: TW_BASE@0..9 "underline" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@9..10 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-1.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-1.txt.snap index e5b92c3c2cd4..2d1fd4c78243 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-1.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-1.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..4 "text" [] [], @@ -32,6 +33,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@8..15 "leading" [] [], @@ -63,6 +65,7 @@ TwRoot { }, COLON@28..29 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@29..33 "text" [] [], @@ -125,6 +128,7 @@ TwRoot { }, COLON@71..72 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@72..76 "text" [] [], @@ -138,6 +142,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@85..90 "flex" [] [Whitespace(" ")], @@ -147,6 +152,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@90..95 "items" [] [], @@ -160,6 +166,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@103..106 "gap" [] [], @@ -190,6 +197,7 @@ TwRoot { }, COLON@124..125 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@125..132 "opacity" [] [], @@ -220,6 +228,7 @@ TwRoot { }, COLON@154..155 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@155..161 "cursor" [] [], @@ -245,17 +254,19 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..8 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..8 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..8 0: TW_BASE@0..4 "text" [] [] 1: DASH@4..5 "-" [] [] 2: TW_NAMED_VALUE@5..8 0: TW_VALUE@5..8 "sm" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@8..23 0: TW_VARIANT_LIST@8..8 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@8..23 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@8..23 0: TW_BASE@8..15 "leading" [] [] 1: DASH@15..16 "-" [] [] 2: TW_ARBITRARY_VALUE@16..23 @@ -266,7 +277,7 @@ TwRoot { 1: IDENT@19..21 "px" [] [] 2: R_BRACKET@21..23 "]" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@23..45 0: TW_VARIANT_LIST@23..29 0: TW_VARIANT_EXPRESSION@23..28 @@ -277,7 +288,8 @@ TwRoot { 2: (empty) 1: COLON@28..29 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@29..45 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@29..45 0: TW_BASE@29..33 "text" [] [] 1: DASH@33..34 "-" [] [] 2: TW_NAMED_VALUE@34..36 @@ -291,7 +303,7 @@ TwRoot { 0: CSS_NUMBER_LITERAL@38..41 "100" [] [] 1: IDENT@41..43 "px" [] [] 2: R_BRACKET@43..45 "]" [] [Whitespace(" ")] - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@45..85 0: TW_VARIANT_LIST@45..72 0: TW_VARIANT_EXPRESSION@45..50 @@ -321,40 +333,44 @@ TwRoot { 2: (empty) 5: COLON@71..72 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@72..85 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@72..85 0: TW_BASE@72..76 "text" [] [] 1: DASH@76..77 "-" [] [] 2: TW_NAMED_VALUE@77..85 0: TW_VALUE@77..85 "red-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@85..90 0: TW_VARIANT_LIST@85..85 1: (empty) - 2: TW_STATIC_CANDIDATE@85..90 + 2: (empty) + 3: TW_STATIC_CANDIDATE@85..90 0: TW_BASE@85..90 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@90..103 0: TW_VARIANT_LIST@90..90 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@90..103 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@90..103 0: TW_BASE@90..95 "items" [] [] 1: DASH@95..96 "-" [] [] 2: TW_NAMED_VALUE@96..103 0: TW_VALUE@96..103 "center" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@103..109 0: TW_VARIANT_LIST@103..103 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@103..109 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@103..109 0: TW_BASE@103..106 "gap" [] [] 1: DASH@106..107 "-" [] [] 2: TW_NUMBER_VALUE@107..109 0: TW_NUMBER@107..109 "2" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 7: TW_FULL_CANDIDATE@109..136 0: TW_VARIANT_LIST@109..125 0: TW_VARIANT_EXPRESSION@109..124 @@ -370,13 +386,14 @@ TwRoot { 2: (empty) 1: COLON@124..125 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@125..136 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@125..136 0: TW_BASE@125..132 "opacity" [] [] 1: DASH@132..133 "-" [] [] 2: TW_NUMBER_VALUE@133..136 0: TW_NUMBER@133..136 "50" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 8: TW_FULL_CANDIDATE@136..173 0: TW_VARIANT_LIST@136..155 0: TW_ARBITRARY_VARIANT@136..145 @@ -392,13 +409,14 @@ TwRoot { 2: (empty) 3: COLON@154..155 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@155..173 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@155..173 0: TW_BASE@155..161 "cursor" [] [] 1: DASH@161..162 "-" [] [] 2: TW_NAMED_VALUE@162..173 0: TW_VALUE@162..173 "not-allowed" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@173..174 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-2.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-2.txt.snap index 50a6afb52466..be4a0cefdd9e 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-2.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-2.txt.snap @@ -19,6 +19,7 @@ TwRoot { candidates: TwCandidateList [ TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@0..6 "border" [] [], @@ -32,6 +33,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@18..22 "text" [] [], @@ -45,6 +47,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@34..45 "ring-offset" [] [], @@ -73,6 +76,7 @@ TwRoot { }, COLON@70..71 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@71..75 "ring" [] [], @@ -86,6 +90,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@81..87 "aspect" [] [], @@ -99,6 +104,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@95..99 "size" [] [], @@ -112,6 +118,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@102..109 "rounded" [] [], @@ -125,6 +132,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@115..122 "border" [] [Whitespace(" ")], @@ -145,6 +153,7 @@ TwRoot { }, COLON@127..128 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@128..135 "outline" [] [], @@ -173,6 +182,7 @@ TwRoot { }, COLON@154..155 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@155..159 "ring" [] [], @@ -201,6 +211,7 @@ TwRoot { }, COLON@175..176 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@176..187 "ring-offset" [] [], @@ -225,6 +236,7 @@ TwRoot { }, COLON@198..199 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@199..205 "cursor" [] [], @@ -249,6 +261,7 @@ TwRoot { }, COLON@226..227 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@227..234 "opacity" [] [], @@ -274,33 +287,36 @@ TwRoot { 0: TW_FULL_CANDIDATE@0..18 0: TW_VARIANT_LIST@0..0 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@0..18 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@0..18 0: TW_BASE@0..6 "border" [] [] 1: DASH@6..7 "-" [] [] 2: TW_NAMED_VALUE@7..18 0: TW_VALUE@7..18 "foreground" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@18..34 0: TW_VARIANT_LIST@18..18 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@18..34 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@18..34 0: TW_BASE@18..22 "text" [] [] 1: DASH@22..23 "-" [] [] 2: TW_NAMED_VALUE@23..34 0: TW_VALUE@23..34 "foreground" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@34..57 0: TW_VARIANT_LIST@34..34 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@34..57 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@34..57 0: TW_BASE@34..45 "ring-offset" [] [] 1: DASH@45..46 "-" [] [] 2: TW_NAMED_VALUE@46..57 0: TW_VALUE@46..57 "background" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@57..81 0: TW_VARIANT_LIST@57..71 0: TW_VARIANT_EXPRESSION@57..70 @@ -314,50 +330,55 @@ TwRoot { 2: (empty) 1: COLON@70..71 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@71..81 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@71..81 0: TW_BASE@71..75 "ring" [] [] 1: DASH@75..76 "-" [] [] 2: TW_NAMED_VALUE@76..81 0: TW_VALUE@76..81 "ring" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@81..95 0: TW_VARIANT_LIST@81..81 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@81..95 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@81..95 0: TW_BASE@81..87 "aspect" [] [] 1: DASH@87..88 "-" [] [] 2: TW_NAMED_VALUE@88..95 0: TW_VALUE@88..95 "square" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@95..102 0: TW_VARIANT_LIST@95..95 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@95..102 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@95..102 0: TW_BASE@95..99 "size" [] [] 1: DASH@99..100 "-" [] [] 2: TW_NUMBER_VALUE@100..102 0: TW_NUMBER@100..102 "4" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@102..115 0: TW_VARIANT_LIST@102..102 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@102..115 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@102..115 0: TW_BASE@102..109 "rounded" [] [] 1: DASH@109..110 "-" [] [] 2: TW_NAMED_VALUE@110..115 0: TW_VALUE@110..115 "full" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 7: TW_FULL_CANDIDATE@115..122 0: TW_VARIANT_LIST@115..115 1: (empty) - 2: TW_STATIC_CANDIDATE@115..122 + 2: (empty) + 3: TW_STATIC_CANDIDATE@115..122 0: TW_BASE@115..122 "border" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 8: TW_FULL_CANDIDATE@122..141 0: TW_VARIANT_LIST@122..128 0: TW_VARIANT_EXPRESSION@122..127 @@ -368,13 +389,14 @@ TwRoot { 2: (empty) 1: COLON@127..128 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@128..141 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@128..141 0: TW_BASE@128..135 "outline" [] [] 1: DASH@135..136 "-" [] [] 2: TW_NAMED_VALUE@136..141 0: TW_VALUE@136..141 "none" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 9: TW_FULL_CANDIDATE@141..162 0: TW_VARIANT_LIST@141..155 0: TW_VARIANT_EXPRESSION@141..154 @@ -388,13 +410,14 @@ TwRoot { 2: (empty) 1: COLON@154..155 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@155..162 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@155..162 0: TW_BASE@155..159 "ring" [] [] 1: DASH@159..160 "-" [] [] 2: TW_NUMBER_VALUE@160..162 0: TW_NUMBER@160..162 "2" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 10: TW_FULL_CANDIDATE@162..190 0: TW_VARIANT_LIST@162..176 0: TW_VARIANT_EXPRESSION@162..175 @@ -408,13 +431,14 @@ TwRoot { 2: (empty) 1: COLON@175..176 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@176..190 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@176..190 0: TW_BASE@176..187 "ring-offset" [] [] 1: DASH@187..188 "-" [] [] 2: TW_NUMBER_VALUE@188..190 0: TW_NUMBER@188..190 "2" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 11: TW_FULL_CANDIDATE@190..218 0: TW_VARIANT_LIST@190..199 0: TW_VARIANT_EXPRESSION@190..198 @@ -425,13 +449,14 @@ TwRoot { 2: (empty) 1: COLON@198..199 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@199..218 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@199..218 0: TW_BASE@199..205 "cursor" [] [] 1: DASH@205..206 "-" [] [] 2: TW_NAMED_VALUE@206..218 0: TW_VALUE@206..218 "not-allowed" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 12: TW_FULL_CANDIDATE@218..237 0: TW_VARIANT_LIST@218..227 0: TW_VARIANT_EXPRESSION@218..226 @@ -442,13 +467,14 @@ TwRoot { 2: (empty) 1: COLON@226..227 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@227..237 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@227..237 0: TW_BASE@227..234 "opacity" [] [] 1: DASH@234..235 "-" [] [] 2: TW_NUMBER_VALUE@235..237 0: TW_NUMBER@235..237 "50" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@237..238 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/arbitrary-selector-functional-candidate.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/arbitrary-selector-functional-candidate.txt.snap index 44cca5b77995..990af9a98bd4 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/arbitrary-selector-functional-candidate.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/arbitrary-selector-functional-candidate.txt.snap @@ -36,6 +36,7 @@ TwRoot { }, COLON@11..12 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@12..21 "underline" [] [], @@ -69,10 +70,11 @@ TwRoot { 2: R_BRACKET@10..11 "]" [] [] 3: COLON@11..12 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@12..21 + 2: (empty) + 3: TW_STATIC_CANDIDATE@12..21 0: TW_BASE@12..21 "underline" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@21..22 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/arbitrary-variant.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/arbitrary-variant.txt.snap index 3092616a4c07..c3f470e70175 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/arbitrary-variant.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/arbitrary-variant.txt.snap @@ -26,6 +26,7 @@ TwRoot { }, COLON@5..6 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@6..10 "text" [] [], @@ -56,13 +57,14 @@ TwRoot { 2: R_BRACKET@4..5 "]" [] [] 1: COLON@5..6 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@6..18 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@6..18 0: TW_BASE@6..10 "text" [] [] 1: DASH@10..11 "-" [] [] 2: TW_NAMED_VALUE@11..18 0: TW_VALUE@11..18 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@18..19 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/child-descendant.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/child-descendant.txt.snap index 2476dbc264dc..ed31dfd576df 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/child-descendant.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/child-descendant.txt.snap @@ -29,6 +29,7 @@ TwRoot { }, COLON@1..2 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@2..7 "flex" [] [Whitespace(" ")], @@ -49,6 +50,7 @@ TwRoot { }, COLON@9..10 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@10..14 "flex" [] [], @@ -77,10 +79,11 @@ TwRoot { 2: (empty) 1: COLON@1..2 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@2..7 + 2: (empty) + 3: TW_STATIC_CANDIDATE@2..7 0: TW_BASE@2..7 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@7..14 0: TW_VARIANT_LIST@7..10 0: TW_VARIANT_EXPRESSION@7..9 @@ -91,10 +94,11 @@ TwRoot { 2: (empty) 1: COLON@9..10 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@10..14 + 2: (empty) + 3: TW_STATIC_CANDIDATE@10..14 0: TW_BASE@10..14 "flex" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@14..14 "" [] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/combinator-selectors.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/combinator-selectors.txt.snap index e4369c78a2fc..ae6e15410714 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/combinator-selectors.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/combinator-selectors.txt.snap @@ -35,6 +35,7 @@ TwRoot { }, COLON@10..11 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@11..16 "flex" [] [Whitespace(" ")], @@ -61,6 +62,7 @@ TwRoot { }, COLON@24..25 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@25..30 "flex" [] [Whitespace(" ")], @@ -87,6 +89,7 @@ TwRoot { }, COLON@41..42 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@42..47 "flex" [] [Whitespace(" ")], @@ -117,6 +120,7 @@ TwRoot { }, COLON@63..64 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@64..68 "flex" [] [], @@ -150,10 +154,11 @@ TwRoot { 2: (empty) 1: COLON@10..11 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@11..16 + 2: (empty) + 3: TW_STATIC_CANDIDATE@11..16 0: TW_BASE@11..16 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@16..30 0: TW_VARIANT_LIST@16..25 0: TW_VARIANT_EXPRESSION@16..24 @@ -169,10 +174,11 @@ TwRoot { 2: (empty) 1: COLON@24..25 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@25..30 + 2: (empty) + 3: TW_STATIC_CANDIDATE@25..30 0: TW_BASE@25..30 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@30..47 0: TW_VARIANT_LIST@30..42 0: TW_VARIANT_EXPRESSION@30..41 @@ -188,10 +194,11 @@ TwRoot { 2: (empty) 1: COLON@41..42 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@42..47 + 2: (empty) + 3: TW_STATIC_CANDIDATE@42..47 0: TW_BASE@42..47 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@47..68 0: TW_VARIANT_LIST@47..64 0: TW_VARIANT_EXPRESSION@47..63 @@ -210,10 +217,11 @@ TwRoot { 2: (empty) 1: COLON@63..64 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@64..68 + 2: (empty) + 3: TW_STATIC_CANDIDATE@64..68 0: TW_BASE@64..68 "flex" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@68..68 "" [] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/consecutive-arbitrary-variants.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/consecutive-arbitrary-variants.txt.snap index 51b637255ccd..c56a295665e7 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/consecutive-arbitrary-variants.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/consecutive-arbitrary-variants.txt.snap @@ -26,6 +26,7 @@ TwRoot { }, COLON@25..26 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@26..31 "grid" [] [Whitespace(" ")], @@ -42,6 +43,7 @@ TwRoot { }, COLON@52..53 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@53..55 "mt" [] [], @@ -62,6 +64,7 @@ TwRoot { }, COLON@74..75 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@75..77 "bg" [] [], @@ -92,6 +95,7 @@ TwRoot { }, COLON@98..99 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@99..108 "underline" [] [], @@ -118,10 +122,11 @@ TwRoot { 2: R_BRACKET@24..25 "]" [] [] 1: COLON@25..26 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@26..31 + 2: (empty) + 3: TW_STATIC_CANDIDATE@26..31 0: TW_BASE@26..31 "grid" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@31..58 0: TW_VARIANT_LIST@31..53 0: TW_ARBITRARY_VARIANT@31..52 @@ -130,13 +135,14 @@ TwRoot { 2: R_BRACKET@51..52 "]" [] [] 1: COLON@52..53 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@53..58 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@53..58 0: TW_BASE@53..55 "mt" [] [] 1: DASH@55..56 "-" [] [] 2: TW_NUMBER_VALUE@56..58 0: TW_NUMBER@56..58 "4" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@58..87 0: TW_VARIANT_LIST@58..75 0: TW_ARBITRARY_VARIANT@58..74 @@ -145,13 +151,14 @@ TwRoot { 2: R_BRACKET@73..74 "]" [] [] 1: COLON@74..75 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@75..87 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@75..87 0: TW_BASE@75..77 "bg" [] [] 1: DASH@77..78 "-" [] [] 2: TW_NAMED_VALUE@78..87 0: TW_VALUE@78..87 "blue-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@87..108 0: TW_VARIANT_LIST@87..99 0: TW_VARIANT_EXPRESSION@87..92 @@ -167,10 +174,11 @@ TwRoot { 2: R_BRACKET@97..98 "]" [] [] 3: COLON@98..99 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@99..108 + 2: (empty) + 3: TW_STATIC_CANDIDATE@99..108 0: TW_BASE@99..108 "underline" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@108..109 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/container-query.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/container-query.txt.snap index d7f7cf1f745d..593e9d4eb5ad 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/container-query.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/container-query.txt.snap @@ -29,6 +29,7 @@ TwRoot { }, COLON@3..4 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@4..9 "flex" [] [Whitespace(" ")], @@ -49,6 +50,7 @@ TwRoot { }, COLON@12..13 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@13..18 "flex" [] [Whitespace(" ")], @@ -69,6 +71,7 @@ TwRoot { }, COLON@21..22 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@22..27 "flex" [] [Whitespace(" ")], @@ -93,6 +96,7 @@ TwRoot { }, COLON@34..35 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@35..40 "flex" [] [Whitespace(" ")], @@ -119,6 +123,7 @@ TwRoot { }, COLON@52..53 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@53..58 "flex" [] [Whitespace(" ")], @@ -139,6 +144,7 @@ TwRoot { }, COLON@68..69 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@69..73 "flex" [] [], @@ -167,10 +173,11 @@ TwRoot { 2: (empty) 1: COLON@3..4 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@4..9 + 2: (empty) + 3: TW_STATIC_CANDIDATE@4..9 0: TW_BASE@4..9 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@9..18 0: TW_VARIANT_LIST@9..13 0: TW_VARIANT_EXPRESSION@9..12 @@ -181,10 +188,11 @@ TwRoot { 2: (empty) 1: COLON@12..13 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@13..18 + 2: (empty) + 3: TW_STATIC_CANDIDATE@13..18 0: TW_BASE@13..18 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@18..27 0: TW_VARIANT_LIST@18..22 0: TW_VARIANT_EXPRESSION@18..21 @@ -195,10 +203,11 @@ TwRoot { 2: (empty) 1: COLON@21..22 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@22..27 + 2: (empty) + 3: TW_STATIC_CANDIDATE@22..27 0: TW_BASE@22..27 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@27..40 0: TW_VARIANT_LIST@27..35 0: TW_VARIANT_EXPRESSION@27..34 @@ -212,10 +221,11 @@ TwRoot { 2: (empty) 1: COLON@34..35 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@35..40 + 2: (empty) + 3: TW_STATIC_CANDIDATE@35..40 0: TW_BASE@35..40 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@40..58 0: TW_VARIANT_LIST@40..53 0: TW_VARIANT_EXPRESSION@40..52 @@ -231,10 +241,11 @@ TwRoot { 2: (empty) 1: COLON@52..53 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@53..58 + 2: (empty) + 3: TW_STATIC_CANDIDATE@53..58 0: TW_BASE@53..58 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@58..73 0: TW_VARIANT_LIST@58..69 0: TW_VARIANT_EXPRESSION@58..68 @@ -245,10 +256,11 @@ TwRoot { 2: (empty) 1: COLON@68..69 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@69..73 + 2: (empty) + 3: TW_STATIC_CANDIDATE@69..73 0: TW_BASE@69..73 "flex" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@73..73 "" [] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/functional-arbirary-param.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/functional-arbirary-param.txt.snap index 74a608cd19a1..4940c3427c7f 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/functional-arbirary-param.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/functional-arbirary-param.txt.snap @@ -36,6 +36,7 @@ TwRoot { }, COLON@15..16 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@16..20 "text" [] [], @@ -73,13 +74,14 @@ TwRoot { 2: (empty) 1: COLON@15..16 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@16..28 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@16..28 0: TW_BASE@16..20 "text" [] [] 1: DASH@20..21 "-" [] [] 2: TW_NAMED_VALUE@21..28 0: TW_VALUE@21..28 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@28..29 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/functional-named-param.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/functional-named-param.txt.snap index 5e1c7609eecc..37251f0b0197 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/functional-named-param.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/functional-named-param.txt.snap @@ -34,6 +34,7 @@ TwRoot { }, COLON@13..14 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@14..18 "text" [] [], @@ -69,13 +70,14 @@ TwRoot { 2: (empty) 1: COLON@13..14 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@14..26 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@14..26 0: TW_BASE@14..18 "text" [] [] 1: DASH@18..19 "-" [] [] 2: TW_NAMED_VALUE@19..26 0: TW_VALUE@19..26 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@26..27 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/hover.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/hover.txt.snap index c3a65afb01ef..61b060b95ef4 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/hover.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/hover.txt.snap @@ -30,6 +30,7 @@ TwRoot { }, COLON@5..6 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@6..10 "text" [] [], @@ -62,13 +63,14 @@ TwRoot { 2: (empty) 1: COLON@5..6 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@6..18 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@6..18 0: TW_BASE@6..10 "text" [] [] 1: DASH@10..11 "-" [] [] 2: TW_NAMED_VALUE@11..18 0: TW_VALUE@11..18 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@18..19 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/hover_focus.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/hover_focus.txt.snap index 6bf42c6636d5..dd51a376c25f 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/hover_focus.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/hover_focus.txt.snap @@ -40,6 +40,7 @@ TwRoot { }, COLON@11..12 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@12..16 "text" [] [], @@ -79,13 +80,14 @@ TwRoot { 2: (empty) 3: COLON@11..12 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@12..24 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@12..24 0: TW_BASE@12..16 "text" [] [] 1: DASH@16..17 "-" [] [] 2: TW_NAMED_VALUE@17..24 0: TW_VALUE@17..24 "red-500" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@24..25 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/starts-with-number.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/starts-with-number.txt.snap index 131e70c15bac..a4494cef88c4 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/starts-with-number.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/starts-with-number.txt.snap @@ -30,6 +30,7 @@ TwRoot { }, COLON@3..4 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@4..9 "table" [] [], @@ -58,10 +59,11 @@ TwRoot { 2: (empty) 1: COLON@3..4 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@4..9 + 2: (empty) + 3: TW_STATIC_CANDIDATE@4..9 0: TW_BASE@4..9 "table" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@9..10 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-expression-data.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-expression-data.txt.snap index 506fb193987e..feb82c216b75 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-expression-data.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-expression-data.txt.snap @@ -34,6 +34,7 @@ TwRoot { }, COLON@11..12 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@12..17 "flex" [] [Whitespace(" ")], @@ -60,6 +61,7 @@ TwRoot { }, COLON@34..35 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@35..41 "block" [] [Whitespace(" ")], @@ -90,6 +92,7 @@ TwRoot { }, COLON@64..65 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@65..71 "block" [] [Whitespace(" ")], @@ -120,6 +123,7 @@ TwRoot { }, COLON@84..85 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@85..91 "block" [] [Whitespace(" ")], @@ -146,6 +150,7 @@ TwRoot { }, COLON@105..106 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@106..110 "text" [] [], @@ -174,6 +179,7 @@ TwRoot { }, COLON@125..126 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@126..131 "flex" [] [Whitespace(" ")], @@ -198,6 +204,7 @@ TwRoot { }, COLON@137..138 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@138..142 "grid" [] [], @@ -229,10 +236,11 @@ TwRoot { 2: (empty) 1: COLON@11..12 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@12..17 + 2: (empty) + 3: TW_STATIC_CANDIDATE@12..17 0: TW_BASE@12..17 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@17..41 0: TW_VARIANT_LIST@17..35 0: TW_VARIANT_EXPRESSION@17..34 @@ -248,10 +256,11 @@ TwRoot { 2: (empty) 1: COLON@34..35 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@35..41 + 2: (empty) + 3: TW_STATIC_CANDIDATE@35..41 0: TW_BASE@35..41 "block" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@41..71 0: TW_VARIANT_LIST@41..65 0: TW_VARIANT_EXPRESSION@41..64 @@ -270,10 +279,11 @@ TwRoot { 2: (empty) 1: COLON@64..65 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@65..71 + 2: (empty) + 3: TW_STATIC_CANDIDATE@65..71 0: TW_BASE@65..71 "block" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@71..91 0: TW_VARIANT_LIST@71..85 0: TW_VARIANT_EXPRESSION@71..84 @@ -292,10 +302,11 @@ TwRoot { 2: (empty) 1: COLON@84..85 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@85..91 + 2: (empty) + 3: TW_STATIC_CANDIDATE@85..91 0: TW_BASE@85..91 "block" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@91..119 0: TW_VARIANT_LIST@91..106 0: TW_VARIANT_EXPRESSION@91..105 @@ -311,13 +322,14 @@ TwRoot { 2: (empty) 1: COLON@105..106 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@106..119 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@106..119 0: TW_BASE@106..110 "text" [] [] 1: DASH@110..111 "-" [] [] 2: TW_NAMED_VALUE@111..119 0: TW_VALUE@111..119 "red-500" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@119..131 0: TW_VARIANT_LIST@119..126 0: TW_VARIANT_EXPRESSION@119..125 @@ -331,10 +343,11 @@ TwRoot { 2: (empty) 1: COLON@125..126 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@126..131 + 2: (empty) + 3: TW_STATIC_CANDIDATE@126..131 0: TW_BASE@126..131 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@131..142 0: TW_VARIANT_LIST@131..138 0: TW_VARIANT_EXPRESSION@131..137 @@ -348,10 +361,11 @@ TwRoot { 2: (empty) 1: COLON@137..138 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@138..142 + 2: (empty) + 3: TW_STATIC_CANDIDATE@138..142 0: TW_BASE@138..142 "grid" [] [] 1: (empty) - 3: (empty) + 4: (empty) 2: EOF@142..143 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-expression.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-expression.txt.snap index 8663fdb61705..1be1971e29ae 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-expression.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-expression.txt.snap @@ -30,6 +30,7 @@ TwRoot { }, COLON@5..6 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@6..11 "flex" [] [Whitespace(" ")], @@ -54,6 +55,7 @@ TwRoot { }, COLON@22..23 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@23..28 "flex" [] [Whitespace(" ")], @@ -82,6 +84,7 @@ TwRoot { }, COLON@44..45 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@45..50 "flex" [] [Whitespace(" ")], @@ -120,6 +123,7 @@ TwRoot { }, COLON@72..73 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@73..78 "flex" [] [Whitespace(" ")], @@ -144,6 +148,7 @@ TwRoot { }, COLON@91..92 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@92..96 "ring" [] [], @@ -172,6 +177,7 @@ TwRoot { }, COLON@111..112 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@112..117 "flex" [] [Whitespace(" ")], @@ -198,6 +204,7 @@ TwRoot { }, COLON@132..133 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@133..140 "opacity" [] [], @@ -230,10 +237,11 @@ TwRoot { 2: (empty) 1: COLON@5..6 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@6..11 + 2: (empty) + 3: TW_STATIC_CANDIDATE@6..11 0: TW_BASE@6..11 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@11..28 0: TW_VARIANT_LIST@11..23 0: TW_VARIANT_EXPRESSION@11..22 @@ -247,10 +255,11 @@ TwRoot { 2: (empty) 1: COLON@22..23 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@23..28 + 2: (empty) + 3: TW_STATIC_CANDIDATE@23..28 0: TW_BASE@23..28 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@28..50 0: TW_VARIANT_LIST@28..45 0: TW_VARIANT_EXPRESSION@28..44 @@ -267,10 +276,11 @@ TwRoot { 2: (empty) 1: COLON@44..45 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@45..50 + 2: (empty) + 3: TW_STATIC_CANDIDATE@45..50 0: TW_BASE@45..50 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@50..78 0: TW_VARIANT_LIST@50..73 0: TW_VARIANT_EXPRESSION@50..61 @@ -294,10 +304,11 @@ TwRoot { 2: (empty) 3: COLON@72..73 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@73..78 + 2: (empty) + 3: TW_STATIC_CANDIDATE@73..78 0: TW_BASE@73..78 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@78..102 0: TW_VARIANT_LIST@78..92 0: TW_VARIANT_EXPRESSION@78..91 @@ -311,13 +322,14 @@ TwRoot { 2: (empty) 1: COLON@91..92 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@92..102 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@92..102 0: TW_BASE@92..96 "ring" [] [] 1: DASH@96..97 "-" [] [] 2: TW_NAMED_VALUE@97..102 0: TW_VALUE@97..102 "ring" [] [Whitespace(" ")] 3: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@102..117 0: TW_VARIANT_LIST@102..112 0: TW_VARIANT_EXPRESSION@102..111 @@ -331,10 +343,11 @@ TwRoot { 2: (empty) 1: COLON@111..112 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@112..117 + 2: (empty) + 3: TW_STATIC_CANDIDATE@112..117 0: TW_BASE@112..117 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@117..143 0: TW_VARIANT_LIST@117..133 0: TW_VARIANT_EXPRESSION@117..132 @@ -350,13 +363,14 @@ TwRoot { 2: (empty) 1: COLON@132..133 ":" [] [] 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@133..143 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@133..143 0: TW_BASE@133..140 "opacity" [] [] 1: DASH@140..141 "-" [] [] 2: TW_NUMBER_VALUE@141..143 0: TW_NUMBER@141..143 "50" [] [] 3: (empty) - 3: (empty) + 4: (empty) 2: EOF@143..144 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-modifier.txt.snap b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-modifier.txt.snap index 0b54232a69b9..acb76bf94e27 100644 --- a/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-modifier.txt.snap +++ b/crates/biome_tailwind_parser/tests/tailwind_specs/ok/variants/variant-modifier.txt.snap @@ -39,6 +39,7 @@ TwRoot { }, COLON@16..17 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@17..22 "flex" [] [Whitespace(" ")], @@ -68,6 +69,7 @@ TwRoot { }, COLON@38..39 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@39..44 "flex" [] [Whitespace(" ")], @@ -93,6 +95,7 @@ TwRoot { }, COLON@52..53 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@53..58 "flex" [] [Whitespace(" ")], @@ -117,6 +120,7 @@ TwRoot { }, COLON@66..67 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@67..72 "flex" [] [Whitespace(" ")], @@ -146,6 +150,7 @@ TwRoot { }, COLON@85..86 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@86..91 "flex" [] [Whitespace(" ")], @@ -181,6 +186,7 @@ TwRoot { }, COLON@107..108 ":" [] [], ], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwStaticCandidate { base_token: TW_BASE@108..113 "flex" [] [Whitespace(" ")], @@ -190,6 +196,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@113..115 "bg" [] [], @@ -208,6 +215,7 @@ TwRoot { }, TwFullCandidate { variants: TwVariantList [], + legacy_important_token: missing (optional), negative_token: missing (optional), candidate: TwFunctionalCandidate { base_token: TW_BASE@127..128 "w" [] [], @@ -251,10 +259,11 @@ TwRoot { 0: TW_VALUE@12..16 "menu" [] [] 1: COLON@16..17 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@17..22 + 2: (empty) + 3: TW_STATIC_CANDIDATE@17..22 0: TW_BASE@17..22 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 1: TW_FULL_CANDIDATE@22..44 0: TW_VARIANT_LIST@22..39 0: TW_VARIANT_EXPRESSION@22..38 @@ -271,10 +280,11 @@ TwRoot { 0: TW_VALUE@35..38 "foo" [] [] 1: COLON@38..39 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@39..44 + 2: (empty) + 3: TW_STATIC_CANDIDATE@39..44 0: TW_BASE@39..44 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 2: TW_FULL_CANDIDATE@44..58 0: TW_VARIANT_LIST@44..53 0: TW_VARIANT_EXPRESSION@44..52 @@ -288,10 +298,11 @@ TwRoot { 0: TW_VALUE@48..52 "main" [] [] 1: COLON@52..53 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@53..58 + 2: (empty) + 3: TW_STATIC_CANDIDATE@53..58 0: TW_BASE@53..58 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 3: TW_FULL_CANDIDATE@58..72 0: TW_VARIANT_LIST@58..67 0: TW_VARIANT_EXPRESSION@58..66 @@ -305,10 +316,11 @@ TwRoot { 2: (empty) 1: COLON@66..67 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@67..72 + 2: (empty) + 3: TW_STATIC_CANDIDATE@67..72 0: TW_BASE@67..72 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 4: TW_FULL_CANDIDATE@72..91 0: TW_VARIANT_LIST@72..86 0: TW_VARIANT_EXPRESSION@72..85 @@ -325,10 +337,11 @@ TwRoot { 0: TW_VALUE@81..85 "name" [] [] 1: COLON@85..86 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@86..91 + 2: (empty) + 3: TW_STATIC_CANDIDATE@86..91 0: TW_BASE@86..91 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 5: TW_FULL_CANDIDATE@91..113 0: TW_VARIANT_LIST@91..108 0: TW_VARIANT_EXPRESSION@91..107 @@ -349,14 +362,16 @@ TwRoot { 2: R_BRACKET@106..107 "]" [] [] 1: COLON@107..108 ":" [] [] 1: (empty) - 2: TW_STATIC_CANDIDATE@108..113 + 2: (empty) + 3: TW_STATIC_CANDIDATE@108..113 0: TW_BASE@108..113 "flex" [] [Whitespace(" ")] 1: (empty) - 3: (empty) + 4: (empty) 6: TW_FULL_CANDIDATE@113..127 0: TW_VARIANT_LIST@113..113 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@113..127 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@113..127 0: TW_BASE@113..115 "bg" [] [] 1: DASH@115..116 "-" [] [] 2: TW_NAMED_VALUE@116..123 @@ -365,11 +380,12 @@ TwRoot { 0: SLASH@123..124 "/" [] [] 1: TW_NUMBER_VALUE@124..127 0: TW_NUMBER@124..127 "50" [] [Whitespace(" ")] - 3: (empty) + 4: (empty) 7: TW_FULL_CANDIDATE@127..132 0: TW_VARIANT_LIST@127..127 1: (empty) - 2: TW_FUNCTIONAL_CANDIDATE@127..132 + 2: (empty) + 3: TW_FUNCTIONAL_CANDIDATE@127..132 0: TW_BASE@127..128 "w" [] [] 1: DASH@128..129 "-" [] [] 2: TW_NUMBER_VALUE@129..130 @@ -378,7 +394,7 @@ TwRoot { 0: SLASH@130..131 "/" [] [] 1: TW_NUMBER_VALUE@131..132 0: TW_NUMBER@131..132 "2" [] [] - 3: (empty) + 4: (empty) 2: EOF@132..133 "" [Newline("\n")] [] ``` diff --git a/crates/biome_tailwind_syntax/src/generated/nodes.rs b/crates/biome_tailwind_syntax/src/generated/nodes.rs index 151cd250f526..77a487080834 100644 --- a/crates/biome_tailwind_syntax/src/generated/nodes.rs +++ b/crates/biome_tailwind_syntax/src/generated/nodes.rs @@ -997,6 +997,7 @@ impl TwFullCandidate { pub fn as_fields(&self) -> TwFullCandidateFields { TwFullCandidateFields { variants: self.variants(), + legacy_important_token: self.legacy_important_token(), negative_token: self.negative_token(), candidate: self.candidate(), excl_token: self.excl_token(), @@ -1005,14 +1006,17 @@ impl TwFullCandidate { pub fn variants(&self) -> TwVariantList { support::list(&self.syntax, 0usize) } - pub fn negative_token(&self) -> Option { + pub fn legacy_important_token(&self) -> Option { support::token(&self.syntax, 1usize) } + pub fn negative_token(&self) -> Option { + support::token(&self.syntax, 2usize) + } pub fn candidate(&self) -> SyntaxResult { - support::required_node(&self.syntax, 2usize) + support::required_node(&self.syntax, 3usize) } pub fn excl_token(&self) -> Option { - support::token(&self.syntax, 3usize) + support::token(&self.syntax, 4usize) } } impl Serialize for TwFullCandidate { @@ -1026,6 +1030,7 @@ impl Serialize for TwFullCandidate { #[derive(Serialize)] pub struct TwFullCandidateFields { pub variants: TwVariantList, + pub legacy_important_token: Option, pub negative_token: Option, pub candidate: SyntaxResult, pub excl_token: Option, @@ -3034,6 +3039,10 @@ impl std::fmt::Debug for TwFullCandidate { DEPTH.set(current_depth + 1); f.debug_struct("TwFullCandidate") .field("variants", &self.variants()) + .field( + "legacy_important_token", + &support::DebugOptionalElement(self.legacy_important_token()), + ) .field( "negative_token", &support::DebugOptionalElement(self.negative_token()), diff --git a/crates/biome_tailwind_syntax/src/generated/nodes_mut.rs b/crates/biome_tailwind_syntax/src/generated/nodes_mut.rs index 4241c0528ba6..137cccc1948f 100644 --- a/crates/biome_tailwind_syntax/src/generated/nodes_mut.rs +++ b/crates/biome_tailwind_syntax/src/generated/nodes_mut.rs @@ -380,22 +380,28 @@ impl TwFullCandidate { .splice_slots(0usize..=0usize, once(Some(element.into_syntax().into()))), ) } - pub fn with_negative_token(self, element: Option) -> Self { + pub fn with_legacy_important_token(self, element: Option) -> Self { Self::unwrap_cast( self.syntax .splice_slots(1usize..=1usize, once(element.map(|element| element.into()))), ) } + pub fn with_negative_token(self, element: Option) -> Self { + Self::unwrap_cast( + self.syntax + .splice_slots(2usize..=2usize, once(element.map(|element| element.into()))), + ) + } pub fn with_candidate(self, element: AnyTwCandidate) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(2usize..=2usize, once(Some(element.into_syntax().into()))), + .splice_slots(3usize..=3usize, once(Some(element.into_syntax().into()))), ) } pub fn with_excl_token(self, element: Option) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(3usize..=3usize, once(element.map(|element| element.into()))), + .splice_slots(4usize..=4usize, once(element.map(|element| element.into()))), ) } } diff --git a/xtask/codegen/tailwind.ungram b/xtask/codegen/tailwind.ungram index 4d70644e5671..f3712f6a2b80 100644 --- a/xtask/codegen/tailwind.ungram +++ b/xtask/codegen/tailwind.ungram @@ -59,8 +59,12 @@ TwCandidateList = AnyTwFullCandidate* AnyTwFullCandidate = TwFullCandidate | TwBogusCandidate // A Candidate is essentially a CSS class from an end user perspective. It's what the end user puts inside the `class` attribute in their HTML, separated by spaces. +// The important flag is written as a trailing `!` (`flex!`); the leading +// form (`!flex`) is Tailwind's legacy spelling and is still accepted, but a +// candidate can't carry both. TwFullCandidate = variants: TwVariantList + legacy_important: '!'? negative: '-'? candidate: AnyTwCandidate '!'?