Tabs Studio Blog (organizing Visual Studio document tabs)

April 26, 2011

Grouping class and interface tabs

Filed under: Uncategorized — Tags: — Sergey Vlasov @ 11:33 am

It is a common convention to have interface file names started with ‘I’ (like IService.cs) and implementation files named the same excluding the first ‘I’ (like Service.cs). Would be nice to have them on one tab. Below is a solution copied from the recent discussion on the Tabs Studio mail list.

It is easy to group such files, the problem is how the result looks like. For example, the best title grouping regex for this task I can think
of is:

(?<Ext>I(?<Name>.+?)\.cs)|(?<Name>(.*[/\\])?.+?)(?<Ext>\..+)

It nicely groups two files as “Service .cs IService.cs”, but when IService.cs is the single file in a tab it will be displayed as “ServiceIService.cs” (and IInterface1.cs will be displayed as “Interface1IInterface1.cs”):

Grouping class and interface tabs using only title grouping regex

Grouping class and interface tabs using only title grouping regex

To improve interface tab name representation I’ve created the additional ITransform add-in to transform interface titles after grouping. With this add-in for the IService.cs and Service.cs pair a grouped tab will be “Service .cs Interface” and a single interface tab will remain “IService.cs”:

Grouping class and interface tabs using title grouping regex and the ITransform add-in

Grouping class and interface tabs using title grouping regex and the ITransform add-in

ITransform still requires setting up the special interface grouping regex first. Add the following title grouping regex section:

I(?<Name>[A-Z].+?)\.(?<Ext>.+)

For example, if you use default title grouping settings, your combined title grouping regex will be:

I(?<Name>[A-Z].+?)\.(?<Ext>.+)|(?<Name>(.*[/\\])?.+?)(?<Ext>\..+)

Download link: ITransform v1.0.0.

1 Comment

  1. ty, helpful post

    Comment by Jason — February 20, 2012 @ 10:05 pm


RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Blog at WordPress.com.