Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Tweak `theme` helper detection (#689)
Signature
-----BEGIN PGP SIGNATURE----- wsBcBAABCAAQBQJjtVZBCRBK7hj4Ov3rIwAA87IIAFumpGsB61FbYFGDOFQS6lS4 LJTbR3Y9lrwPirMN5FDhXiZ70f1VayUOPiLlo4wLVnv76RHoV3HWEJLcuaFX++bV JJEaWBBJ0oryrXTKlYuqxK4XTJGBLJ7CphcK2lvZTpP+9mgqNbeyk9k5pVlpufTq i3HooILnVhDcqY1sUm1K3tOs7FP5p6A6hW+jSIxNXKWt/uO/RLwDRRGw5rOQY2Ue GursuBheiA2wE5yMctUw5HUM1TnF9KFb73yFSS3UZg8PHqPGqUEtHC1Y25tm+Xnt 8CsEdbwo2QTNlcgD4oQfVE8DYy38dyLEXf0R8wrtWWWqTMFc1w7VzZY6TQj4KXw= =kWNY -----END PGP SIGNATURE-----
Brad Cornes <hello@bradley.dev>
2 years ago
2 changed files, 10 additions(+), 3 deletions(-)
M packages/tailwindcss-language-service/src/completionProvider.ts -> packages/tailwindcss-language-service/src/completionProvider.ts
diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts
index d8bee18835f75d8e646c3d7742b7c0e79c6f047f..63a5edf3b6f87daf725592ef09d841e7e54b5bae 100644
--- a/packages/tailwindcss-language-service/src/completionProvider.ts
+++ b/packages/tailwindcss-language-service/src/completionProvider.ts
@@ -614,7 +614,7 @@   })
 
   const match = text
     .substr(0, text.length - 1) // don't include that extra character from earlier
-    .match(/\b(?<helper>config|theme)\(\s*['"]?(?<path>[^)'"]*)$/)
+    .match(/[\s:;/*(){}](?<helper>config|theme)\(\s*['"]?(?<path>[^)'"]*)$/)
 
   if (match === null) {
     return null
M packages/tailwindcss-language-service/src/util/find.ts -> packages/tailwindcss-language-service/src/util/find.ts
diff --git a/packages/tailwindcss-language-service/src/util/find.ts b/packages/tailwindcss-language-service/src/util/find.ts
index 028386507fd40a52de8f31403401970ed5c6d8d8..1977ef89a20f15fb0a736b7aae346804e1048b42 100644
--- a/packages/tailwindcss-language-service/src/util/find.ts
+++ b/packages/tailwindcss-language-service/src/util/find.ts
@@ -350,7 +350,10 @@   doc: TextDocument,
   range?: Range
 ): DocumentHelperFunction[] {
   const text = getTextWithoutComments(doc, 'css', range)
-  let matches = findAll(/\b(?<helper>config|theme)(?<innerPrefix>\(\s*)(?<path>[^)]*?)\s*\)/g, text)
+  let matches = findAll(
+    /(?<prefix>[\s:;/*(){}])(?<helper>config|theme)(?<innerPrefix>\(\s*)(?<path>[^)]*?)\s*\)/g,
+    text
+  )
 
   return matches.map((match) => {
     let quotesBefore = ''
@@ -364,7 +367,11 @@       path = matches[1]
     }
     path = path.replace(/['"]*\s*$/, '')
 
-    let startIndex = match.index + match.groups.helper.length + match.groups.innerPrefix.length
+    let startIndex =
+      match.index +
+      match.groups.prefix.length +
+      match.groups.helper.length +
+      match.groups.innerPrefix.length
 
     return {
       helper: match.groups.helper === 'theme' ? 'theme' : 'config',