Skip to content

Commit 0cce870

Browse files
committed
update for at-apply changes in v2
1 parent 33523b3 commit 0cce870

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

packages/tailwindcss-language-service/src/completionProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function provideAtApplyCompletions(
199199
},
200200
(item) => {
201201
if (item.kind === 9) {
202-
return flagEnabled(state, 'applyComplexClasses')
202+
return semver.gte(state.version, '2.0.0-alpha.1') || flagEnabled(state, 'applyComplexClasses')
203203
}
204204
let validated = validateApply(state, item.data)
205205
return validated !== null && validated.isApplyable === true

packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { InvalidApplyDiagnostic, DiagnosticKind } from './types'
33
import { Settings, State } from '../util/state'
44
import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver'
55
import { validateApply } from '../util/validateApply'
6-
import { flagEnabled } from '../util/flagEnabled'
76

87
export function getInvalidApplyDiagnostics(
98
state: State,
@@ -12,7 +11,6 @@ export function getInvalidApplyDiagnostics(
1211
): InvalidApplyDiagnostic[] {
1312
let severity = settings.lint.invalidApply
1413
if (severity === 'ignore') return []
15-
if (flagEnabled(state, 'applyComplexClasses')) return []
1614

1715
const classNames = findClassNamesInRange(document, undefined, 'css')
1816

packages/tailwindcss-language-service/src/util/validateApply.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { State } from './state'
22
import { getClassNameMeta } from './getClassNameMeta'
33
import { flagEnabled } from './flagEnabled'
4+
import semver from 'semver'
45

56
export function validateApply(
67
state: State,
@@ -9,7 +10,10 @@ export function validateApply(
910
const meta = getClassNameMeta(state, classNameOrParts)
1011
if (!meta) return null
1112

12-
if (flagEnabled(state, 'applyComplexClasses')) {
13+
if (
14+
semver.gte(state.version, '2.0.0-alpha.1') ||
15+
flagEnabled(state, 'applyComplexClasses')
16+
) {
1317
return { isApplyable: true }
1418
}
1519

0 commit comments

Comments
 (0)