re-ovo / unocss-intellij

Unocss support on Intellij Idea/WebStorm
https://plugins.jetbrains.com/plugin/22204-unocss
MIT License
169 stars 12 forks source link

[Feature Request] Option to truncate classes after specified length #50

Closed AndrewBogdanovTSS closed 8 months ago

AndrewBogdanovTSS commented 8 months ago

Describe the bug It's not a bug but a feature request

How it should work

Why it's needed? Reduces mental complexity in the heavily styled large files

Examples:

Before:

class=":uno: absolute h-12 w-12 flex center rounded-full bg-black <md:(left-1/2) -translate-x-1/2"

After: option 1:

class="..."

option 2:

class=":uno: absolute h-12 w-12 ..."
re-ovo commented 8 months ago
截屏2024-01-17 17 24 37

Code folding is already supported

AndrewBogdanovTSS commented 8 months ago

interesting. Could you explain how it can be enabled?

re-ovo commented 8 months ago

interesting. Could you explain how it can be enabled?

It uses the folding shortcut provided by Intellij, which you can view in the Code > Folding menu

AndrewBogdanovTSS commented 8 months ago

Can you specify which exact option? I use Webstorm and I don't see anything specific to class names image

re-ovo commented 8 months ago

image I mean this, or use shortcut Ctrl+Numpad-

AndrewBogdanovTSS commented 8 months ago

If I understand correctly these settings only allow to manually toggle specific portions, what I'm looking for is a default behavior. When I enter a file I would like classes to be folded by default and expanded only on click. Is there a way to fold them by default in Webstorm?

re-ovo commented 8 months ago

I guess there is no such aggressive folding behavior in Intellij, even if the default folding is set to true, it still requires you to manually fold after editing, or reopen the file. Is that enough?

AndrewBogdanovTSS commented 8 months ago

Essentially, I want the same behavior for classes as for inline styles. When I open a file I see styles truncated like this image

re-ovo commented 8 months ago

Sure

re-ovo commented 8 months ago

Will be fixed in 1.4.2, and supports some customization of folding behavior (placeholders, minimum length, default folding)

AndrewBogdanovTSS commented 8 months ago

Great, thanks a lot

AndrewBogdanovTSS commented 7 months ago

@re-ovo I tested the latest update and it looks awesome, thanks a lot for such a quick implementation and release. If I may add a couple of suggestions for improvement, it would be great if:

re-ovo commented 7 months ago

@re-ovo I tested the latest update and it looks awesome, thanks a lot for such a quick implementation and release. If I may add a couple of suggestions for improvement, it would be great if:

  • clicking on the folded version would unfold only this specific item and not all in the file
  • it could be a shortcut to toggle folding
  • truncated text would hide classes partially, e.g. "flex pl-3 [UnoCSS]" instead of "[UnoCSS]" (don't know if this is even possible withing Intellej products) thanks again 👍🏻