The Best of Visual Studio 2010: How to use Reference Highlighting

Tips Search

If you like the tips then you'll love the book!

Order your copy today:
http://www.amazon.com/gp/product/0735649928

The Best of Visual Studio 2010: How to use Reference Highlighting

  • Comments 5

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

 

clip_image002

 

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.

clip_image004

 

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

clip_image006

  • Seems that this "feature" is the reason that MS required DevExpress to remove TabToNextReference from CodeRush Xpress.

    The MS feature IMO is far from superior. The highlighting is always on (causing distraction and eye strain) unless disabled in the options, at which point it's navigation feature is disabled also.

    Poor move MS :(

    I'm not affected by this because I have the full version of CodeRush, but several people have been complaining on twitter over this... They understandably thought that since CodeRush Xpress (Free Product) has supported this feature for over a year under VS2008, that it would continue to do so under VS2010.

    Why even bother to devote time to developing this "poor relation" and at the same time remove access to the better version.

    Kinda sucks

  • Very cool! RockScroll provided this in VS2005, and I liked it a lot - except for when it hilighted every semicolon in my file...glad this one is a little smarter than that.

    Unfortunately, C++ is again left out of the Cool Language Club.

  • @MarcT: Yeah, first thing I tried with VS2010... no support for this in C++.

    At least the Visual Assist X plugin has this feature in C++.

  • MarcT and googly  -- the product teams are aware of the mismatch between languages and have some things in the works to bring parity to all the languages in some fashion.

    Rory --

    I can't speak for the Visual Studio team but here are my thoughts on the subject:  We have always had one kick butt ecosystem for 3rd party add-ins.  I would even go so far as to say we are arguably the most developer-friendly company out there today.  With that said I personally believe, as an employee of Microsoft, that we should continually improve our products and add in features that we feel will be used by our customers.  

    One big reason I know we do this is that many large companies don't allow 3rd party add-ins.  So, as much as we love our ecosystem, sometimes the decision has been made to not use 3rd party solutions by our customers.  We can't just say "oh, well" and leave them with a "bare bones" Visual Studio experience so we add features to the product to enhance it.  I was just at a very large Oil and Gas company where this was exactly the case and they were very grateful for the new features like Reference Highlighting.  

    Just my .02

    Z

  • Any chance of ever seeing this in C++ land? The (3rd party & free) WordLight addin worked great with VC++ 2008 but there's no 2010 version.

Page 1 of 1 (5 items)
Leave a Comment
  • Please add 3 and 2 and type the answer here:
  • Post