Skip to content

Commit 4686f1b

Browse files
committed
tidy up
1 parent 4c0cff6 commit 4686f1b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import isObject from '../../../util/isObject'
2020
import { cssObjToAst } from '../../util/cssObjToAst'
2121
import dset from 'dset'
2222
import selectorParser from 'postcss-selector-parser'
23-
import { logFull } from '../../util/logFull'
2423
import { flatten } from '../../../util/array'
24+
import { getClassNameMeta } from '../../util/getClassNameMeta'
2525

2626
export async function provideInvalidApplyCodeActions(
2727
state: State,
@@ -180,9 +180,10 @@ function classNameToAst(
180180
if (!baseClassName) {
181181
return null
182182
}
183-
const info = dlv(state.classNames.classNames, classNameParts)
184-
let context = info.__context || []
185-
let pseudo = info.__pseudo || []
183+
const meta = getClassNameMeta(state, classNameParts)
184+
if (Array.isArray(meta)) return null
185+
let context = meta.context
186+
let pseudo = meta.pseudo
186187
const globalContexts = state.classNames.context
187188
let screens = dlv(
188189
state.config,

src/lsp/util/getClassNameMeta.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ const dlv = require('dlv')
44

55
export function getClassNameMeta(
66
state: State,
7-
className: string
7+
classNameOrParts: string | string[]
88
): ClassNameMeta | ClassNameMeta[] {
9-
const parts = getClassNameParts(state, className)
9+
const parts = Array.isArray(classNameOrParts)
10+
? classNameOrParts
11+
: getClassNameParts(state, classNameOrParts)
1012
if (!parts) return null
1113
const info = dlv(state.classNames.classNames, parts)
1214

0 commit comments

Comments
 (0)