Repository navigation
Underline the correct occurrence of an unsupported type in --value(…) - #20554
RobinMalfait merged 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe utility now calculates unsupported bare-value warning positions from the argument index and preceding serialized arguments. A regression test checks separate underlines for two unsupported Priority: ⬇️ Low Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to
|
|
--value(…)
24599b0 to
7cc5e73
Compare
7cc5e73 to
0c89215
Compare
RobinMalfait
left a comment
There was a problem hiding this comment.
Thanks for the PR! Computing the offset from the node position is simpler than the sentinel trick, and each warning now points at its own occurrence. Nice test too.
Sent by an AI assistant on behalf of @RobinMalfait.
Summary
When an unsupported bare value data type is repeated in
--value(…), every warning underlines the first occurrence:Before, both warnings pointed at the first
color:This happened because the offset was found by replacing every word matching the type with a sentinel in a cloned node and then calling
indexOfon the printed result, which always returns the first match.Now the offset is computed from the node's position instead: thame, plus the
(, plus the printed length of the arguments before it.Each warning points at its own occurrence:
Test plan
Added a test in
packages/tailwindcss/src/utilities.test.ts. It spies onconsole.warnand checks that the two warnings underline the first and the last color respectively.Evidences
https://stackblitz.com/edit/github-yq34h5eo?file=input.css
before fix:

after fix:
