Tabs Studio home Order Download Documentation Blog* Support
Feature Overview User Guide Style Tab Grouping Add-ins

Tab Grouping

Introduction

By default tabs with the same name and from the same folder are grouped together. You can additionally group tabs by extension or by name prefix. You can allow tabs from different folders to group together. .NET regular expressions are used for grouping rules. See Regular Expression Language Elements MSDN page for .NET regular expressions details.

Tab title grouping

Tab title grouping settings

Each tab title is matched with Title grouping regex. Tabs that have exactly the same Group name are grouped together. Group names comparison is case sensitive until the Group titles ignoring case differences option is turned on. Default Title grouping regex (?<Name>(.*[/\\])?.+?)(?<Ext>\..+) matches the Name group as all symbols before the first dot after a path and matches the Ext group as the dot and all subsequent symbols. For example, tabs with titles Class1.cs, Class1.xaml and Class1.xaml.cs have the same Name Class1 and are grouped together.

Default Title grouping regex for SSMS is (?<Ext>.+?) - (?<Name>not connected)$|(?<Ext>.+?) - (?<Name>.+?) \(.+\)$|(?<Name>.+?) - (?<Ext>.+)

Customizing grouping regex allows different grouping options. Let's see some examples:

1. Grouping all extensions (default).

Grouping all extensions
(?<Name>(.*[/\\])?.+?)(?<Ext>\..+)

2. Explicit list of grouping extensions.

Only tabs with xaml and xaml.cs extensions are grouped.

Explicit list of grouping extensions
(?<Name>.+?)(?<Ext>\.(xaml|xaml.cs))$

3. Grouping by part of a name and an extension.

Titles with the same prefix and ended with _c.h or _i.h are grouped together along with default grouping by tab name.

Additional grouping by part of a name and an extension
(?<Name>.+?)(?<Ext>(_i\.h|_c\.h))$|(?<Name>.+?)(?<Ext>\..+)

4. Exclude an extension from grouping.

A tab with the cs extension is not grouped with other tabs.

Exclude extension from grouping
[^.]+\.(cs)$|(?<Name>.+?)(?<Ext>\..+)

5. Grouping by extension.

Tabs with the xaml extension are grouped together along with default grouping by tab name.

Additional grouping by extension
(?<Ext>.+?)(?<Name>\.xaml)$|(?<Name>.+?)(?<Ext>\..+)

6. Hiding dot from extensions.

Hide dot from extensions
(?<Name>.+?)\.(?<Ext>.+)

7. Grouping by a title prefix.

Tabs with the Window prefix are grouped together along with default grouping by tab name.

Additional grouping by title prefix
(?<Name>Window)(?<Ext>.+?\..+)|(?<Name>.+?)(?<Ext>\..+)

Document path grouping

Path grouping settings

By default tabs are grouped only if their associated Visual Studio documents are in the same folder. This is a good default as you don't want Window1.xaml from Project1 to be grouped with Window1.xaml.cs from Project2. But sometimes files that are really relevant can reside in different folders. For example, it would be nice to group default.js from the Scripts folder with default.htm from the HTML folder. It can be set up in Path Grouping settings.

Having two files c:\src\Window1.xaml and c:\src\Window1.xaml.cs matching algorithm removes common path from two files, appends '$' symbol to the end of both files and concatenates them. Resulting Window1.xaml$Window1.xaml.cs$ string is matched with Path grouping regex. If M named group matches the string then two files are combinable. If not, two full paths with two '$' symbols are concatenated (resulting in c:\src\Window1.xaml$c:\src\Window1.xaml.cs$ string) and again matched with Path grouping regex. If M named group matches the string then two files are combinable. If not, then files are not combinable.

If file paths are combinable then additional tab title grouping rules are checked. Two paths are lexicographically "sorted", it is guaranteed that concatenation is Project1\Window1.xaml$Project2\Window1.xaml.cs$ and not Project2\Window1.xaml.cs$Project1\Window1.xaml$.

Default Path grouping regex (?<M>^[^\\]+$) checks that there are no back slashes in first paths concatenation and thus allows files only from the same directory. If we try c:\Project1\Window1.xaml and c:\Project2\Window1.xaml.cs files, then first concatenation would be Project1\Window1.xaml$Project2\Window1.xaml.cs$ - it has two back slashes and would not match default regex.

1. Group files from the two specific folders.

Allow HTML\1033\*.htm files to be combinable with Scripts\1033\*.js files:

(?<M>^HTML.+?htm\$Scripts.+?js\$)|(?<M>^[^\\]+$)

2. Group files with the specific extension.

Allow *.htm files from any folder to be combinable with other files:

(?<M>htm\$)|(?<M>^[^\\]+$)

3. Group files from the specific folder.

Allow all files from the c:\Projects\4\4\HTML folder to be combinable with other files:

(?<M>c:\\Projects\\4\\4\\HTML)|(?<M>^[^\\]+$)

4. Group files from a subfolder.

Allow files from the subfolder to be combinable with files in upper directory (for example, c:\Projects\4\default.htm and c:\Projects\4\code\default.js):

(?<M>^[^\\]+\\[^\\]+$)|(?<M>^[^\\]+$)

5. Deny grouping for the specific extension.

Deny files with .Designer.cs extension to be combinable with other files:

(.+Designer\.cs\$)|(?<M>^[^\\]+$)

Corresponding files in different folders

As Visual Studio documents from different folders can be grouped together, the TabsStudio.Connect.OpenCorrespondingFile command and the Open context menu command can also find corresponding files in other folders (other than the current folder for the active document). Opened solution is scanned for files and those files that match grouping options are displayed in context menu:

Opening corresponding file from different folder