Visual Studio Hidden Gems
Visual Studio is a powerful IDE with hundreds of productivity features to empower developers to do more, faster. I joined the Visual Studio team about a year ago, and here are some of the great things I’ve discovered. These are all in Visual Studio 2015, and some have been there for a few versions now so you’ll find them in previous versions of Visual Studio as well.
- Quick Launch (Ctrl+Q)
- Multi-language support
- C# interactive window (REPL)
- Navigate/GoTo (Ctrl+,)
- Peek to definition (Alt+F12)
- Preview tab
- Move code up or down (Alt+up or down arrow)
- Transparent pop-up boxes (hold the ctrl key)
- Version control info in status bar
- Diagnostic Tools Window
Quick Launch (Ctrl+Q)
Quick-Launch is an enhanced search box that sits in the title bar in the top-right corner. Not only will it let you find menu commands and options switches, it will also let you search files, settings, NuGet packages and a whole lot more! You can access it directly with the default keyboard shortcut Ctrl+Q.
Hovering over the items in the list provides useful additional information – such as shortcut keys or directory information.
Visual Studio supports many popular languages out of the box, but if yours is not on the list you can easily add it. With our new support for TextMate bundles, Visual Studio will bring any language to life. TextMate capabilities include new language syntax highlighting, basic IntelliSense and symbolic search.
To take advantage of TextMate capabilities, simply add a tmbundle to the user’s extensions directory ([userdir].vsextensions). There is no need to restart Visual Studio; the new language features will be available as soon as a relevant file is opened.
You can learn more about importing TextMate bundles here.
Some TextMate bundles have already been written. Here are some links to some popular ones:
- Scala bundle by Mads Kristensen
- Haskell bundle by Tim Sneath
- Php, Ruby, and lots more on the TextMate GitHub page
C# Interactive window (REPL)
This tool window lets you directly enter and run C# code. It is useful for quickly evaluating expressions or experimenting with code without the need to build and run a solution.
You can find the C# Interactive Window from the View menu, under “Other Windows”.
Navigate To is a smart search feature that allows you to easily navigate to any file, class, member, or symbol in the solution. To activate the feature, type Ctrl + Comma, which will display an input box docked in the top right corner of the editor window.
Peek to definition (Alt+F12)
This feature is a favorite among the Visual Studio editor team. It allows you to look at the definition of a method or variable in a small inline window inside the current editor. You can recursively navigate more definitions inside this window, which avoids leaving a trail of open files. You can navigate through the trail with tiny breadcrumbs that appear unobtrusively at the top of the peek window. Alt-F12 will activate this window. (Or if you have installed Productivity Power Tools, Control-Click GoToDefinition will default to using this peek window.)
Originally introduced as an aid to debugging, the Preview Tab, which appears on the right side of the document well, allows you to step into code without leaving a trail of files open at the end of the debugging session. It’s also convenient when navigating or searching through files as, by default, all new documents will open in the Preview Tab. Because the tab will only display one document, it keeps your code searching clutter free. If you want to keep any specific file open, pin it with the keep icon on the document tab and the file will join the other open documents on the left of the document well.
Move code up or down (Alt+Up/Down arrow)
The Move Code Up or Down feature enables code links or blocks to be easily reordered. To move code within a document, simply hold the Alt key and use the up and down arrows on the keyboard. The feature will move all lines that are selected, or if nothing is selected, it will move the line where the cursor is.
Transparent pop-up boxes (Hold the Ctrl key)
There’s lots of smart little pop-up boxes that offer context-specific actions or information, like IntelliSense and debugging DataTips. Sometimes the information in the pop-up box obscures important code on the lines below. If you want to view this code without losing the pop-up box, simply hold down the Ctrl key and the box will fade into the background allowing you to see the text underneath.
Version control info in status bar
Starting with Update 2 of Visual Studio 2015, you can now access version control information in the lower right-hand corner of the IDE. In the status bar you now see information such as the current branch, the number of files changed, and the number of pending commits. Clicking on the branch name opens a menu from which you can change branches or perform other version control functions.
Diagnostic Tools Window
The Diagnostic Tools window displays running memory and CPU usage while a program is in debug mode. This tool window opens automatically when you start debugging a .NET or C++ application. It lets you see how much CPU your code is using, the rate of growth of memory, and the kinds of objects that are being loaded.
For even deeper memory analysis, you can take memory snapshots at different points during execution and easily compare the difference in size between the two points, broken down into different types of objects. This can help you track down the kinds of objects that are growing, which helps to identify and solve memory leaks in your application.
For additional debugging tips, see the debugging tips and tricks post.
What are your favorite features and hidden gems of Visual Studio? I’d love to hear from you. Please comment below to share your thoughts.
|Justin Clareburt, Senior Program Manager, Visual Studio
Justin Clareburt is a Program Manager on the Visual Studio team, currently working in the Visual Studio extensibility space. He has over 20 years of Software Engineering experience having previously worked for several large organizations including Amazon, NewsCorp, Symantec, and the Australian Government. He brings to the team his expert knowledge of IDEs and a passion for creating the ultimate development experience.