Skip to content
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

Does not work when encounters variants classes #62

Closed
dc-p8 opened this issue Feb 7, 2023 · 6 comments
Closed

Does not work when encounters variants classes #62

dc-p8 opened this issue Feb 7, 2023 · 6 comments
Labels
question Further information is requested

Comments

@dc-p8
Copy link

dc-p8 commented Feb 7, 2023

[.peer:checked~&>.material-icons]:opacity-100 is a perfect valid tailwind class (see arbitrary variants ), but when the plugin encounters this kind of classes, it refuses to format the whole element. Removing this class allow the plugin to format the element's classes.

No log lines appear exept the default one :
2023-02-07 11:30:53,345 [127201544] INFO - #TailwindUtility - Loading default class order

@WalrusSoup WalrusSoup added the bug Something isn't working label Feb 7, 2023
@WalrusSoup
Copy link
Owner

Can you make sure you're on the latest version (2.0.1) in your IDE?

Also, can you give me a sample file that it's failing to work with? When testing against the latest release, it appears to move the variant to the beginning of the main variants area. Per play.tailwindcss.com - it should be in the back. I can definitely fix this, but I am curious to check in on the fact it stops formatting entirely first.

Expected :flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0 [.peer:checked~&>.material-icons]:opacity-100
Actual   :flex min-h-full items-end justify-center p-4 text-center [.peer:checked~&>.material-icons]:opacity-100 sm:items-center sm:p-0

@WalrusSoup
Copy link
Owner

Could be related to #63 actually. Let me know if you have issues after that goes out.

@WalrusSoup WalrusSoup added enhancement New feature or request Awaiting Marketplace Approval Waiting on Jetbrains and removed enhancement New feature or request labels Feb 7, 2023
@WalrusSoup
Copy link
Owner

WalrusSoup commented Feb 8, 2023

this is now on the fix/arbitrary-variants branch - pending more testing to make sure the behaviors all make sense.

@WalrusSoup WalrusSoup removed the Awaiting Marketplace Approval Waiting on Jetbrains label Feb 8, 2023
@dc-p8
Copy link
Author

dc-p8 commented Feb 8, 2023

I confirm that the issue is still present in v2.0.2.
This file
<div class="sm:p-0 flex min-h-full items-end justify-center p-4 text-center sm:items-center [.peer:checked~&>.material-icons]:opacity-100"></div>
can't be formatted. Removing the last class and it works. Same behaviour in @apply

@WalrusSoup
Copy link
Owner

WalrusSoup commented Feb 8, 2023

I ended up rewriting the variant handling here: #64

This file shows the output and the test is passing:

https://github.com/WalrusSoup/Tailwind-Formatter/blob/982af1a8c7c4479f956106be71f876c54b3ce91f/src/test/testData/parser/arbitrary-variant-expected.vue

and the tests pass in the GH action.

The last thing I'm going to do is bring in more complicated examples. I'll make some over in play.tailwindcss.com and shuffle the classes around and make sure its all 100% before I ship it out. I cant possibly guess every configuration people will use, but I'm going to really try to get most of them.

Edit: let me know if this still happens ?

@WalrusSoup WalrusSoup added Awaiting Marketplace Approval Waiting on Jetbrains question Further information is requested and removed bug Something isn't working Awaiting Marketplace Approval Waiting on Jetbrains labels Feb 13, 2023
@WalrusSoup
Copy link
Owner

assuming we gucci - gonna close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants