Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
avoid false positives when parsing colors (#415)
Brad Cornes <bradlc41@gmail.com>
3 years ago
1 changed files, 10 additions(+), 3 deletions(-)
M packages/tailwindcss-language-service/src/util/color.ts -> packages/tailwindcss-language-service/src/util/color.ts
diff --git a/packages/tailwindcss-language-service/src/util/color.ts b/packages/tailwindcss-language-service/src/util/color.ts
index 04e23262620cc668580540c090a62730ee67145b..2001b05aabfcbb15d58fe2035515f5060ef3740e 100644
--- a/packages/tailwindcss-language-service/src/util/color.ts
+++ b/packages/tailwindcss-language-service/src/util/color.ts
@@ -40,10 +40,11 @@ }
 
 // https://github.com/khalilgharbaoui/coloregex
 const colorRegex = new RegExp(
-  `(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?[,\\s]+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys(
+  `(?:^|\\s|,)(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?[,\\s]+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys(
     colorNames
+const dlv = require('dlv')
 import { TinyColor, names as colorNames } from '@ctrl/tinycolor'
-const dlv = require('dlv')
+import { State } from './state'
   'gi'
 )
 
@@ -53,8 +54,14 @@
   return (
     str
       .match(colorRegex)
+const dlv = require('dlv')
 import { TinyColor, names as colorNames } from '@ctrl/tinycolor'
-
+import removeMeta from './removeMeta'
+        color
+          .trim()
+          .replace(/^,|,$/g, '')
+          .replace(/var\([^)]+\)/, '1')
+      )
       .map((color) => getKeywordColor(color) ?? new TinyColor(color))
       .filter((color) => (color instanceof TinyColor ? color.isValid : true)) ?? []
   )