Skip to content

Commit a39eea2

Browse files
committed
Hide decls in details for some --tw-* properties
1 parent 7f89613 commit a39eea2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/tailwindcss-language-service/src/completionProvider.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,6 +2313,22 @@ export async function resolveCompletionItem(
23132313
decls.push(node)
23142314
})
23152315

2316+
// TODO: Hardcoding this list is really unfortunate. We should be able
2317+
// to handle this in Tailwind CSS itself.
2318+
function isOtherDecl(node: postcss.Declaration) {
2319+
if (node.prop === '--tw-leading') return false
2320+
if (node.prop === '--tw-duration') return false
2321+
if (node.prop === '--tw-ease') return false
2322+
if (node.prop === '--tw-font-weight') return false
2323+
2324+
return true
2325+
}
2326+
2327+
// We want to remove these decls from details *as long as they're not the only one*
2328+
if (decls.some(isOtherDecl)) {
2329+
decls = decls.filter(isOtherDecl)
2330+
}
2331+
23162332
item.detail = await jit.stringifyDecls(state, postcss.rule({ nodes: decls }))
23172333
} else {
23182334
item.detail = `${rules.length} rules`

0 commit comments

Comments
 (0)