From d641b8eb2b6f12d1a628f47a05a6fb44ae11a093 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Mon, 4 Oct 2021 18:14:24 +0100 Subject: [PATCH] allow whitespace around class attribute `=` (#426) --- packages/tailwindcss-language-service/src/completionProvider.ts | 2 +- packages/tailwindcss-language-service/src/util/find.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts index e8a3140..9410223 100644 --- a/packages/tailwindcss-language-service/src/completionProvider.ts +++ b/packages/tailwindcss-language-service/src/completionProvider.ts @@ -338,7 +338,7 @@ function provideClassAttributeCompletions( end: position, }) - const match = findLast(/(?:\s|:|\()(?:class(?:Name)?|\[ngClass\])=['"`{]/gi, str) + const match = findLast(/(?:\s|:|\()(?:class(?:Name)?|\[ngClass\])\s*=\s*['"`{]/gi, str) if (match === null) { return null diff --git a/packages/tailwindcss-language-service/src/util/find.ts b/packages/tailwindcss-language-service/src/util/find.ts index 028bd59..6224cc5 100644 --- a/packages/tailwindcss-language-service/src/util/find.ts +++ b/packages/tailwindcss-language-service/src/util/find.ts @@ -174,7 +174,7 @@ async function findCustomClassLists( export function findClassListsInHtmlRange(doc: TextDocument, range?: Range): DocumentClassList[] { const text = doc.getText(range) - const matches = findAll(/(?:\s|:|\()(?:class(?:Name)?|\[ngClass\])=['"`{]/g, text) + const matches = findAll(/(?:\s|:|\()(?:class(?:Name)?|\[ngClass\])\s*=\s*['"`{]/gi, text) const result: DocumentClassList[] = [] matches.forEach((match) => {