How to use Reference Highlighting

Keyboard:  CTRL+SHIFT+DOWN ARROW (forward); CTRL+SHIFT+UP ARROW (reverse)
Command:  Edit.NextHighlightedReference; Edit.PreviousHighlightedReference
Versions:  2010
Published:  1/18/2010
Code:  vstipEdit0010

 

image

 

 

This one is absolutely one of my favorite tips because you don't have to do anything to make it happen!  The MSDN documentation describes Reference Highlighting this way:

"By default in a code file in the editor, when you click a symbol, all instances of the symbol are automatically highlighted.  Highlighted symbols may include declarations and references, and generally anything else that Find All References would return. This includes the names of classes, objects, variables, methods, and properties."

 

Navigation

So all you have to do is click in any symbol and it will automatically highlight any references in the current document.  You can navigate through the highlights by using CTRL+SHIFT+DOWN ARROW (forward) or CTRL+SHIFT+UP ARROW (reverse). 

 

 

Turning it off

So what if you don't like this feature?  Well, you can always turn it off by following the instructions below:

 

VB:  Go to Tools -> Options -> Text Editor -> Basic -> VB Specific.  Uncheck the "Enable highlighting of references and keywords" option.

image

 

C#:  Go to Tools -> Options -> Text Editor -> C#-> Advanced.  Uncheck the "Highlight references to symbol under cursor" option.

image