Skip to content

Commit 35a989f

Browse files
committed
merge suggest calls
When existing suggestions exist, and you have a custom `@utility` with a matching root, then we would override the existing utilities which is wrong. This ensures that we merge all the groups such that all utilities are being suggested to the user.
1 parent a2b0319 commit 35a989f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/tailwindcss/src/utilities.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,12 @@ export class Utilities {
124124
}
125125

126126
suggest(name: string, groups: () => SuggestionGroup[]) {
127-
// TODO: We are calling this multiple times on purpose but ideally only ever
128-
// once per utility root.
129-
this.completions.set(name, groups)
127+
let existingGroups = this.completions.get(name)
128+
if (existingGroups) {
129+
this.completions.set(name, () => [...existingGroups?.(), ...groups?.()])
130+
} else {
131+
this.completions.set(name, groups)
132+
}
130133
}
131134

132135
keys(kind: 'static' | 'functional') {

0 commit comments

Comments
 (0)