-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
intellisense support (question) #14
Comments
RegexpI made a Regexp expression and added it inside the intellisense configuration of TailwindCSS in VSCode: {
"tailwindCSS.experimental.classRegex": [
"(w(?:\\.[a-z]+)?\\((?:[\\s\\S]+?)(?:[`'\"][\\s\\S]+[`'\"])*?\\}(?:[\\s\\S])?\\))",
]
} This selection by Regexp already gives the possibility to use intellisense with the Tag Name and Custom Component functions of However, there are still improvements to be made.
Issues with regex
const button = w.button('text-sm') // not working
const button = w.button('text-sm', { }) // working Hope it can help you! |
Please let me contribute a variation of the regex to catch some scenarios. https://regex101.com/r/uZ6FNJ/1
|
@eduardodallmann your regex works for me, thanks. But the first tailwind class after open a ` or " is not detected. You need to add a space then intellisense works. |
Here is what I came up with, works quite nicely at least with my code:
The idea here is that the first part matches the whole "w(...) { ... }" function call, and then the second part matches any quoted sections within it. This should handle whitespace or strings starting/ending with a quote without problems. But it might have issues with escaped quotes. The function-matching is based on this: I tried combining the second part into a conditional regex that would cover all of the quote alternatives, but for some reason I couldn't make that work. Feel free to improve/share it if you come up with something better! |
This works perfectly. It should be included in the official documentation. |
@eduardodallmann @jpcmf and @jaukia Thank you, guys! Jaukia's latest improvement worked great for me 🚀 |
Hey, love the idea of this package, I was wondering if you knew a way to get tailwind intellisense working with the strings in this package
The text was updated successfully, but these errors were encountered: