-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RunOnSave causing an issue when using autosave. #14
Comments
@donk3ylee That sounds very frustrating. Definitely worth fixing. I'll dig into this later this week. My approaches will generally prefer automatic detection so when people install the extension it "just works". So I'll try and detect active editing and disable reordering. My first approach will be detecting if the selection (cursor is a zero width selection) lies within the detected text range to be reordered and skip just that range. Another approach I might try is attempting to stick the cursor to its position relative to class it currently is within / on the end of as you suggested. If I can't make either of those work, I will investigate the addition of another configuration option. Aside from those, I think that maintaining cursor position is a generally good idea and so I will make sure that when we change the length of className - such as removing duplicates or extra whitespace - we update the cursor position accordingly. Thank you for taking the time to submit this issue and bring this to my attention! |
No worries Andrew thanks for the quick reply. It's a useful plugin. I think
if you can stick the cursor to the class name your typing as it is
reordered that would be thebest fix like you said.
Cheers,
Donk3ylee
…On Tue, 27 Feb 2024, 19:34 Andrew Trefethen, ***@***.***> wrote:
@donk3ylee <https://github.com/donk3ylee> That sounds very frustrating.
Definitely worth fixing. I'll dig into this later this week. My approaches
will generally prefer automatic detection so when people install the
extension it "just works". So I'll try and detect active editing and
disable reordering. My first approach will be detecting if the selection
(cursor is a zero width selection) lies within the detected text range to
be reordered and skip just that range. Another approach I might try is
attempting to stick the cursor to its position relative to class it
currently is within / on the end of as you suggested. If I can't make
either of those work, I will investigate the addition of another
configuration option.
Aside from those, I think that maintaining cursor position is a generally
good idea and so I will make sure that when we change the length of
className - such as removing duplicates or extra whitespace - we update the
cursor position accordingly.
Thank you for taking the time to submit this issue and bring this to my
attention!
—
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATWRJY3CWQ3AV7E2QTT3VJLYVYYLPAVCNFSM6AAAAABD4QGBKKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRXGQ2TQMRUGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I have been searching for a solution for so long now, I hope the work is still going on this, and an update soon, thanks |
I wrote this RFC on headwinds github page but after seeing the package is not well maintained I figured I would use your fork instead in the hope of getting this issue fixed. My apologies if some of the settings described here are not named the same but I'm sure you will get the idea:
RunOnSave feature is causing an issue when using vscode 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 ""). Or just move the cursor with the reordering of possible, 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.
The text was updated successfully, but these errors were encountered: