Skip to content

Commit

Permalink
Fix intellisense for plugins with multiple @apply rules (#8213)
Browse files Browse the repository at this point in the history
* 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 <hungle.info@gmail.com>
  • Loading branch information
thecrypticace and psucodervn committed Apr 27, 2022
1 parent 3853551 commit 89bf2ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Require matching prefix when detecting negatives ([#8121](https://github.com/tailwindlabs/tailwindcss/pull/8121))
- Handle duplicate At Rules without children ([#8122](https://github.com/tailwindlabs/tailwindcss/pull/8122))
- Allow arbitrary values with commas in `@apply` ([#8125](https://github.com/tailwindlabs/tailwindcss/pull/8125))
- Fix intellisense for plugins with multiple `@apply` rules ([#8213](https://github.com/tailwindlabs/tailwindcss/pull/8213))

### Added

Expand Down
2 changes: 1 addition & 1 deletion src/lib/expandApplyAtRules.js
Expand Up @@ -309,7 +309,7 @@ function processApply(root, context, localCache) {

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

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

Expand Down

0 comments on commit 89bf2ed

Please sign in to comment.