2mas/SelectNextOccurrence

Feature Request

Jared-Dev opened this issue · 10 comments

This is not a bug, but if it isn't too hard there are a couple features that I think would make this THAT much sweeter!.

Both would involve a modifier key.

So by default we have the Ctrl + D to select the next instance. It would be cool if you could do a Ctrl + Shift + D to skip the next instance. The use case here is that a word in a variable also appears in a comment. There are times that it would be nice to be able to skip the comment instance of the selection.

The other would be to have something like Ctrl + Alt + D to toggle whether it the selection is case specific. This functionality in VS Code was always case insensitive which cased it to not always select the correct instances, but 90% of the time it did.

Please also consider adding an undo command that undoes the last addition. It's not uncommon to search forward through a file and accidentally select one you don't want, then have to start over (for me at least).

2mas commented

Hi and thank you for your input!

@InquisitiveDevelopment I think your suggestions would fit very well with the extension.
The case-sensitivity functionality is actually already implemented as of v1.0.3

(Toggle case-sensitive search by using the "Match case" setting from the find-dialog (Ctrl+F))

Why i chose to do it this way is mainly because Sublime Text works like this too.

@drewnoakes Good suggestion, i always end up doing the same too.

Skip next occurrence and Undo last selection will be added to roadmap, thanks!

2mas commented

@InquisitiveDevelopment @drewnoakes Please try latest version (1.1.0) and see if this works for you

@2mas I have been flat out. I'll try this out when time permits.

Currently I'm using MixEdit, but the author has essentially abandoned it, and it's closed source. It'd be interesting to have a feature comparison between the two as I'm sure you could gain a bunch of users and supporters from MixEdit if your extension was as capable or even better. MixEdit has a nag screen to buy it, and the author is not accepting payments meaning you can't dismiss the nag screen.

2mas commented

@drewnoakes I was using MixEdit too, but only for the purpose of ctrl+d. The popup was the main reason i chose to implement this myself. I'm unsure what features of MixEdit would be appreciated to avoid packing this extension with things noone uses, perhaps the

Select all current words / Expand selection to all same words

or

Create a new caret immediately above/below the existing ones

I'll have to think about a way to figure out whats wanted... Wait for feature requests, guess and implement or create some kind of poll perhaps. I'd appreciate your input if you're using something particular

I use Shift+Alt+Up/Down to add carets above/below, probably more often than Ctrl+D. As I understand it, that feature's not supported here, so I'll keep using MixEdit for now. I paid for it before the author went dark, so don't have a nag screen. I'd prefer to use and potentially contribute to an open source extension though.

Other related features I've seen in other editors that you might consider.

  • Select all occurrences
  • Convert the current single-block-selection into carets, with one at the end of each selected line
  • Align all carets vertically (columnar) based on the 'last' created caret
2mas commented

Thanks @drewnoakes, I think you're right that these features would fit in the extension aswell, without stepping out of scope. I think especially the Shift+Alt+Up/Down will be nice to have. Roadmap is now updated (I'm waiting with the alignment-feature).

The alignment feature is hardest to see a clear design for, and is arguably less often useful, so no complaints there. The motivation was aligning previously-jagged symbols.

Maybe a better way of doing this would be the following. Given a range of jagged carets:

var abc |= z;
var ab |= z;
var abcd |= z;

Invoke Edit.InsertWhiteSpaceToAlignText (or whatever) to get:

var abc  |= z
var ab   |= z
var abcd |= z

Another thing to consider is that by prefixing all VS commands with Edit. it's harder to find them in the list of commands. ReSharper, for example, prefixes all their commands with their product name. If I were setting up this extension for the first time, I'd like to type in SelectNextOccurrence to find all the available commands. Edit is pretty generic, though I also see the logic there. Just something to consider.

2mas commented

New prefix is coming, I had that in mind earlier too, and it becomes even more obvious that it's needed now when we get more available commands. Alignment could be a nice thing to have too, however this is one thing that would get erased when using "Format document", which i believe is quite often used? Could be a good thing for comments anyway

2mas commented

Please try latest version 1.2.8, I have included the add caret above/below commands