1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
diff --git a/src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts b/src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts
index 22c66036db3c9fbb8345ccd33311ca842cf92f77..346f2462f95b77ba7635ba884bb65bfaa087a8d3 100644
--- a/src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts
+++ b/src/lsp/providers/codeActions/provideInvalidApplyCodeActions.ts
@@ -22,6 +22,7 @@ import dset from 'dset'
import selectorParser from 'postcss-selector-parser'
import { flatten } from '../../../util/array'
import { getClassNameMeta } from '../../util/getClassNameMeta'
+import { validateApply } from '../../util/validateApply'
export async function provideInvalidApplyCodeActions(
state: State,
@@ -173,11 +174,12 @@ classNameParts: string[],
selector: string,
important: boolean = false
) {
- const baseClassName = dlv(
- state.classNames.classNames,
- classNameParts[classNameParts.length - 1]
- )
- if (!baseClassName) {
+ const baseClassName = classNameParts[classNameParts.length - 1]
+ const validatedBaseClassName = validateApply(state, [baseClassName])
+ if (
+ validatedBaseClassName === null ||
+ validatedBaseClassName.isApplyable === false
+ ) {
return null
}
const meta = getClassNameMeta(state, classNameParts)
@@ -216,9 +218,7 @@ if (selector === null) return null
let rule = {
[selector]: {
- [`@apply ${classNameParts[classNameParts.length - 1]}${
- important ? ' !important' : ''
- }`]: '',
+ [`@apply ${baseClassName}${important ? ' !important' : ''}`]: '',
},
}
if (path.length) {
|