Huge solutions are very painful when it comes to navigating through them. It’s very time consuming to find a file with a code that we are searching for. VS provides some tools that can help us with that. Unfortunately they are either hard to learn or experience hiccups when they try to load UI. Because of that I never found an easy and seamless way inside vanilla VS that would let us help with code navigation.
Fortunately extensions library for VS is pretty big and there is a tool inside it that can help us with that. It’s name is DPack and provides very fast-loading and easy interface to navigate through our solution. It’s so fast that it does not draw my attention out of code during usage.
First, let’s start with 3 main functionalities that this extension provides. Every main functionality comes with a window that is used to navigate us to the object that we are searching for. After window opens we immediately have focus on input textbox and we are ready to write name of the file/field/type that we are searching for. After we write the query for interesting object we can navigate to it using arrow keys and prompt selection by using enter. Simple, fast and seamless experience.
It’s worth noting that we can use * wildcard in the query and it makes the whole searching process fast as hell.
Solution file browser ( ALT + U )
Used to search for the given file in solution. It has 3 modifiers:
- Show all files ( ALT + A ) – if disabled it will show only files that contains source code. If enabled all solution files will be used in search.
- Flatten names ( ALT + F ) – Show only filename if enabled. If disabled the relative path to the file will be shown.
- Search in folder names ( ALT + D ) – If enabled then relative path will be matched against query, otherwise only filename takes part in that.
You can also open this window while holding SHIFT. Then you will only search through opened files.
Code browser ( ALT + G )
Code browser is used to search through a file to find a field in the class that we are looking for. (It’s working also in C++ so it can be used to find methods in it. It’s a little clunky in C++ though and not always find all methods in the file). It has several search modifiers :
- We can specify the visibility of the field ( public/internal/protected/private ) that we are searching for.
- We can specify for what we are looking for – Methods/constructors/props+fields and more.
- We can flatten names – it will not display the classname in front of field name.
- Additionally it can display xml documentation taken from the comment below the search results.
We can open code browser in specialized mode where we will look only for given things. There are 4 specialized modes:
Method browser ( ALT + M )
We will look only through methods in given file. Very usefull and I use it very often.
Class browser ( ALT + C)
It will look only for classes inside file. Not handy in C# as we usually have only 1 class per file.
Property browser ( SHIFT + ALT + P )
We will look only through properties. Never used that.
Event browser ( SHIFT + ALT + E)
We will look only through events. Also never used that.
Solution browser ( ALT + S )
It’s very similar to Code Browser but it is not limited only to one file. It searches the whole solution to find given type definition (class, enum, struct, interface, delegate). I stumbled across it when writing this article. I think it will be very helpfull in future for me. Another good tool to have!
Problems with shared projects
DPack unfortunately is not compatible with everything. You cannot use code browser inside file which is part of shared project. That’s sad :(.
The features that I highlighted above are the most important features of DPack. Those are not only features though. Below I will write more about them.
It just shows how much code you wrote. Nice if you like numbers :P.
You can configure DPack in a way that it will automatically save the backup of your solution. I never used that because VS provides very good support for situations that would harm our solution ( power outage, VS crashes etc ).
Functionalities that does not deserve screenshot 😛
- Numbered bookmarks – you can create bookmarks that have numbers and be able to navigate to bookmark with given number.
- Surround with – You can select a piece of code and surround it with block of code (if/for/try…catch and more)
- Collapse all projects – Very useful.
- Open command prompt – open command prompt in the location of project/file.
- Copy/Paste references – available on Solution Explorer references context menu. It allows one to copy reference definitions to the clipboard.
I’ve only used DPack with C# and C++. In C# it worked perfectly (expect shared projects) and in C++ it sometimes did not find all methods.
Author says that it supports more project types though:
All features support C#, VB, C++ and Ruby In Steel based projects.
I hope you liked the post and you will try to download the extension. Beware – you can get very easilly addicted to this extension just like me :).
Thank you for reading! 🙂