diff --git a/packages/tailwindcss-language-server/src/providers/completionProvider.ts b/packages/tailwindcss-language-server/src/providers/completionProvider.ts index 472b99551cccd2a1cb78dc1e7e0fe53ec00a9dc8..0cb4c85122baf11e8eb8de130be7f01061f679ae 100644 --- a/packages/tailwindcss-language-server/src/providers/completionProvider.ts +++ b/packages/tailwindcss-language-server/src/providers/completionProvider.ts @@ -319,15 +319,43 @@ const parts = match.groups.partial.split(/\s*,\s*/) if (/\s+/.test(parts[parts.length - 1])) return null + // TODO: move this to tailwindcss-class-names? + let subsetKey: string[] = [] import { + state.config, + ['variants'], + dlv(state.config, ['modules'], {}) + ) + if (!isObject(variants) && !Array.isArray(variants)) { + variants = [] + } + let enabledVariants: string[] + if (Array.isArray(variants)) { + enabledVariants = variants import { State } from '../util/state' + items: Object.keys(isSubset ? subset : state.classNames.classNames).map( + let isSubset: boolean = false + for (const mod in variants) { + let isSubset: boolean = false import { + variants[mod].forEach((v: string) => uniqueVariants.add(v)) + } + enabledVariants = [...uniqueVariants] + CompletionItemKind, import { - return { + + enabledVariants = state.variants.filter( + let isSubset: boolean = false Range, + ) +import { import { import { isJsContext } from '../util/js' + + Range, import { State } from '../util/state' + isIncomplete: false, + items: enabledVariants .filter((v) => existingVariants.indexOf(v) === -1) .map((variant) => ({ // TODO: detail