7

I had a dream I could see constructor/method/property names along with search results (Visual Studio Find In Files feature), if applicable/available.

For example, if I searched for _dreamProvider in Sleep.cs, I would get something like that in Find Results window:

Sleep.cs(5): protected IDreamProvider _dreamProvider;

Sleep.cs(10): Sleep(IDreamProvider): _dreamProvider = dreamProvider;

Sleep.cs(68): BeginColdSweats(int): var d = _dreamProvider.Create(DreamTypes.Nightmare);

Sleep.cs(74): BeginSomniloquy(int, string): var d = _dreamProvider.Create(DreamTypes.Epic);

This could come quite handy if you want to see at a glance in which contexts a code fragment (not only a particular symbol) is used, specifically during analysis of legacy code and/or refactoring.

I could not find any VS addin which would bring that code structure awareness in search results. And there is no specific customization registry flag for that.

Do you know of any VS addins, or some kind of hacks in order to achieve that or something similar?

Thanks

Maxim Gueivandov
  • 2,370
  • 1
  • 20
  • 33

3 Answers3

4

Have you tried CTRL+,

Searching and Navigating Code in Visual Studio 2010

Navigate To (Ctrl+comma), new for Visual Studio 2010, is a powerful way to search, especially when you’re not sure exactly what you’re looking for. It helps you locate items in your code by using "fuzzy" search capabilities. For example, if you type Foo Bar instead of FooBar, Navigate To will still return useful results. It’s a smart, incremental search that refines as you type and will find any symbols (e.g. file, type, and member names) matching your search terms.

Lieven Keersmaekers
  • 57,207
  • 13
  • 112
  • 146
4

ReSharper offers this type of "Find Usages..." functionality:

http://www.jetbrains.com/resharper/documentation/help20/UsageSearch/findResultsWindow.html

Steve Dignan
  • 8,230
  • 6
  • 30
  • 34
  • does it allow to search any text fragment, not only code symbols (like SolutionBase, IsTestShell or FormatSettings as seen on screenshots)? – Maxim Gueivandov Feb 22 '11 at 14:23
  • Yes it does. You can choose an option "Find Usages Advanced..." from the VS context menu (if ReSharper is installed, of course) where you can specify "Textual occurrences" as one of the "Find" options. – Steve Dignan Feb 22 '11 at 15:04
2

Resharper does this

Wil
  • 2,328
  • 2
  • 20
  • 27