You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Have a setting for maximum number open files (editors) #9872
I've noticed that there is no way to limit the number of total files open at once. There is an explorer.openEditors.visible option, but that seems to limit the height of the "Open Editors" pane (which I don't use - I use tabs instead).
To keep my workspace focused, I like my editor to automatically close files over a set threshold that I have least recently viewed. Obviously, it wouldn't close files that have unsaved changes (or it would prompt you prior to trying to close them).
Does this sound like a reasonable request? Please let me know!
Reacted by Patrick Lienau, normalser, Matt Jesuele, Justin John, Piotr Wasilewski, Artem Chernyak, Thibaut, Blake McCool, Rowell Sotto, jrodgut-sg and 178 more
Reacted by miaLDN
Reacted by udet-at, netpedro.com, Dorian Marchal, Wojciech, Kodai Nakamura, Miki, Alex, Sal Abuewilly, ReadyResponders, Maxime Plante and 23 more
Thanks for the suggestion. I've not seen this behaviour in other editors. I have to admit I'm a bit wary of anything that automatically closes an editor without any intervention from the user. It feels like it could open up a bunch of other UX issues. For example:
How does the user know that the file has been closed?
Does the threshold change if the size of the window changes (since a different number of tabs would be visible)?
Is least recently viewed always the best way to determine which files to close?
For example, I could be on a hunt for something and start with one file open then open a sequence of files when I view definitions and references. Eventually I might reach the thing I am looking for but only after exceeding the threshold. The file I started the search from is very relevant but it would have been the least recently viewed. It doesn't seem right to close it since I would want to go back to it, now that I have found the information I need.
Great questions. First of all, I have this behavior in IntelliJ IDEA and Sublime Text (via the Zen Tabs plugin):
As for your questions:
The tabs usually close silently without any notification.
The threshold, as you can see from the settings, is usually fixed, but I like the idea of changing it dynamically with the intent to prevent scrolling.
IDEA lets you choose between "less frequently used" and "non-modified" files. I don't know how Zen Tabs chooses.
I think your concern about navigating through a number of files and then returning to the initial file is valid, but after a certain point, you're going to have to scroll through your tab bar to get back to where you started - and I'd much prefer just re-opening the file with ⌘+P or similar.
Reacted by netpedro.com, Adrian Florescu, Dorian Marchal, Ruslan Abramov, andyl, Anton Moiseev, Dom Vin, Chris Feist, Alexander Ionov, Ivan Krasilnikau and 26 more
Any word on this? Zentabs is one of the only things I miss from Atom. (Love VS Code!)
Where would be some relevant parts of the project to take a look at?
Reacted by Enguerrand Leclerc, Sterling Camden, Rob Felix, Moncef Hassein-bey, Justin John, Piotr Wasilewski, Roman Khitin, Artem Chernyak, Philippe Collin, SafariMonkey and 43 more
I've searched multiple times for a way to do this - my workflow in Atom, and Sublime before that, was to have a shortcut to close old tabs so only the N newest tabs remain (but no automatically closing tabs).
I pushed a first version of this with the following new settings (off by default):
workbench.editor.limit.enabled [default: false]: Controls if the number of opened editors should be limited or not. When enabled, less recently used editors that are not dirty will close to make space for newly opening editors.
workbench.editor.limit.value: [default: 10]: Controls the maximum number of opened editors. Use the workbench.editor.limit.perEditorGroup setting to control this limit per editor group or across all groups.
workbench.editor.limit.perEditorGroup [default: false]: Controls if the limit of maximum opened editors should apply per editor group or across all editor groups.
The way it works currently is that dirty editors will never be closed but they do count into the maximum number of editors. So if you have 10 editors dirty opened and open the 11th, this editor will get replaced with other editors opening until one of the other 10 editors are saved.
Reacted by Chandrajeet Maurya, Jessie Gonzalez, Adamansky Anton, Василий, Nick Breaton, Nikita Shilnikov, Vardan Pogosian, Idan Pazi, Tam Nguyen, Shafrazi Shiffa and 4 more
Reacted by George Payne, Jiayu Chen, Jessie Gonzalez, Tan Jay Jun, Adamansky Anton, Jeffrey Carl Faden, Ian Suda, Paul Landers, Alex Joyner, David Minaya and 12 more
Reacted by Chandrajeet Maurya, Jessie Gonzalez, clamydo, FERNANDO TORRES, Tam Nguyen and Shafrazi Shiffa
Reacted by Chandrajeet Maurya, Jessie Gonzalez and Tam Nguyen
I am closing this issue and suggest to report bugs or additional feature requests as separate issues. Our repository will open again for business later today and the change will be released in insiders for people to try out later today as well.
Activity
stevencl commentedon Jul 29, 2016
Thanks for the suggestion. I've not seen this behaviour in other editors. I have to admit I'm a bit wary of anything that automatically closes an editor without any intervention from the user. It feels like it could open up a bunch of other UX issues. For example:
For example, I could be on a hunt for something and start with one file open then open a sequence of files when I view definitions and references. Eventually I might reach the thing I am looking for but only after exceeding the threshold. The file I started the search from is very relevant but it would have been the least recently viewed. It doesn't seem right to close it since I would want to go back to it, now that I have found the information I need.
JeffreyATW commentedon Jul 29, 2016
Hi Steven,
Great questions. First of all, I have this behavior in IntelliJ IDEA and Sublime Text (via the Zen Tabs plugin):
As for your questions:
I think your concern about navigating through a number of files and then returning to the initial file is valid, but after a certain point, you're going to have to scroll through your tab bar to get back to where you started - and I'd much prefer just re-opening the file with ⌘+P or similar.
stevencl commentedon Jul 29, 2016
Exposing this as an extension seems like the right approach. I'm just not sure if we expose the necessary APIs to enable this.
[-]Setting for maximum open files[/-][+]Have a setting for maximum number open files (editors)[/+]mjesuele commentedon Dec 21, 2016
Any word on this? Zentabs is one of the only things I miss from Atom. (Love VS Code!)
Where would be some relevant parts of the project to take a look at?
swhobbit commentedon May 26, 2017
Limiting number of the clean editors open is function which has existed in Eclipse for time immortal (or more precisely, as long I've been using it).
The behavior if there are no editors are clean is configurable:
54 remaining items
thomasesh commentedon Oct 18, 2019
I would also like this feature. How many people need to request this feature before it becomes a priority?
daniil-emelin commentedon Nov 11, 2019
+1 for this feature. Really usefull
JK-mber commentedon Nov 12, 2019
+1
I've searched multiple times for a way to do this - my workflow in Atom, and Sublime before that, was to have a shortcut to close old tabs so only the N newest tabs remain (but no automatically closing tabs).
bluesxman commentedon Nov 13, 2019
+1
david-minaya commentedon Dec 4, 2019
+1
Have a setting for maximum number open files (editors) for #9872
bpasero commentedon Dec 19, 2019
I pushed a first version of this with the following new settings (off by default):
workbench.editor.limit.enabled[default:false]: Controls if the number of opened editors should be limited or not. When enabled, less recently used editors that are not dirty will close to make space for newly opening editors.workbench.editor.limit.value: [default:10]: Controls the maximum number of opened editors. Use theworkbench.editor.limit.perEditorGroupsetting to control this limit per editor group or across all groups.workbench.editor.limit.perEditorGroup[default:false]: Controls if the limit of maximum opened editors should apply per editor group or across all editor groups.The way it works currently is that dirty editors will never be closed but they do count into the maximum number of editors. So if you have 10 editors dirty opened and open the 11th, this editor will get replaced with other editors opening until one of the other 10 editors are saved.
Happy for feedback when this is available generally in our insiders build (https://code.visualstudio.com/insiders/).
bpasero commentedon Dec 20, 2019
I am closing this issue and suggest to report bugs or additional feature requests as separate issues. Our repository will open again for business later today and the change will be released in insiders for people to try out later today as well.