master
Brad Cornes 2020-06-19 14:40:19 +01:00
parent 4c0cff6c14
commit 4686f1bf4b
2 changed files with 9 additions and 6 deletions

View File

@ -20,8 +20,8 @@ import isObject from '../../../util/isObject'
import { cssObjToAst } from '../../util/cssObjToAst' import { cssObjToAst } from '../../util/cssObjToAst'
import dset from 'dset' import dset from 'dset'
import selectorParser from 'postcss-selector-parser' import selectorParser from 'postcss-selector-parser'
import { logFull } from '../../util/logFull'
import { flatten } from '../../../util/array' import { flatten } from '../../../util/array'
import { getClassNameMeta } from '../../util/getClassNameMeta'
export async function provideInvalidApplyCodeActions( export async function provideInvalidApplyCodeActions(
state: State, state: State,
@ -180,9 +180,10 @@ function classNameToAst(
if (!baseClassName) { if (!baseClassName) {
return null return null
} }
const info = dlv(state.classNames.classNames, classNameParts) const meta = getClassNameMeta(state, classNameParts)
let context = info.__context || [] if (Array.isArray(meta)) return null
let pseudo = info.__pseudo || [] let context = meta.context
let pseudo = meta.pseudo
const globalContexts = state.classNames.context const globalContexts = state.classNames.context
let screens = dlv( let screens = dlv(
state.config, state.config,

View File

@ -4,9 +4,11 @@ const dlv = require('dlv')
export function getClassNameMeta( export function getClassNameMeta(
state: State, state: State,
className: string classNameOrParts: string | string[]
): ClassNameMeta | ClassNameMeta[] { ): ClassNameMeta | ClassNameMeta[] {
const parts = getClassNameParts(state, className) const parts = Array.isArray(classNameOrParts)
? classNameOrParts
: getClassNameParts(state, classNameOrParts)
if (!parts) return null if (!parts) return null
const info = dlv(state.classNames.classNames, parts) const info = dlv(state.classNames.classNames, parts)