1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts
index f7655a0caf7c528dbcc183ab7c17299d2afc5c92..77963b53531d34b9b4c72d01390143001c8b0339 100644
--- a/packages/tailwindcss-language-service/src/completionProvider.ts
+++ b/packages/tailwindcss-language-service/src/completionProvider.ts
@@ -900,8 +900,9 @@ item.detail = await getCssDetail(state, className)
if (!item.documentation) {
const settings = await getDocumentSettings(state)
const css = stringifyCss(item.data.join(':'), className, {
- tabSize: dlv(settings, 'tabSize'),
- showPixelValues: dlv(settings, 'experimental.showPixelValues'),
+ tabSize: dlv(settings, 'tabSize', 2),
+ showPixelEquivalents: dlv(settings, 'showPixelEquivalents', true),
+ rootFontSize: dlv(settings, 'rootFontSize', 16),
})
if (css) {
item.documentation = {
@@ -932,7 +933,10 @@ }
function stringifyDecls(
obj: any,
- { showPixelValues = false }: Partial<{ showPixelValues: boolean }> = {}
+ {
+ showPixelEquivalents = false,
+ rootFontSize = 16,
+ }: Partial<{ showPixelEquivalents: boolean; rootFontSize: number }> = {}
): string {
let props = Object.keys(obj)
let nonCustomProps = props.filter((prop) => !prop.startsWith('--'))
@@ -945,7 +949,9 @@ return props
.map((prop) =>
ensureArray(obj[prop])
.map((value) => {
- const px = showPixelValues ? remToPx(value) : undefined
+ const px = showPixelEquivalents
+ ? remToPx(value, rootFontSize)
+ : undefined
return `${prop}: ${value}${px ? ` /*${px}*/` : ''};`
})
.join(' ')
@@ -960,7 +966,8 @@ }
if (className.__rule === true) {
const settings = await getDocumentSettings(state)
return stringifyDecls(removeMeta(className), {
- showPixelValues: dlv(settings, 'experimental.showPixelValues', false),
+ showPixelEquivalents: dlv(settings, 'showPixelEquivalents', true),
+ rootFontSize: dlv(settings, 'rootFontSize', 16),
})
}
return null
|