update for at-apply changes in v2

master
Brad Cornes 2020-11-03 11:08:39 +00:00
parent 33523b3f11
commit 0cce870c13
3 changed files with 6 additions and 4 deletions

View File

@ -199,7 +199,7 @@ function provideAtApplyCompletions(
},
(item) => {
if (item.kind === 9) {
return flagEnabled(state, 'applyComplexClasses')
return semver.gte(state.version, '2.0.0-alpha.1') || flagEnabled(state, 'applyComplexClasses')
}
let validated = validateApply(state, item.data)
return validated !== null && validated.isApplyable === true

View File

@ -3,7 +3,6 @@ import { InvalidApplyDiagnostic, DiagnosticKind } from './types'
import { Settings, State } from '../util/state'
import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver'
import { validateApply } from '../util/validateApply'
import { flagEnabled } from '../util/flagEnabled'
export function getInvalidApplyDiagnostics(
state: State,
@ -12,7 +11,6 @@ export function getInvalidApplyDiagnostics(
): InvalidApplyDiagnostic[] {
let severity = settings.lint.invalidApply
if (severity === 'ignore') return []
if (flagEnabled(state, 'applyComplexClasses')) return []
const classNames = findClassNamesInRange(document, undefined, 'css')

View File

@ -1,6 +1,7 @@
import { State } from './state'
import { getClassNameMeta } from './getClassNameMeta'
import { flagEnabled } from './flagEnabled'
import semver from 'semver'
export function validateApply(
state: State,
@ -9,7 +10,10 @@ export function validateApply(
const meta = getClassNameMeta(state, classNameOrParts)
if (!meta) return null
if (flagEnabled(state, 'applyComplexClasses')) {
if (
semver.gte(state.version, '2.0.0-alpha.1') ||
flagEnabled(state, 'applyComplexClasses')
) {
return { isApplyable: true }
}