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 45 forks source link

Retain cursor position on reorder #72

Open chasegiunta opened 4 years ago

chasegiunta commented 4 years ago

Is your feature request related to a problem? Please describe. A common workflow is inputting a class with a certain value and incrementing or decrementing: input px-3, review how it looks, hit backspace and change 3 to 4, etc.

Headwind will keep your cursor exactly where it is, regardless of what has changed, leading to mistaken backspaces and class editing.

Describe the solution you'd like The Prettier vscode handles this situation well. On reformat, your cursor will remain next to the nearest token it was alongside before format. It would be great if this can be implemented in Headwind.

StErMi commented 4 years ago

this is my huge main issue with this plugin. because my times like @chasegiunta are describing I'm trying different sizes of the same px/py or different colors and this behavior is breaking my flow. It's a huge problem :(

karladler commented 3 years ago

I don't know if vscode offers the API for it, but it would be already a huge improvement, that it reorders only when I hit CMD+S and not during autosave.

Edit: just looked it up: Should be possible using the saving reason from the event. https://code.visualstudio.com/api/references/vscode-api#TextDocumentWillSaveEvent

harvanchik commented 3 years ago

I like this extension, but the one thing that may end up making me stop using it is this very issue. The classes sort, but my cursor doesn't move with it. Sure, it only takes a few seconds to move the cursor, but over the course of a 5 hour work-period, this adds up really quick.