Skip to content

Have a setting for maximum number open files (editors) #9872

Closed

Description

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!

Activity

  1. added
    feature-request
    ux
    on Jul 28, 2016
  2. stevencl commented on Jul 29, 2016

    @stevencl
    Member

    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.

  3. JeffreyATW commented on Jul 29, 2016

    @JeffreyATW
    Author

    Hi Steven,

    Great questions. First of all, I have this behavior in IntelliJ IDEA and Sublime Text (via the Zen Tabs plugin):

    screen shot 2016-07-29 at 9 30 17 am

    screen shot 2016-07-29 at 9 31 28 am

    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.

  4. stevencl commented on Jul 29, 2016

    @stevencl
    Member

    Exposing this as an extension seems like the right approach. I'm just not sure if we expose the necessary APIs to enable this.

  5. removed
    ux
    on Aug 6, 2016
  6. changed the title [-]Setting for maximum open files[/-] [+]Have a setting for maximum number open files (editors)[/+] on Aug 6, 2016
  7. mjesuele commented on Dec 21, 2016

    @mjesuele

    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?

  8. swhobbit commented on May 26, 2017

    @swhobbit

    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:

    • Open more editor buffers or
    • Prompt to save & close a buffer.
  9. 54 remaining items

  10. thomasesh commented on Oct 18, 2019

    @thomasesh

    I would also like this feature. How many people need to request this feature before it becomes a priority?

  11. daniil-emelin commented on Nov 11, 2019

    @daniil-emelin

    +1 for this feature. Really usefull

  12. JK-mber commented on Nov 12, 2019

    @JK-mber

    +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).

  13. bluesxman commented on Nov 13, 2019

    @bluesxman

    +1

  14. david-minaya commented on Dec 4, 2019

    @david-minaya

    +1

  15. bpasero commented on Dec 19, 2019

    @bpasero
    Contributor

    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.

    Peek 2019-12-19 13-06

    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/).

  16. bpasero commented on Dec 20, 2019

    @bpasero
    Contributor

    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.

  17. locked and limited conversation to collaborators on Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requeston-testplanworkbench-editors

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions