Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JeffreyATW opened this issue Jul 27, 2016 · 63 comments
Closed

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

JeffreyATW opened this issue Jul 27, 2016 · 63 comments
Assignees
Labels
feature-request Request for new features or functionality on-testplan workbench-editors Managing of editor widgets in workbench window
Milestone

Comments

@JeffreyATW
Copy link

JeffreyATW commented Jul 27, 2016

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!

@kieferrm kieferrm added feature-request Request for new features or functionality workbench ux User experience issues labels Jul 28, 2016
@stevencl
Copy link
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.

@JeffreyATW
Copy link
Author

JeffreyATW commented 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):

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.

@stevencl
Copy link
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.

@bpasero bpasero removed the ux User experience issues label Aug 6, 2016
@bpasero bpasero added this to the Backlog milestone Aug 6, 2016
@bpasero bpasero changed the title Setting for maximum open files Have a setting for maximum number open files (editors) Aug 6, 2016
@bpasero bpasero removed their assignment Aug 17, 2016
@mjesuele
Copy link

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
Copy link

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.

@well1791
Copy link

well1791 commented Jun 23, 2017

Actually, this is a good feature, for minimal and productive workflow.

Usually, I limit tabs to only 1 file (and I'm missing this feature in vscode)

  • Whenever I change to a new file then auto-save is enabled to save the old one
  • If I want to reopen the last closed file, use cmd+shift+tab
  • And to switch between recent files, cmd+e recent-files helps for that.

@Pyrolistical
Copy link

Pyrolistical commented Jul 18, 2017

The UX of side scrolling many tabs is worst than disappearing tabs. Just remove the oldest unmodified tab, and with auto saving, this means you can remove the oldest tab.

I think a reasonable default is to auto close tabs if there isn't enough room in the tab bar to add more.

@HugoMatilla
Copy link

Hi @stevencl, about your comment

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

is there (or will be) in the API anything to close a tab/file?

Thank you very much in advance 💯

@stevencl
Copy link
Member

@jrieken / @bpasero - is there any API or setting that would support this, now or in the future?

@jrieken
Copy link
Member

jrieken commented Aug 30, 2017

Yeah, see #15178 for exposing the tab-model to extensions

@HugoMatilla
Copy link

Thank you very much @stevencl and @jrieken 🥇

@nachocab
Copy link

So looking forward to this feature. I miss ZenTabs so much 😅

@bpasero bpasero added workbench-editors Managing of editor widgets in workbench window and removed workbench labels Nov 16, 2017
@bpasero bpasero removed this from the Backlog milestone Nov 17, 2017
@Pikktee
Copy link

Pikktee commented Jan 13, 2018

+1 for this feature. I also miss ZenTabs from Sublime!

@williamluke4
Copy link

@mkq
Copy link

mkq commented Jul 26, 2019

stevencl commented on 29 Jul 2016

  • Does the threshold change if the size of the window changes (since a different number of tabs would be visible)?

I wouldn't close tabs based on window width. It would be annoying if a temporary width change closed files, e.g. moving a fullscreen window to a different monitor might suffice (at least when using keyboard shortcuts), I guess.

  • 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.

If closed files stayed in the back navigation list, navigating back to the relevant file (which I'd use anyway in such a situation) should reopen it. (However, a forward / back menu to do multiple steps at once would help.)

@taiya
Copy link

taiya commented Jul 27, 2019

https://marketplace.visualstudio.com/items?itemName=hitode909.zentabs

This works pretty well, thanks @williamluke4
However agree with the above that this should be a built-in feature.. so core!

@ctwhome
Copy link

ctwhome commented Aug 7, 2019

Hi, zentabs is oke, but it keeps opened all the files. is there a way to keep open only the file it is on the current tab or split view? So I have one view, the maximum number of opened files should be 1, if I have a split of two windows, then 2... and show on. My major concern is that is when I close the split view.. it doesn't close it because it starts showing all kind of recent files...

@clamydo
Copy link

clamydo commented Aug 7, 2019

Also zentabs is not the smoothest experience. At least for me, flickering occurs when closing a tab.

@williamluke4
Copy link

Yeah I've uninstalled it

@williamluke4
Copy link

@bpasero Any chance we could get your input here? This has now started to crash my extension host.

Error: EMFILE: too many open files, uv_resident_set_memory

@bpasero
Copy link
Member

bpasero commented Sep 10, 2019

@williamluke4 I am sorry to hear you are having troubles as reported, can we extract this particular issue into a new issue. Ideally with exact steps how to reproduce. Thanks!

@williamluke4
Copy link

Hi @bpasero, Thanks for your reply.
I do not feel that it would require a separate issue as it seems that having the ability to set the maximum number of open files would mitigate the issue.
If you don't feel that would be the case then I would be happy to create another issue.

@nguyentamgm
Copy link

Hi everyone, I want this toooooo! Always set it to 3 tabs maximum from other IDE. I'm switching from PHPStorm to VSCode just because my PS license going to expire (LOL) & VSCode is great

@mfdorst
Copy link

mfdorst commented Oct 6, 2019

All we need is the ability for an extension to close arbitrary tabs. Even just the ability to close the oldest (most un-recently used) tab would probably be good enough.

How have we been asking for this since 2016 and it still hasn't happened? This is a really important feature for a lot of people.

@enatividad
Copy link

please

@thomasesh
Copy link

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

@bpasero bpasero added this to the Backlog milestone Oct 24, 2019
@daniil-emelin
Copy link

+1 for this feature. Really usefull

@JK-mber
Copy link

JK-mber commented 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
Copy link

+1

1 similar comment
@david-minaya
Copy link

+1

@bpasero
Copy link
Member

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

@bpasero
Copy link
Member

bpasero commented 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.

@bpasero bpasero closed this as completed Dec 20, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-testplan workbench-editors Managing of editor widgets in workbench window
Projects
None yet
Development

No branches or pull requests