Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tidy Tabs, but for VSCode?

I really miss the "tidy tabs" extension that automatically closes tabs older than a certain age in Visual Studio. Is there any extension for VSCode with similar functionality?

like image 980
Guillochon Avatar asked Oct 23 '19 13:10

Guillochon


People also ask

How do I tidy up code in VS Code?

The code formatting is available in Visual Studio Code (VSCode) through the following shortcuts or key combinations: On Windows Shift + Alt + F. On macOS Shift + Option + F. On Linux Ctrl + Shift + I.

Can I group tabs in VS Code?

U can use Split Editor which is in the top right corner. You can drag files to the sides and open them in tabs. Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct.

How do you reduce tab space in VS Code?

Type “Indentation” into the search field then head to the “Editor: Tab Size” section. Replace the default space number with your preferred one: Your setting will be applied and reflected immediately. If this doesn't happen (it's a little lag sometimes), just reload or restart your VS Code.


Video Answer


2 Answers

As of version 1.42, we can now set a maximum number of tabs to leave open in each window, which effectively replicates tidy tabs.

Limit the number of open editors

There are new settings to limit the maximum number of editors that are open at the one time.

  • workbench.editor.limit.enabled: Enable this feature (off by default).
  • workbench.editor.limit.perEditorGroup: Whether to apply the limit per editor group or across all groups.
  • workbench.editor.limit.value: The maximum number of open editors (10 by default).

If enabled, VS Code will close the least recently used editor when you open a new editor.

like image 161
Guillochon Avatar answered Oct 24 '22 05:10

Guillochon


There is zentabs (inspired by zentabs for Sublime Text). It works but with some caveats:

It only closes an old tab when a new one is opened, so it won't help to clean up an existing tab-heavy session, but it should help to prevent it from growing any larger.

Due to VSCode extension limitations, it will briefly switch to any tab it decides to close. You may see this as a temporary flicker when you open a new tab.

As a result, it will sometimes bump the old closed window up to the top of the most-recently-used list on Cmd-P / Ctrl-P, which can be unintuitive.

It also asks you to disable the preview feature (opening unpinned tabs when stepping through searches). That is a shame because that VSCode feature let us do a lot of searching without cluttering our tabs too much.

Under some circumstances (when using search?) I end up with more tabs open that my prescribed limit.

If a file is unsaved when its tab is closed, VSCode will show a popup asking if you want to save the file.

like image 28
joeytwiddle Avatar answered Oct 24 '22 05:10

joeytwiddle