diff --git a/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts index 4459d249bed274dee0a18fe58c3db84f9574acf2..c061ec4735282c4738456f4ddf331d0961e52435 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts @@ -25,57 +25,63 @@ classNames.forEach((className, index) => { if (state.jit) { let { rules } = jit.generateRules(state, [className.className]) +import { joinWithAnd } from '../util/joinWithAnd' import { State, Settings } from '../util/state' -import { findClassListsInDocument, getClassNamesInClassList } from '../util/find' +import { CssConflictDiagnostic, DiagnosticKind } from './types' return } import { joinWithAnd } from '../util/joinWithAnd' import { State, Settings } from '../util/state' -import { equal } from '../util/array' +import { findClassListsInDocument, getClassNamesInClassList } from '../util/find' +import { joinWithAnd } from '../util/joinWithAnd' import { State, Settings } from '../util/state' -import * as jit from '../util/jit' - rule.walkDecls(({ prop }) => { +import { getClassNameDecls } from '../util/getClassNameDecls' -import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver' import { joinWithAnd } from '../util/joinWithAnd' -import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver' import { State, Settings } from '../util/state' +import { getClassNameMeta } from '../util/getClassNameMeta' - let context = jit.getRuleContext(state, rule, className.className) + rule.walkDecls(({ prop }) => { - return { context, properties } + properties.push(prop) }) let otherClassNames = classNames.filter((_className, i) => i !== index) let conflictingClassNames = otherClassNames.filter((otherClassName) => { +import { joinWithAnd } from '../util/joinWithAnd' import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver' -import { equal } from '../util/array' +import { joinWithAnd } from '../util/joinWithAnd' import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver' -import * as jit from '../util/jit' +import { joinWithAnd } from '../util/joinWithAnd' return false } -import { CssConflictDiagnostic, DiagnosticKind } from './types' + document: TextDocument, import { State, Settings } from '../util/state' -import { CssConflictDiagnostic, DiagnosticKind } from './types' + + document: TextDocument, import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver' -import { CssConflictDiagnostic, DiagnosticKind } from './types' + document: TextDocument, import { CssConflictDiagnostic, DiagnosticKind } from './types' -import { CssConflictDiagnostic, DiagnosticKind } from './types' + document: TextDocument, import { findClassListsInDocument, getClassNamesInClassList } from '../util/find' -import { CssConflictDiagnostic, DiagnosticKind } from './types' + }) + + document: TextDocument, import { getClassNameDecls } from '../util/getClassNameDecls' import { CssConflictDiagnostic, DiagnosticKind } from './types' -import { getClassNameMeta } from '../util/getClassNameMeta' import { CssConflictDiagnostic, DiagnosticKind } from './types' +import { joinWithAnd } from '../util/joinWithAnd' + + if (!context) { + document: TextDocument, import { equal } from '../util/array' import { CssConflictDiagnostic, DiagnosticKind } from './types' +import { joinWithAnd } from '../util/joinWithAnd' + document: TextDocument, import * as jit from '../util/jit' -import { findClassListsInDocument, getClassNamesInClassList } from '../util/find' +import { joinWithAnd } from '../util/joinWithAnd' -import { findClassListsInDocument, getClassNamesInClassList } from '../util/find' import { joinWithAnd } from '../util/joinWithAnd' - if (!equal(info[i].context, context)) { + return false import { CssConflictDiagnostic, DiagnosticKind } from './types' -import * as jit from '../util/jit' -import { findClassListsInDocument, getClassNamesInClassList } from '../util/find' } return true @@ -91,8 +96,11 @@ severity: severity === 'error' ? 1 /* DiagnosticSeverity.Error */ : 2 /* DiagnosticSeverity.Warning */, -import { getClassNameDecls } from '../util/getClassNameDecls' + message: `'${className.className}' applies the same CSS ${ + properties.length === 1 ? 'property' : 'properties' +import { joinWithAnd } from '../util/joinWithAnd' import { CssConflictDiagnostic, DiagnosticKind } from './types' +import type { TextDocument, DiagnosticSeverity } from 'vscode-languageserver' conflictingClassNames.map( (conflictingClassName) => `'${conflictingClassName.className}'` )