You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds support for `@custom-variant`, adds variant suggestions for
`@variant`, and tweaks when at-rules are suggested such that only ones
that are valid in the given context should be suggested (e.g. when at
the root or when nested in some rule).
This is the IntelliSense portion of
tailwindlabs/tailwindcss#15663
}\` styles into your CSS.\n\n[Tailwind CSS Documentation](${docsUrl(
1507
+
state.version,
1508
+
'functions-and-directives/#tailwind',
1509
+
)})`,
1510
+
},
1511
+
})
1512
+
}
1440
1513
1441
-
items.push({
1442
-
label: '@screen',
1443
-
documentation: {
1444
-
kind: 'markdown'astypeofMarkupKind.Markdown,
1445
-
value: `The \`@screen\` directive allows you to create media queries that reference your breakpoints by name instead of duplicating their values in your own CSS.\n\n[Tailwind CSS Documentation](${docsUrl(
1446
-
state.version,
1447
-
'functions-and-directives/#screen',
1448
-
)})`,
1449
-
},
1450
-
})
1514
+
if(!state.v4){
1515
+
items.push({
1516
+
label: '@screen',
1517
+
documentation: {
1518
+
kind: 'markdown'astypeofMarkupKind.Markdown,
1519
+
value: `The \`@screen\` directive allows you to create media queries that reference your breakpoints by name instead of duplicating their values in your own CSS.\n\n[Tailwind CSS Documentation](${docsUrl(
1520
+
state.version,
1521
+
'functions-and-directives/#screen',
1522
+
)})`,
1523
+
},
1524
+
})
1525
+
}
1451
1526
1452
-
items.push({
1453
-
label: '@apply',
1454
-
documentation: {
1455
-
kind: 'markdown'astypeofMarkupKind.Markdown,
1456
-
value: `Use \`@apply\` to inline any existing utility classes into your own custom CSS.\n\n[Tailwind CSS Documentation](${docsUrl(
1457
-
state.version,
1458
-
'functions-and-directives/#apply',
1459
-
)})`,
1460
-
},
1461
-
})
1527
+
if(isNested){
1528
+
items.push({
1529
+
label: '@apply',
1530
+
documentation: {
1531
+
kind: 'markdown'astypeofMarkupKind.Markdown,
1532
+
value: `Use \`@apply\` to inline any existing utility classes into your own custom CSS.\n\n[Tailwind CSS Documentation](${docsUrl(
1533
+
state.version,
1534
+
'functions-and-directives/#apply',
1535
+
)})`,
1536
+
},
1537
+
})
1538
+
}
1462
1539
1463
1540
if(semver.gte(state.version,'1.8.0')){
1464
1541
items.push({
@@ -1498,7 +1575,7 @@ function provideCssDirectiveCompletions(
1498
1575
})
1499
1576
}
1500
1577
1501
-
if(semver.gte(state.version,'3.2.0')){
1578
+
if(semver.gte(state.version,'3.2.0')&&!isNested){
1502
1579
items.push({
1503
1580
label: '@config',
1504
1581
documentation: {
@@ -1511,7 +1588,7 @@ function provideCssDirectiveCompletions(
1511
1588
})
1512
1589
}
1513
1590
1514
-
if(state.v4){
1591
+
if(state.v4&&!isNested){
1515
1592
items.push({
1516
1593
label: '@theme',
1517
1594
documentation: {
@@ -1535,12 +1612,12 @@ function provideCssDirectiveCompletions(
1535
1612
})
1536
1613
1537
1614
items.push({
1538
-
label: '@variant',
1615
+
label: '@custom-variant',
1539
1616
documentation: {
1540
1617
kind: 'markdown'astypeofMarkupKind.Markdown,
1541
-
value: `Use the \`@variant\` directive to define a custom variant or override an existing one.\n\n[Tailwind CSS Documentation](${docsUrl(
1618
+
value: `Use the \`@custom-variant\` directive to define a custom variant or override an existing one.\n\n[Tailwind CSS Documentation](${docsUrl(
1542
1619
state.version,
1543
-
'functions-and-directives/#variant',
1620
+
'functions-and-directives/#custom-variant',
1544
1621
)})`,
1545
1622
},
1546
1623
})
@@ -1566,9 +1643,22 @@ function provideCssDirectiveCompletions(
1566
1643
)})`,
1567
1644
},
1568
1645
})
1646
+
}
1647
+
1648
+
if(state.v4&&isNested){
1649
+
items.push({
1650
+
label: '@variant',
1651
+
documentation: {
1652
+
kind: 'markdown'astypeofMarkupKind.Markdown,
1653
+
value: `Use the \`@variant\` directive to use a variant in CSS.\n\n[Tailwind CSS Documentation](${docsUrl(
1654
+
state.version,
1655
+
'functions-and-directives/variant',
1656
+
)})`,
1657
+
},
1658
+
})
1569
1659
1570
-
// If we're inside an @variant directive, also add `@slot`
1571
-
if(isInsideAtRule('variant',document,position)){
1660
+
// If we're inside an @custom-variant directive, also add `@slot`
Copy file name to clipboardExpand all lines: packages/vscode-tailwindcss/CHANGELOG.md
+3
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,9 @@
5
5
- Don't break when importing missing CSS files ([#1106](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1106))
6
6
- Resolve CSS imports as relative first ([#1106](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1106))
7
7
- Add TypeScript config path support in v4 CSS files ([#1106](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1106))
8
+
- Add support for `@custom-variant` ([#1127](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1127))
9
+
- Add variant suggestions to `@variant` ([#1127](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1127))
10
+
- Don't suggest at-rules when nested that cannot be used in a nested context ([#1127](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1127))
0 commit comments