Open File Tabs in Visual Studio
26 Sep 2011, 6:42PM
Open file tabs in Visual Studio always annoy me. You can fit about 8 open files across the top on a large(ish) monitor before they disappear off the side and you have to access them from that little drop down icon.
Tabs in Visual Studio
Its not uncommon for me to have many more files open than this and to loose track of which file is which, especially drilling down (Go To Definition) through code, or working on a couple of bug fixes at once, e.g. 6 files currently open, lets just quickly fix this thing (which opens another 6 files and they all get mixed up together).
I have a pretty crap memory and can only keep track of about 4-6 files at a time in my head before I start to loose track of whats where. I think a few simple changes could greatly improve this. Its time to overhaul the tabs in Visual Studio...
- Group files by task (would have to be done manually)
- Group files by parent (e.g. F12, Go To Definition, could be done automatically)
- Graphically display groups/files (maybe a one line summary that expands out on mouseover)
- Ability to easily zoom (different levels of view) so that it scales well (e.g. can handle large numbers of files)
First a little digression. On this site I can start writing a blog post and mark it as pending, e.g. not visible to others. Unfortunetly I had a couple of bugs on the site that meant my unfinished post was visible via the RSS feed. This has now been fixed but not before I was given some feedback (thanks Tom!).
Tom pointed out that the Productivity Power Tools extension in VS2010 already provides a number of improvements to the tabs (as apparently others have issues with this). Namely, colouring tabs based on same project, scrolling left/right through tabs, vertical display of tabs and multiple lines of tabs amoung other things. I already had this installed and hadn't noticed much improvement however found a few extra settings under Tools->Options which allowed me to fine tune it more. Still they don't do what I had in mind so what was I thinking (indeed!)? I think a mock-up design is in order...
Mockup 1 (collapsed)
First off, please excuse my mockups. I can't be bothered spending time to do them properly so the colours are all wrong, layout spacing, etc could be improved and I've left many features off which I'll just note underneath, so its a first draft, providing some ideas.
In the mockup above you're looking at the tabs with 14 open files, it just displays the current file, with perhaps the file type (controller, view, etc) or the project its from to the left. The count of files is to the right.
After having done this I thought it may be better to switch to this view after 4 (or x) files were open, so 2 or 3 tabs would appear as they normally do (as its easy to manage these like this.
To view the rest of the files you mouse over (or click the down arrow) to get a view like below.
Mockup 2 (mouse over or click to expand)
Here you can see all open files (ignore the fact it doesn't add up to 14, it should!). They are in two groups (the boxes with titles) and a couple of free floating files in the middle. The user can group files and give them a name or they can be grouped automatically. So to end up with this lot...
The user wanted to debug an issue where saving (something) was creating duplicates. They opened up AboutController.cs and placed a break point. They then stepped through the code. As VS stepped into and opened up new files they were added to this graph with the relationships (arrows) shown. After finding the exception and stopping debugging the user clicked on this box and gave it a more sensible name from the automatic one provided. They then realised the expcetion was being caused by a bug in a JS file (so they opened up two JS files manually) and wasn't handled properly in some files in the DataAccess project so they opened up a couple of files in that which were grouped automatically.
- Easy to remember what files are related to your debugging|coding|current task.
- Can name, group or arrange files so visually (spatially) memorable (tabs all look the same)
- Can handle more than 8 files that 1 line of tabs does currently
- Lots of extra features you can add to this, e.g. zoom in on groups, zoom out (or scroll) to fit more files
- Alternative groupings (file type, controller+view, project, debugging path, go to definition path, etc)
- Can't see all tabs at a glance
- No single click to move to another file (only works for 8 files though)
- Can't flick back and forth between files to compare text