Skip to content

Commit 45421d8

Browse files
committed
Fix bug
1 parent a2b3583 commit 45421d8

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

packages/tailwindcss-language-service/src/util/rewriting/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test('replacing CSS variables with their fallbacks (when they have them)', () =>
2424
state,
2525
'rgb(var(var(--bar, var(--baz), var(--qux), var(--thing))))',
2626
),
27-
).toBe('rgb(var(var(--bar, var(--baz), var(--qux), var(--thing))))')
27+
).toBe('rgb(var( var(--baz), var(--qux), var(--thing)))')
2828

2929
expect(
3030
replaceCssVarsWithFallbacks(

packages/tailwindcss-language-service/src/util/rewriting/replacements.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,11 @@ export function replaceCssVars(str: string, replace: CssVarReplacer): string {
5656

5757
if (replacement !== null) {
5858
str = str.slice(0, i) + replacement + str.slice(j + 1)
59-
60-
// We don't want to skip past anything here because `replacement`
61-
// might contain more var(…) calls in which case `i` will already
62-
// be pointing at the right spot to start looking for them
63-
break
6459
}
6560

66-
// It can't be replaced so we can avoid unncessary work by skipping over
67-
// the entire var(…) call.
68-
i = j + 1
61+
// We don't want to skip past anything here because `replacement`
62+
// might contain more var(…) calls in which case `i` will already
63+
// be pointing at the right spot to start looking for them
6964
break
7065
}
7166
}

0 commit comments

Comments
 (0)