stivoat / tailwind-fold

Visual Studio Code extension that improves code readability by folding long class attributes
https://marketplace.visualstudio.com/items?itemName=stivo.tailwind-fold
MIT License
108 stars 19 forks source link

`v0.2.0` Buggy multiline; Fold Length Threshold setting is ignored #44

Open mitchuman opened 2 months ago

mitchuman commented 2 months ago

After installing the recent v0.2.0 update, the following is happening:

https://github.com/stivoat/tailwind-fold/assets/73133191/aaafb53e-7d95-4e6b-94a7-ac242b8dc2ba

stivoat commented 2 months ago

By "buggy", do you mean the large empty space? The "Fold Length Threshold" has been changed from classes to characters

mitchuman commented 2 months ago

The void space and the change of indentation with the closing brackets does look very awkward. I personally was OK with the folding not happening when used with helpers like clsx or twMerge with v0.1.0, so maybe have an option to disable folding with these conditions?

Ideally though, I would want to see a clean fold and collapse of lines

<figure
  className={...}
  // OR below to denote the usage of cn/clsx/twMerge
  className={cn(...)}
>

Noted on the threshold. I missed the change there...

stivoat commented 2 months ago

I only just realized the indentation issue. Maybe someone will come up with a PR in the next few days. Otherwise, I will remove multiline support as a temporary fix.

abdul-alhasany commented 2 months ago

@stivoat It might be helpful to add multiline folding as an option (to turn off/on). I think that folding makes sense when it is one line since tailwind classes can become verbose. I use an eslint plugin where it breaks classes acrouss multiline if execceding a certain charchter limit. In this case I would like to see the list of classes since it does not mess up the UI. However, with latest update I am having the same issue as @mitchuman