Skip to content

Commit 89bf2ed

Browse files
Fix intellisense for plugins with multiple @apply rules (#8213)
* Fix intellisense for plugins with multiple `@apply` rules Intellisense uses `expandApplyAtRules` directly and doesn’t partition them. When a plugin registers components using something like `”@apply flex”: {}` more than once in the same component intellisense will break. This isn’t a problem for Tailwind CSS proper because we do rule partitioning. Given that Intellisense is using it directly though we shouldn’t outright break in the face of this situation even if the result isn’t 100% accurate (the source maps won’t be correct in this case). * Update changelog Co-authored-by: psucoder <[email protected]>
1 parent 3853551 commit 89bf2ed

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Require matching prefix when detecting negatives ([#8121](https://github.com/tailwindlabs/tailwindcss/pull/8121))
1515
- Handle duplicate At Rules without children ([#8122](https://github.com/tailwindlabs/tailwindcss/pull/8122))
1616
- Allow arbitrary values with commas in `@apply` ([#8125](https://github.com/tailwindlabs/tailwindcss/pull/8125))
17+
- Fix intellisense for plugins with multiple `@apply` rules ([#8213](https://github.com/tailwindlabs/tailwindcss/pull/8213))
1718

1819
### Added
1920

src/lib/expandApplyAtRules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ function processApply(root, context, localCache) {
309309

310310
// Collect all apply candidates and their rules
311311
for (let apply of applies) {
312-
let candidates = []
312+
let [candidates] = perParentApplies.get(apply.parent) || [[], apply.source]
313313

314314
perParentApplies.set(apply.parent, [candidates, apply.source])
315315

0 commit comments

Comments
 (0)