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

RunOnSave causing an issue when using autosave #209

Open donk3ylee opened 9 months ago

donk3ylee commented 9 months ago

RunOnSave is causing an issue when using autosave. The issue is that while I'm typing my tailwind classes, vscode autosaves triggering headwind to reorder. As this reorder applies the cursor does not follow the original classname and I end up writing half of my classname in the center of another, corrupting that classname and leaving the classname I'm trying to declare half written and lost somewhere else in the string.

Could you add another cofiguration setting say headwind.triggerPoint where the user can choose options "runOnSave" or "runOnLineOut". The runOnLineOut would be an option whereby the reordering would happen when the user focuses away from the line or maybe when the cursor focuses away from the class value declaration string (anything within the ""). You get the idea.

It's a very handy extension for code readability and therefore productivity. It just becomes unusable when users have vscode autosave enabled and it gets triggered every 5 seconds, corrupting their tailwind classnames.

Thanks, Donk3yLee