heybourn / headwind

An opinionated Tailwind CSS class sorter built for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=heybourn.headwind
MIT License
1.39k stars 44 forks source link

Different outcomes: format on save and format entire workspace #178

Open ManuelLeiner opened 2 years ago

ManuelLeiner commented 2 years ago

Describe the bug Sorting the classes of the entire workspace and sorting the classes of a single file (either format on save or command) result in different outcome.

To Reproduce Steps to reproduce the behavior:

  1. Open command palette and sort entire workspace image
  2. Check files for any changes. A small number of our components are now changed.
  3. For example, the classes of our button component gets sorted Original: class="inline-flex items-center tracking-wider transition border border-transparent rounded-lg focus:outline-none focus:ring disabled:opacity-25" Change: class="inline-flex items-center tracking-wider border border-transparent rounded-lg transition focus:outline-none focus:ring disabled:opacity-25"
  4. Now either format on save or use the other command image
  5. The file has been sorted again and is back to the original Original: class="inline-flex items-center tracking-wider transition border border-transparent rounded-lg focus:outline-none focus:ring disabled:opacity-25"
  6. The button is no longer marked as changed

Other example: Format entire workspace: `<div class="py-1 mb-2 text-xs font-bold rounded grid grid-cols-12 bg-grey-300 gap-x-4 text-grey-700"

**Format on save:** <div class="grid grid-cols-12 py-1 mb-2 text-xs font-bold rounded bg-grey-300 gap-x-4 text-grey-700" `

Expected behavior Both ways of sorting behave the same and do not cancel each other out.

Screenshots I removed all code from our button but the following and the problem still occurs

Format entire workspace: image

image

image

image

... and many more

Format on save: All files will be reverted to the original.

Desktop (please complete the following information):

pelletencate commented 2 years ago

I believe this is a known issue. The packaged version of Rustywind is v0.7.1, but Headwind's own implementation matches the behavior of Rustywind v0.6.7 (which I found out the hard way: by testing them all.)

I've manually installed Rustywind v0.6.7 and use it from the command line instead of relying on the one shipped with Headwind.