Visual Studio 11 Developer Preview: Preview Tab


[ NOTE:  This post has been depricated.  The new, updated post can be found here:]


Shortcut: CTRL + ALT + Home (promote); ALT (do not preview in Solution Explorer)

Versions: Visual Studio 11 Developer Preview


Make sure to get your copy of the new book from Sara and me:

Coding Faster: Getting More Productive with Microsoft Visual Studio


Note: As always with pre-release software, some of the features may not make it into the final version or may change significantly before RTM. Also, although I will only show features that are publicly available, I may be using a slightly older or newer version of the build than you are so there may be slight differences in the feature set I show and the feature set you currently have.



Preview Tab: Common Scenarios

We all explore code and need move quickly between files. In prior versions of Visual Studio you had to open a file to look at the contents which often resulted in many open files (tabs) after debugging or reviewing some code. The Preview Tab eliminates the need to open certain files when browsing code. Most likely you’ll first encounter the Preview Tab when you are looking at files with Solution Explorer. When you click on a supported file, you will see the contents of that file in the new preview tab:



The point of the preview tab is to let you view the contents of a file without actually opening up a new tab in the tab well. As you look at different files the preview tab only shows the contents of the file you are currently on. This keeps the environment from getting cluttered with open tabs and allows you to focus on only those files that are interesting to you. Solution Explorer isn’t the only place you can use the preview feature. It turns up in several situations where you might need to look at file content. For example, when using Find (CTRL + F) to locate information you will see the preview tab:





Promoting Previews

At some point you may decide to promote the preview to an opened tab in the Tab Well so you can do additional work on the file. There are a few ways you can make this happen.


Click the Promote button

Just click the promote button on the preview and it will open up a tab for that file:




With the cursor in the file, just press CTRL + ALT + HOME to open a tab for the file you are currently viewing.


Change the File

While previewing a file, if you make any change to the file it will automatically be promoted to an open tab so that you can make additional changes and do any other actions you need to perform.




Turning Preview Off

To see the options you have for using the preview feature, just type preview in Quick Launch (CTRL + ` [back quote]) and click Environment -> Tabs and Windows:



This will take you to Tools | Options | Environment | Tabs and Windows:




To turn off the preview feature uncheck the Allow New Files to be Opened in the Preview Tab option. Also notice you can decide if a single click open the files in the preview and/ or use ALT to prevent a file from being previewed when you click on it. While I see the value in using ALT to prevent preview from happening; I haven’t yet found any reason for turning off the single-click option as it, in effect, makes the feature unusable.





The Preview Tab is one of the great new additions to the Visual Studio IDE that, I believe, will be an exceptional productivity enhancement. Try it yourself and let me know what you think.