次の方法で共有


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

Comments

  • Anonymous
    January 19, 2010
    Would love to keep following this blog but your current rss feed will probably stop me. Firstly it does not format well in google reader. Especially the kestroke video etc titles at top of each post. Secondly just being a snippet and not the full post in rss is a pain. Especially on a mobile device or iPod touch as your site is not mobile friendly.

  • Anonymous
    January 19, 2010
    Tim, There are few issues I am addressing with the blog but (hopefully) we can make the RSS feed more friendly for folks. Z

  • Anonymous
    January 24, 2010
    Just an update:  I've managed to get the comments and RSS feed fixed.  Let me know if any folks are having issues.

  • Anonymous
    April 15, 2010
    Reference Highlighting definitely is one of the feature i like in VS2010. I copy and paste the source code to Notepad++ previously to highlight and preview and see how many variables or functions to be changed. I don't need to do this redundant job in the future. With using the Zoom In and Out feature of VS2010 together, I am able to preview the impact to variables or functions to be changed.

  • Anonymous
    April 15, 2010
    Hey Cheong!  Glad you dig it!  I use this feature a LOT these days Z

  • Anonymous
    November 02, 2010
    Does anyone know which Font and Color setting designates this hightlight color? With a dark background my highlight is light gray on yellow text (unreadable)

  • Anonymous
    November 02, 2010
    It's "Highlight Reference" but only the background color is settable (possibly why I didn't find it the first pass)

  • Anonymous
    November 02, 2010
    Yeah I'm going to fix that in the next version and add some text around chaning the color.  Since I did this post I have had a ton of people ask about how to change the color on this feature.  

  • Anonymous
    October 15, 2012
    Is there an option for accelerate the highlight for showing faster? Thanks!