Skip to content

Commit 78b8ca4

Browse files
committed
Fix formatting
1 parent 74aad3d commit 78b8ca4

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/tailwindcss-language-server/src/util/v4/design-system.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,16 @@ export async function loadDesignSystem(
8585
} else if (str[i] === ';') {
8686
result += ';\n'
8787
} else if (str[i] === ':') {
88-
result += ': '
88+
let prev = str.charCodeAt(i - 1)
89+
if (
90+
(prev >= 65 && prev <= 90) ||
91+
(prev >= 97 && prev <= 122) ||
92+
(prev >= 48 && prev <= 57)
93+
) {
94+
result += ': '
95+
} else {
96+
result += ':'
97+
}
8998
} else {
9099
result += str[i]
91100
}
@@ -98,10 +107,9 @@ export async function loadDesignSystem(
98107
for (let i = 0; i < lines.length; ++i) {
99108
let line = lines[i]
100109
if (line.includes('}')) depth--
101-
let indent = ' '.repeat(Math.max(0, depth))
102-
line = indent + line
110+
let indent = ' '.repeat(Math.max(0, depth))
111+
lines[i] = indent + line
103112
if (line.includes('{')) depth++
104-
lines[i] = line
105113
}
106114

107115
let pretty = lines.join('\n').trim()

packages/tailwindcss-language-server/tests/completions/completions.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ withFixture('v4/basic', (c) => {
442442
detail: 'text-transform: uppercase',
443443
documentation: {
444444
kind: 'markdown',
445-
value: '```css\n.uppercase {\n text-transform: uppercase;\n}\n```',
445+
value: '```css\n.uppercase {\n text-transform: uppercase;\n}\n```',
446446
},
447447
})
448448
})

0 commit comments

Comments
 (0)