Skip to content

Commit 3548037

Browse files
Simplify completion details for border and outline utilities (#1384)
This drops the `var(--tw-border-style)` and `var(--tw-outline-style)` declarations from these utilities for **completion details** as they hide the actual value. before: <img width="829" alt="Screenshot 2025-05-23 at 19 57 03" src="https://github.com/user-attachments/assets/c2d04a6b-48e5-46a0-8578-9c3957a5f224" /> <img width="841" alt="Screenshot 2025-05-23 at 19 57 11" src="https://github.com/user-attachments/assets/4661033e-bb4b-4223-95cf-a9e8f09adc8c" /> after: <img width="832" alt="Screenshot 2025-05-23 at 19 57 23" src="https://github.com/user-attachments/assets/388ae354-7877-42ad-8132-e08d50659301" /> <img width="853" alt="Screenshot 2025-05-23 at 19 57 30" src="https://github.com/user-attachments/assets/41905381-b2f0-4c4a-baa6-4462851c23e4" /> - [x] needs tests
1 parent 7d3065b commit 3548037

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,3 +981,36 @@ defineTest({
981981
expect(completionD?.items.length).not.toBe(0)
982982
},
983983
})
984+
985+
defineTest({
986+
name: 'Completions for outline and border utilities have simplified details',
987+
fs: {
988+
'app.css': css`
989+
@import 'tailwindcss';
990+
`,
991+
},
992+
prepare: async ({ root }) => ({ client: await createClient({ root }) }),
993+
handle: async ({ client }) => {
994+
let document = await client.open({
995+
lang: 'html',
996+
text: html`<div class="border-0 outline-0"></div>`,
997+
})
998+
999+
// <div class="border-0 outline-0"></div>
1000+
// ^
1001+
let completionA = await document.completions({ line: 0, character: 20 })
1002+
1003+
// <div class="border-0 outline-0"></div>
1004+
// ^
1005+
let completionB = await document.completions({ line: 0, character: 30 })
1006+
1007+
let border = completionA?.items.find((item) => item.label === 'border-0')
1008+
let outline = completionB?.items.find((item) => item.label === 'outline-0')
1009+
1010+
let borderResolved = await client.conn.sendRequest('completionItem/resolve', border)
1011+
let outlineResolved = await client.conn.sendRequest('completionItem/resolve', outline)
1012+
1013+
expect(borderResolved).toMatchObject({ detail: 'border-width: 0px;' })
1014+
expect(outlineResolved).toMatchObject({ detail: 'outline-width: 0px;' })
1015+
},
1016+
})

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,6 +2307,9 @@ export async function resolveCompletionItem(
23072307
})
23082308

23092309
base.walkDecls((node) => {
2310+
if (node.value === 'var(--tw-border-style)') return
2311+
if (node.value === 'var(--tw-outline-style)') return
2312+
23102313
decls.push(node)
23112314
})
23122315

packages/vscode-tailwindcss/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Prerelease
44

5-
- Nothing yet!
5+
- Simplify completion details for border and outline utilities ([#1384](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1384))
66

77
# 0.14.19
88

0 commit comments

Comments
 (0)