Currently, tabs are combined only if their associated documents are in the same folder. This is a good default as you don’t want Window1 .xaml .xaml.cs from Project1 to be combined with Window1 .xaml .xaml.cs from Project2. But sometimes files that are really relevant can reside in different folders. For example, it would be nice to combine c:\Projects\4\4\Scripts\1033\default.js and c:\Projects\4\4\HTML\1033\default.htm files. It will be possible in the next version.
Paths matching is somewhat convoluted as I wanted to achieve maximal customizability. 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 paths matching regex. If M named group matches the string then two files are combinable. If not, two full paths with ‘$’ symbol are concatenated (resulting in c:\src\Window1.xaml$c:\src\Window1.xaml.cs$ string) and again matched with paths matching regex. If M named group matches the string then two files are combinable. If not, then files are not combinable. If files are combinable then additional tab title grouping rules are checked.
Default paths matching 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. Two file names are lexicographically “sorted”, it is guaranteed that concatenation would be Project1\Window1.xaml$Project2\Window1.xaml.cs$ and not Project2\Window1.xaml.cs$Project1\Window1.xaml$.
Let’s create rule that allows htm files from HTML folder to be combinable with js files in Scripts folder. For c:\Projects\4\4\Scripts\1033\default.js and c:\Projects\4\4\HTML\1033\default.htm first concatenation would be HTML\1033\default.htm$Scripts\1033\default.js$ and simple matching regex would be (?<M>^HTML.+?htm\$Scripts.+?js\$). As for other cases we want that default same folder restriction apply, we add our new rule before default one using OR symbol. The result is (?<M>^HTML.+?htm\$Scripts.+?js\$)|(?<M>^[^\\]+$).
We can solve htm files combining problem differently if there is only one project with htm files. In this case htm files can’t clash with htm files in other folders and simply allowing htm extension to be combinable with everything else would suffice – (?<M>htm\$)|(?<M>^[^\\]+$). Using absolute path in regex would achieve the same –
When one of two files is in a subfolder (for example, c:\Projects\4\default.htm and c:\Projects\4\code\default.js), regex matching single back slash would allow files to be combinable – (?<M>^[^\\]+\\[^\\]+$)|(?<M>^[^\\]+$).
It’s possible to create a rule that denies files combining. Use matching regex without M group for it. E.g., to deny files with .Designer.cs extension to be combinable and deny their appearance in corresponding files list use (.+Designer\.cs\$)|(?<M>^[^\\]+$) regex.