Winston Smith
Winston Smith

Reputation: 21932

Highlight all references to X?

The Eclipse IDE has a neat little feature that I really miss in Visual Studio.

If I place the cursor on a variable or method name, the IDE will automatically highlight all references to it in the current document within the relevant scope.

I can't seem to find an option to turn on similar behaviour in VS2008 or Resharper 4. I know VS has a Find Usages function, but I'd like to do it automatically on the fly.

Does anyone know of a free addin which will add this functionality?

Upvotes: 5

Views: 2567

Answers (5)

NoodleFolk
NoodleFolk

Reputation: 2049

Microsoft published a tool that sort of does what you want. Some of my favourite features:

  • Enhanced Scrollbar
  • Auto Brace Completion
  • Ctrl + Click Go To Definition
  • Open Containing Folder and the list goes on.

For Visual Studio 2010 and for Visual Studio 2012

Upvotes: 0

HugoRune
HugoRune

Reputation: 13829

Visual Studio 2010 has sorta implemented this, but the feature is somewhat lacking. There is a non-configurable delay between placing the cursor and highlighting.

The RockScroll Addin is not available for Visual Studio 2010 and above.

As a replacement, the free "Highlight all occurrences of selected word" plugin will highlight all occurences of the selected string after a doubleclick. There is no delay as with the native vs2010 highlighter.

It is string-based, which means it works inside comments and string literals.

Upvotes: 0

Matt David
Matt David

Reputation: 723

I know you mentioned ReSharper, but CodeRush has a nice references window that you can dock and let it search for things on-the-fly or on demand. As a bonus, you can select each usage and it will show you the context surrounding the usage. It also works for methods.

I mentioned CodeRush since they have an express edition, which looks like it includes that feature, but I haven't tried that edition.

Upvotes: 1

Slapout
Slapout

Reputation: 3809

There is an add-in for Visual Studio that will do something similar called RockScroll. When you double click on something, it will highlight all occurrences of the item you double clicked. It also changes the vertical scrollbar to a "syntax highlighted thumbnail view" showing an overview of where the item occurs in the file.

Upvotes: 2

Bernhard Hofmann
Bernhard Hofmann

Reputation: 10411

If you're using ReSharper, you can highlight the usages in the file with Shift-Alt-F11. Place your cursor on the variable you want to find usages of, and press the Shift-Alt-F11 combination.

Upvotes: 4

Related Questions