twc icon indicating copy to clipboard operation
twc copied to clipboard

[Help] tailwindCSS.experimental.classRegex for Adapting based on props

Open p-iknow opened this issue 8 months ago • 1 comments

💬 Is there a way to get support from Tailwind CSS IntelliSense even when using patterns like the one below?

import { twc, TwcComponentProps } from "react-twc";
 
type ButtonProps = TwcComponentProps<"button"> & { $primary?: boolean };
 
const Button = twc.button<ButtonProps>((props) => [
  "font-semibold border border-blue-500 rounded",
  props.$primary ? "bg-blue-500 text-white" : "bg-white text-gray-800",
]);

I followed the instructions in the getting started guide and made the configurations, but IntelliSense did not work for patterns like the code above.

"tailwindCSS.experimental.classRegex": [
    "twc\\.[^`]+`([^`]*)`", 
    "twc\\([^`]*?\\)`([^`]*)`",
    ["twc\\.[^`]+\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
    ["twc\\([^`]*?\\).*?\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]

p-iknow avatar Jun 10 '24 06:06 p-iknow