Contents
data/authors/Paul Logan.json

Pin those tabs in Visual Studio

Visual Studio Tabs

On a number of occassions, I find I that I have a ridiculous number of tabs open in Visual Studio. A width:100% of tabs across the screen, and the overflow dropdown reaching to the end of the screen.

Visual Stusio wth too many tabs open.
Tab City

It can start off quite innocently enough, with two or three open tabs that are related to the current task. A few modifications are made directly related to the task, then a few style changes, then a few refactorings… All of a sudden, it’s tab-city. There is a high correlation between finding myself in this positin and the amount of pressure I am under at the time.

Having too many tabs open at once leads to a number of problems for me:

  • Trying to quickly find the one you are after required more of my mental attention, distracting me from the task at hand.
  • Related to the previous point, my Ctrl-Tabbing between relevant tabs can get lost in the crowd.
  • An innate fear of closing tabs without knowing why I had them open in the fist place, prevents me from quickly closing them down.

Pinning and Unpinning Tabs

It’s a situation I like to avoid (using the procedure detailed in the section below), but when I do fall into that tar pit, I find that tab pinning allows me to continue with focused work until I have time to review the open tabs and perform a cull.

Ctrl P will toggle the currently active file as Pinned/Unpinned. This can also be done with the mouse by clicking the pin icon next to the filename when hovering over the tab.

The icon on a tab to pin it.
Pinning a tab with the mouse

Pinning tabs hoists those tabs into a new tab list directly above the existing one. This allows me to have a “work in progress” related tab list, along with a separate tab list that requires my attention after I am finished the task.

A new tab list of pinned tabs.
Pinned tabs for easier reference

Be careful though - without good self-discipline, you could end up with a pinned tab list as long as the unpinned.

Small and focused commits

Following good practice will help avoid this situation. In the example above, I should have performed at least three commits/check-ins:

  • Task specific modifications
  • Styling changes
  • Refactorings

This reduces the mental load required to fully comprehend the purpose of each commit, and offers you the opportunity to close down the tabs that are related to that commit.

Credits