[Update 6/21/2010]: Please go to this blog post where I describe even more configuration options that are available for this extension.
[Update 7/20/2010]: Updated changes made for version 10.0.10710.22 of the Pro Power Tools. Please take a look at the changelog.
For some time, the behavior of tabs in Visual Studio’s document well has been a source of frustration for some users. Whenever behavior is modified, some users are happy with the changes, while others are not. In an attempt to alleviate this problem I have created this extension, which provides configurable behavior for document tabs. It is available in the Visual Studio Gallery, as part of the Visual Studio 2010 Pro Power Tools. All configuration options are accessible by selecting Tools/Options…/Pro Power Tools/Document Tab Well. I encourage you to experiment with all available options, so you can find what works best for you.
This extension provides a fairly large feature list. To provide examples of what is possible, as well as a starting point for users to build their own configurations, we include several different presets that showcase the features available. They are the following:
Visual Studio 2008
|This preset mimics the behavior of Visual Studio 2008: The close button will be located in the document well, instead of in each individual tab.|
Visual Studio 2010
This preset mimics the behavior of Visual Studio 2010.
Web Browser: Scrollable tab well
|This preset mimics the behavior of commonly used web browsers. Tabs will be scrollable, icons and a close button will appear in each tab, and new tabs will be inserted on the right by default.|
Scrollable Tab Well: Sorted by project
This preset will have scrollable tabs, sort them and color them according to the project they belong to. This is useful if you regularly work in a solution with several projects.
Vertical Tab Well: Color coded and sorted by project
This preset is similar to the previous one, but additionally tabs are shown vertically. This allows showing more tabs than is normally possible when laid out horizontally.
Dynamic Tab Well: Removes tabs based on usage
This preset showcases a modification to standard Visual Studio 2010 behavior. Instead of hiding tabs that are on the right of the tab well when there is no more space available for them, it will hide the least recently used tab.
At the moment the extension provides the following configurable behavior features:
- Tab Well UI
- Tab Behavior
- Tab UI
- Color tabs according to their project or according to regular expressions
- Miscellaneous options that modify tab UI
- Show document/toolwindow icon in tab
- Show close button in tab
- Show pin button in unpinned tabs
- Modify dirty indicator style
- Modify minimum and maximum tab size
- Useful Commands
- Close all but pinned
Tab Well UI
By default, VS 2010 hides tabs when there is not enough space to display all those that are open. When a hidden tab needs to be visible, it is inserted at the beginning or the end of the tab well, according to preferences.
We provide the ability to instead scroll tabs, thus avoiding the need to change their position in the tab well whenever they become visible:
Note the arrow button on the right of the tab well. Clicking it will scroll the tabs one at a time. Keeping it pressed will continually scroll tabs until it is released.
The selected file has been scrolled to the left and is now not visible in the document well. In order to find out now what is the selected tab, we can simply press the document well drop down button:
Note that the selected tab appears in bold, and all hidden tabs appear in italics. Note that in this example the files in the drop down appear in visual order, instead of alphabetically sorted, which is the default behavior of VS 2010. This is configurable through the sorting options.
While the objective of LRU mode is to keep your most recently used tabs available, you might want to always have some documents easily accessible, no matter how often you access them. By pinning a tab, it will always be readily available.
Let’s say you have 4 files open in your project: Class1.cs, Class2.cs, Class3.cs and Program.cs. You might have something like the following image:
Notice that only 3 tabs are visible, as there is no space to show all of them. If you are mainly working on Program.cs, but have to constantly switch to the other tabs, there is a chance that the tab you mainly work on might become hidden. You will probably want to have this document always available. If a tab has to be hidden, it should be any of the others. When you hover the mouse pointer over a tab, you will notice that a pin button becomes visible. Pressing this button will pin the tab. Alternatively, press the right mouse button over the tab, in order to bring up its context menu, and select “Pin Tab” (This command is also available through the menu option Window/Pin Tab):
After selecting this command, the selected tab will become pinned. Notice that the tab has been brought to the front of the document well, and that it has a pin button to indicate its status. You can press this button to unpin the tab, or alternatively use either the tab’s context menu or the Window/Pin Tab menu option:
An important note: At the moment you cannot reorder pinned tabs. They will appear in the same order they had in the regular tab strip. If you attempt to move a pinned tab it will become a floating window.
Show Pinned Tabs in a Separate Row/Column
If you have several tabs pinned, you might soon run out of space in the document well to display unpinned tabs. The extension also provides an option that will use a separate row for showing only pinned tabs. If this option is turned on, our previous example will appear as follows:
Notice that now all our tabs are visible.
Show close button in tab well
This setting brings back the close button that was present in the document well in Visual Studio 2008. It will close the currently active tab in the document well.
This behavior extends the default VS 2010 fixed document well. Tabs that do not fit in the available space will be hidden, but instead of hiding the tab on the right or the left of the tab well (according to preferences), the tab that will be hidden is the least recently used tab. This makes commonly used tabs available.
In the following example we have 4 tabs open. The order in which they were shown is Class1.cs, Class2.cs, Class3.cs and Class4.cs.
When the space available is reduced, the least recently used tab (Class1.cs) is hidden. If we show the tab well drop down, we can confirm that Class3.cs has been hidden but still remains between Class2.cs and Class4.cs:
If we select Class1.cs from the drop down to make it visible, the tab that will be now hidden is Class2.cs:
Insert Tabs At Right
By default Visual Studio 2010 inserts new tabs to the left of the document well. Turning on this option will insert new tabs to the right instead. This option will have no effect if alphabetical sorting is turned on.
Please note this option is the same option that is present in Tools/Options…/Environment/Documents. It is presented in our options dialog as a convenience to our users.
Sort Tabs By Project
Documents that belong to the same project will be grouped together in the tab well. When alphabetical sorting is on, tabs will be sorted by project first and then by name. Having this option turned on and alphabetical sort off will allow tab reordering, but only within the project group.
Sort Tabs Alphabetically
Whenever a tab is added to the tab well it will be inserted in its corresponding alphabetically ordered position. Naturally, this precludes tab reordering.
Sort Drop Down Alphabetically
Default Visual Studio 2010 behavior is to display the document well drop down in alphabetical order. This option allows the dropdown to appear in the same order in which the tabs are laid out. This is particularly useful when Removal by Usage Order is turned on.
The extension provides the ability to set custom colors for document well tabs. Tabs can be colored according to:
- Regular Expressions
- Project they belong to
Select Tools/Options…/Environment/Document Tab Behavior/Color Coding to configure the colors that will be used for tabs according to the project they belong to, as well as regular expressions that will be used to color tabs. Matching for these regular expressions is case-insensitive.
We provide by default 15 colors for coloring tabs according to their project. If your solution has more than 15 projects, colors will be reused. You can always add more custom colors if you need to.
In the following example a red color is used for tabs that match “.*\.xaml$“, a blue color is used for tabs that match “.*\[design\].*“, and a green color is used for tabs that match “.*\.txt$“:
In the following example we can see a solution that contains 3 projects, with coloring according to project turned on. This feature is specially useful when used with “sort tabs by project”:
Miscellaneous Tab UI Options
The extension provides the following options for configuring the UI of individual tabs:
- Close button presence – Allows to configure whether the Close button appears in the tab or not.
- Dirty Indicator style – Allows to use a red dot or a disk icon as alternatives to the old text asterisk to indicate that a file is dirty.
- Show document/toolwindow icon: If selected, the icon corresponding to the current open document or toolwindow will be shown in the tab.
- Show pin button in unpinned tabs – When unchecked, will hide the pin button that appears on hover in unpinned tabs.
- Set minimum and maximum tab sizes – If you think tabs in VS are too big or too small, you can configure their maximum and minimum sizes here. Try making the minimum size the same as the maximum size, and you will have evenly spaced tabs:
Close all but pinned – This command (accessible through a document tab’s context menu) will close all document tabs that are not currently pinned.
- Added configuration option in UI for showing/hiding pin button in unpinned tabs
- Made selected tab use a color gradient by default in order to make it more distinguishable when using custom colors
- Added configurable colors for text in selected and unselected tabs, as in some instances the text was not readable
- Added command: “Close all but pinned”.
Tell Us What You Think
Please be sure to tell us your opinion about this extension and the features provided. There is a chance that the most-liked and/or useful features will be included in the next version of Visual Studio, and of course we would like to improve on any feature that our users don’t find useful. You will find a hyperlink in our options dialog which you can use to provide us with feedback. You can also add comments to this post directly, add/contribute to a discussion in the Visual Studio Gallery page for the Visual Studio 2010 Pro Power Tools, or send us feedback directly at docwell2010plus [at] microsoft.com.
Note: We have received reports of problems with this extension when the Tabs Studio plug-in is installed, as they both replace default behavior in the document tab well. Their latest version has been updated to work with the Pro Power Tools. As you might imagine, Tabs Studio will supercede almost all functionality of this extension.
However, if for some reason you cannot upgrade, you can still install the Pro Power Tools and disable this extension by running the following command (from a regular command prompt, or pressing Win+R):
reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\DialogPage\Microsoft.DocWellBehavior.GeneralOptions /v Behavior /t REG_SZ /d Default