Reputation: 1111
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?
Upvotes: 14
Views: 4617
Reputation: 492
Auto Close Tabs extension should do what topic starter asked. Just installed for myself. Hard limit of 10 is not what I was looking for.
Upvotes: 0
Reputation: 1111
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.
Upvotes: 20
Reputation: 31257
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.
Upvotes: 1