From 0a62fbc90c247ec989eb05fc07b75bd55c1e67db Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Sun, 10 May 2020 14:49:57 +0100 Subject: [PATCH] update @apply diagnostics --- src/lsp/providers/diagnosticsProvider.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lsp/providers/diagnosticsProvider.ts b/src/lsp/providers/diagnosticsProvider.ts index 51565e9..66e0f4c 100644 --- a/src/lsp/providers/diagnosticsProvider.ts +++ b/src/lsp/providers/diagnosticsProvider.ts @@ -16,9 +16,15 @@ function provideCssDiagnostics(state: State, document: TextDocument): void { .map(({ className, range }) => { const parts = getClassNameParts(state, className) if (!parts) return null + const info = dlv(state.classNames.classNames, parts) let message: string - if (info.__context && info.__context.length > 0) { + + if (Array.isArray(info)) { + message = `\`@apply\` cannot be used with \`.${className}\` because it is included in multiple rulesets.` + } else if (info.__source !== 'utilities') { + message = `\`@apply\` cannot be used with \`.${className}\` because it is not a utility.` + } else if (info.__context && info.__context.length > 0) { if (info.__context.length === 1) { message = `\`@apply\` cannot be used with \`.${className}\` because it is nested inside of an at-rule (${info.__context[0]}).` } else {