As others have suggested, use TailwindCSS IntelliSense. However, for hinting within special attributes or functions, custom configuration is required. By default, hints will only appear in HTML class and className attributes, but this can be extended to JavaScript functions, additional HTML attributes, or even custom regex patterns.
Specifically, for displaying hints when passing parameters in functions, up until v0.14.9, could only reference them using regex by classRegex. However, from v0.14.10 onward, this was extended with a simpler classFunctions setting.
Specifically, for the twrnc package, I would follow the settings below based on the different IntelliSense versions.
From TailwindCSS IntelliSense v0.14.10
For the TailwindCSS IntelliSense to work within the tw function added by twrnc, you need to add the function name to tailwindCSS.classFunctions, like this:
{
"tailwindCSS.classFunctions": ["tw", "tw.style"]
}
Note: This only replaces classRegex; however, using classAttributes alongside it is still recommended.
Until TailwindCSS IntelliSense v0.14.9
However, if you want it to work in the style attribute within an HTML structure, you need to add the following alongside the default class and className:
{
"tailwindCSS.classAttributes": [
// ...
"style"
],
}
Additionally, you can use the classRegex expression you mentioned to declare the hint to be requested when calling the function, based on twrnc's recommendation:
{
"tailwindCSS.experimental.classRegex": [
"tw`([^`]*)",
["tw.style\\(([^)]*)\\)", "'([^']*)'"]
]
}