-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve selection handling for the merge_match_arms
assist
#18529
Improve selection handling for the merge_match_arms
assist
#18529
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This never bothered me, but I suppose it's fine. Can you squash, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from implementation perspective, but we need to decide if we want to apply this globally, because there are some more assists that this principle could be applied to.
ffbf9b6
to
f12d5e3
Compare
I suppose most people currently use this assist just with a cursor, not a selection.
Squashed 🫡 |
I think you are right, there are quite a few assists that currently do not think about selections and treat
I'll say it upfront, I don't have time right now to do all of them 😅 . I quickly found one where it would probably make sense to use Here are the new regression cases for that one, although that should probably be a separate PR? @ChayimFriedman2 :
|
merge_match_arms
merge_match_arms
assist
If we decide this is worth pursuing, we can fix them one at a time, but we need to decide if it is worth it. |
I think everybody agrees that this is an improvement, as you say it's really just a question of whether it's worth the effort. So maybe it's not necessary to make any decision at all? What's worth the effort is subjective, and whoever deems it worth the effort for should just send the PR? Slowly improving in this area over time, one assist at a time seems totally fine to me. But that's just my two cents, let me know if there's anything I can do for this PR specifically. |
I'm not sure I agree this is an improvement. I mean, sure this is, but I am not sure this slight improvement is worth even a slight addition to code complexity. |
I'm not sure it's an improvement, but the added code certainly isn't so bad, at least in this PR 😆. |
The ability to merge some match arms even though all match arms still say |
Yeah, but whitespace trimming is not. |
Maybe that's just my incompetence / bad eyes, but when I select text in an editor using a Mouse, A tool that should clearly be able to know what I want to do but refuses to do so |
Maybe this is because of different workflows. I rarely use the mouse, only the keyboard and mostly "Expand Selection". However this doesn't really have maintenance costs, so if it helps you I'm not opposed to adding this. |
Assist fatigue, mostly. We have a lot of them (and we'll likely add more), and sometimes the one I want is at the bottom of the list. Anyway, I think we can merge this and see if it becomes too annoying. |
This just fixes a minor annoyance where the
merge_match_arms
assistis not available if your selection has leading whitespace.
Example case that didn't work before but does now:
Edit: It now also fixes that this assist would "overrun" a selection in a case like this,
where the user intended to only merge the first two elements:
Edit2: It now no longer applies this selection restriction for small / potentially accidental selections like this:
Should be pretty good now! Sorry for not getting it right the first time.