-
Notifications
You must be signed in to change notification settings - Fork 215
Add tailwindCSS.classFunctions
setting
#1258
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
Add tailwindCSS.classFunctions
setting
#1258
Conversation
…tailwindcss/language-service
Hah. This is fantastic! I was thinking about adding exactly this feature last week while working on a larger refactor of stuff which is intended to make features like this simpler to implement and hopefully cleanup code a ton too: Document Scopes. It's a massive WIP and nowhere near done though. Some notes:
The Document Scopes feature I've been working on is pretty much designed to make every since one of the above goals easier to achieve but it's a long way off from being done. I'm going to think on this some to see if there's an interim solution that hits most of those points (the primary one being the whole document regex one tho). |
@thecrypticace thanks for the notes!
Moved it outside
Yea, I know.. Prior to taking this on, I tried to write logic to achieve this with
Added support for tagged template literals with the same option (See dc441bc) |
We could possibly look into an AST approach (e.g. for JS/JSX Edit: |
experimental.classFunctions
option to the settingstailwindCSS.classFunctions
option to the settings
I can probably write a specialized parser that's "good enough" for this case. We definitely do not need the full power of acorn or babel here. |
tailwindCSS.classFunctions
option to the settingstailwindCSS.classFunctions
setting
@@ -64,7 +65,7 @@ export type TailwindCssSettings = { | |||
recommendedVariantOrder: DiagnosticSeveritySetting | |||
} | |||
experimental: { | |||
classRegex: string[] | |||
classRegex: string[] | [string, string][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ngl seeing that this was wrong is a bit embarrassing 😂
Alright, I've made a handful of changes to the implementation and tests. Still some typescript things that I want to cleanup but I'm not gonna do that in this PR (tbh there's a LOT of low hanging fruit there — I'm very, very slowly working towards migrating everything to strict mode). Gonna have some other folks take a look at this and hopefully get it in a release maybe next week. |
Perfect! I'll look over your changes during the weekend as well - thanks for taking this on! |
f048e51
to
8706e3a
Compare
It’s _identical_ to `absoluteRange` which is more used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add this to the readme so people know that this is available and how they can configure it.
Only small thing we noticed is that this also triggers it: But this can be addressed in a follow up PR by @thecrypticace! |
I went ahead and addressed it in this one |
Also realized I need completion tests for this but I'm gonna add those after merging a couple other PRs b/c conflicts |
Thanks @LaurynasGr! Such a nice feature to have 💯 I'm gonna try getting a release out with this today or tomorrow |
Just published v0.14.10 with this 🔥 |
Awesome! Thanks @thecrypticace for accepting this and helping to get it through. I'm certain this will help lots of people struggling to achieve this behaviour with |
just found a bug — if you've got
The hovers are fine. Looking at the class attribute completion code in general it seems a bit weird so I think I'll need to rework it. 😱 |
Figured it out #1278 |
This PR adds
tailwindCSS.classFunctions
option to the settings to add simple and performant class completions, hover previews, linting etc. for such cases: