headwind icon indicating copy to clipboard operation
headwind copied to clipboard

Retain cursor position on reorder

Open chasegiunta opened this issue 5 years ago • 3 comments

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.

chasegiunta avatar Apr 23 '20 16:04 chasegiunta

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 :(

StErMi avatar Dec 03 '20 14:12 StErMi

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

karladler avatar Jan 20 '21 08:01 karladler

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.

harvanchik avatar May 18 '21 22:05 harvanchik