3

EDIT: This feature is finally included in Visual Studio 2017 (currently in the preview though)! https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/4408859-native-multi-editing-multiple-cursors-and-selecti

***** Original Question *******

So I normally use Visual Studio Code, but my current project requires full-blown Visual Studio.

One command that I love in VS Code is the ability to select multiple instances of a piece of text. i.e.

this.Id= standVM.Id;

So If I highlight Id in VS Code I could then hit Ctrl+D and get the second instance highlighted. Does full blown Visual Studio offer this?

EDIT: Typically When I'm doing this I'll only want the next instance of that string of text... i.e.

this.Id= standVM.Id;

this.Id= standVM.Id;

this.Id= standVM.Id;

So I want to select both bold instances of the property, but none of the italic properties.

EDIT: Demo of what I'm looking for... Demo of functionality

Since it needs clarified. I want this functionality in full blown Visual Studio. Not Visual Studio Code. (I already know how to do that)

Jared
  • 5,840
  • 5
  • 49
  • 83

2 Answers2

3

I gave it a try, check it out if you like: https://marketplace.visualstudio.com/items?itemName=thomaswelen.SelectNextOccurrence

2mas
  • 96
  • 5
  • That is AWESOME! I had found an option that was paid, but was no longer supported (you couldn't even buy the license). So thanks again and I gave you a five star and a review! – Jared Jan 12 '18 at 19:32
0

You can use the Ctrl+F command. It is meant for searching but it also highlights all the instances of the selected text in the file. It also highlights automatically if you then type more new code and it contains the searched text.

Aleš Doganoc
  • 11,568
  • 24
  • 40
  • And then you can use F3 to move to the next instance of the word. – Erik Philips Dec 14 '17 at 21:22
  • I updated the question to make it a tad more clear what I'm looking for! – Jared Dec 14 '17 at 21:22
  • @ErikPhilips I'm not a die hard never leave the keyboard person, but this is one instance where I'm hoping I can avoid it. I'm sure I could tab may way to not using the mouse, but this may be an instance where Visual Studio just doesn't do what I'm looking for. – Jared Dec 14 '17 at 21:23
  • Or you might be asking the wrong question. This VERY VERY much smells like an [XY Problem](https://meta.stackexchange.com/a/66378/171858). Why do you need to find all these instances? It sounds like doing a Regex find and replace might be a better solution, but I don't know *why* you are searching for these words. – Erik Philips Dec 14 '17 at 21:25
  • @ErikPhilips, possible, but I doubt it. I added a gif of what I'm looking for. It's a contrived example, but it shows what I'm wanting to do. – Jared Dec 14 '17 at 21:36
  • 1
    In some editors, this is called multi-cursor editing. It makes it pretty easy to refactor a variable or do a mass formatting change to several similar lines of code. Once you start using it, it is painful to use editors that don't offer the feature. Several editors will also allow for Ctrl+Alt+DownArrow to create a multi-cursor state. Esc is usually the key to revert back to a single cursor. – Scott Jibben Mar 02 '18 at 16:03