Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2008/2010: show method names in Find In Files results

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

like image 701
Maxim Gueivandov Avatar asked Feb 22 '11 13:02

Maxim Gueivandov


People also ask

How do I see all methods in Visual Studio?

The keyboard shortcut is Ctrl + Shift + E .

How do I search for text in all files in Visual Studio?

Search across files# VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term.

How do I search for a File in Visual Studio 2008?

Ctrl + Shift + D.

How do I search an entire solution in Visual Studio?

Ctrl + Shift + F – Find in Solution Sometimes you want to search across your entire solution. You can double-click each item in the “Find Results” window to navigate to that instance of the search term you searched for.


3 Answers

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

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

like image 130
Steve Dignan Avatar answered Sep 22 '22 14:09

Steve Dignan


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.

like image 28
Lieven Keersmaekers Avatar answered Sep 18 '22 14:09

Lieven Keersmaekers


Resharper does this

like image 25
Wil Avatar answered Sep 20 '22 14:09

Wil