Closing tabs to the left or the right within Visual Studio

One of the features I definitely miss within Visual Studio is the ability to close all tabs except a few you want to keep working on. If you are working within two files at the same time, but you have a lot of other files open (read a lot of other open tabs), you have to close the others one by one. You do have an option to speed up this process, which is available within the context menu of the tabs. It is called “Closing All But This”, but it closes also the other tabs you probably want to still be opened. So this means you still have to open again the ones you want to be open. Isn’t there another way to do this within Visual Studio?

Although Visual Studio doesn’t provide an solution for this to you, one of the great things of this IDE is that it’s functionality can be extended by the use of extensions. I found this very useful and simple extension called “Close Tabs To Right”, which adds the ability to close all tabs to the right or to the left seen from the tab you’ve currently selected. It is the same functionality as used for example in the Chrome web browser when managing tabs.

Now you can arrange the tabs you want to open in such a way they are next to each other. By simply going to the first tab within this set and select “Close Tabs to the Left” and going to the last one and select “Close Tabs to the Right”, you clean up all tabs you aren’t interested in at this moment.

Visual Studio is a great IDE and you will see that this kind of functionality more developers desire eventually end up within it. Until that is the case, you now can use this very handy extension to do the job.

Posted in Visual Studio by Bruno at June 16th, 2022.

Leave a Reply