CodeArtist
CodeArtist

Reputation: 5714

is there a way to edit all reference highlights in visual studio?

Usually in vs2015 and vs2017 (at least) when you select a word, automatically all the references of the word get selected. I would like to know if there is a way to edit all the occurrences using a keyboard shortcut (placing multiple cursors without the searching dialog), as an example, let's say that in the image below i would like to replace the "Some" with "Very".

Reference Higlighting

Upvotes: 2

Views: 2770

Answers (3)

akseli
akseli

Reputation: 2868

Update for VS 2022. You're going to want to make use of VS2022's Multiple Caret functionality if you're not strickly looking to perform a variable/function rename action, which can be done using Ctrl+R+Ctrl+R.

Once you've made the initial selection you can use Edit -> Multiple Carets -> Insert Carets At All Matching functionality.

By default, this function is mapped to: Shift+Alt+;

This will add a new caret to each of the highlighted/matching sections allowing you to edit them simultaneously.

Multi-caret support in VS2022 is quite extensive. You can explore more options in the official documentation.

Upvotes: 1

VBobCat
VBobCat

Reputation: 2732

Try right-clicking your reference, then choosing "Rename..."

Upvotes: 2

Andy G
Andy G

Reputation: 19367

There is at least one plug-in, Multi Edit Mode, but you can just modify the function name and use the light bulb/quick actions (Ctrl .) to rename/refactor all references to the function.

Upvotes: 0

Related Questions