File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
src/lsp/providers/codeActions Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import dset from 'dset'
22
22
import selectorParser from 'postcss-selector-parser'
23
23
import { flatten } from '../../../util/array'
24
24
import { getClassNameMeta } from '../../util/getClassNameMeta'
25
+ import { validateApply } from '../../util/validateApply'
25
26
26
27
export async function provideInvalidApplyCodeActions (
27
28
state : State ,
@@ -173,11 +174,12 @@ function classNameToAst(
173
174
selector : string ,
174
175
important : boolean = false
175
176
) {
176
- const baseClassName = dlv (
177
- state . classNames . classNames ,
178
- classNameParts [ classNameParts . length - 1 ]
179
- )
180
- if ( ! baseClassName ) {
177
+ const baseClassName = classNameParts [ classNameParts . length - 1 ]
178
+ const validatedBaseClassName = validateApply ( state , [ baseClassName ] )
179
+ if (
180
+ validatedBaseClassName === null ||
181
+ validatedBaseClassName . isApplyable === false
182
+ ) {
181
183
return null
182
184
}
183
185
const meta = getClassNameMeta ( state , classNameParts )
@@ -216,9 +218,7 @@ function classNameToAst(
216
218
217
219
let rule = {
218
220
[ selector ] : {
219
- [ `@apply ${ classNameParts [ classNameParts . length - 1 ] } ${
220
- important ? ' !important' : ''
221
- } `] : '' ,
221
+ [ `@apply ${ baseClassName } ${ important ? ' !important' : '' } ` ] : '' ,
222
222
} ,
223
223
}
224
224
if ( path . length ) {
You can’t perform that action at this time.
0 commit comments