VsCode: how to avoid to open more than one file for each editor group? - visual-studio-code

To be more productive on my work, I'd like to have the possibility to open only one file for each editor group.
My purpose is to avoid to have 20 or more tabs opened at the and of the day and lost time searching for the right opened file in that list.
I'd like to focus the desired editor group (CMD + 1, 2, 3, 4) and open a new file (CMD + p). If a file is opened in the selected editor group, I'd like to have the possibility to save it and replace it with the new one.
I think that to have at most 4 file opened at the same time is perfect and this forces me to be more focused on the code, instead of search for a file in a very big list of opened tabs.

If you wish to restrict the number of opened tabs, or close tabs automatically depending upon the threshold of an opened tab in the workspace
No more plugin needed: the next VSCode 1.42 (Q1 2020) will have a new setting for limiting 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.
Below you can see the behavior when the limit is set to 3:
As noted in the comments by Timo: see "User Interface/ Editor Groups".
VSCode 1.67 (Apr. 2022) will propose
workbench.editor.limit.excludeDirty
Controls if the maximum number of opened editors should exclude dirty editors for counting towards the configured limit.
See issue 144309 and PR 144545.

If you wish to restrict the number of opened tabs, or close tabs automatically depending upon the threshold of an opened tab in the workspace.
Zen Tabs plugin might be the solution.
Your requirements :
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.
Zen Tabs is the extension you are looking for.
You can get additional info here.

Related

VS Code: With "CSS Mirror Editing" enabled in the Edge DevTools Extension and all editor groups locked, DevTools opens a new tab anyway

As the title says, when I change the CSS in DevTools, DevTools will open the css file in a new tab in Editor Group 1. It doesn't respect that this group is locked. I doesn't matter if I already have the file open in another Editor Group. It will always open a new tab in Editor Group 1.
The only time it doesn't open a new tab is if the css file is already open in Editor Group 1. If there a multiple tabs open in Editor Group 1, it will switch tabs to the css file.
So my problem is about window arrangement. I'm pretty new to VS Code but it seems like Editor Group numbers are based on the actual position. So I can't have Editor Group 1 showing the css file in the bottom right quadrant of the screen for example, because that would be Editor Group 4.
Is anyone else experiencing this?
I've tried digging through the VS Code settings related to editors and groups and found nothing of use. I've tried locking groups which isn't respected by the CSS Mirror Editing functionality, and will open a new tab in a locked group anyway. And I've looked through the Edge DevTools settings and I haven't seen any settings that talk about editors or groups.

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

Can Eclipse hold multiple different 'Compare' windows at the same time?

Like in the topic - is there any default way or any plugin that lets you have multiple 'Compare' windows open and active at the same time? I find it very frustrating that while doing changes to few files at the same time, I can't have active 'Compare' window for each of them, to see my changes/original code.
I would use Window -> New Window, rerun Team -> Show History and then compare another file.
A compare window in Eclipse is placed inside a normal editor tab.
You can have several editor tabs, including compare windows, visible at the same time. To do this just drag the editor tab (the one on the top with the editor name) to somewhere inside the editor area. The editor area will get split in two, each one displaying one editor.
This works with more than two editors also.
If you find that you need more space for the compare windows because other views take up much space you can maximize the editor area by pressing Ctrl+M while the editor area has focus.
Example:
Go to preferences -> team -> General Team Preferences. For me, the "Reuse open compare editors when opening comparisons" was already checked by default. I unchecked that and now I can have multiple file comparison windows open! (I'm using Eclipse Oxygen.3a -- 4.7.3a)

Eclipse auto close unused tabs

I have this habit of looking into other source codes from different projects for a reference. However, this leads to cumulative issue of forgetting to close the tab. I may have around 100 source tabs opened up (which is related to current and unrelated projects).
Is there a preference or plugin to auto close unused tabs after certain idle period? Like say after 10 minutes of inactivity.
The issue I face is when I'm in a hurry the tabs pile up and consume lots of memory, and not to mention if you have opened up Chrome for reading documentation and StackOverflow digging. Finally slows down my system due to swap usage.
[ Update ]
Found some interesting tips from this link
So how to quickly close unnecessary tabs in Eclipse?
Closing tabs one by one by clicking on the tab with a wheel/MMB. It’s faster than clicking LMB on a small cross icon, because it’s enough to click anywhere on a surface of a tab. I do it when there is few tabs to close (like one or two) and tabs that I want to closearen’t hidden.
Closing current tab using Ctrl+W keystroke. I do when tab to be closed happens to be an active tab. And when I just visited some class to check something and I won’t need to revisit it anymore soon.
Using Ctrl+Shift+W keystroke to close all tabs. I do it when I’m starting completely new tasks or at the moment I’m too lazy for 4 or 5. :-) .
Right-clicking on the tab that should stay open and selecting “Close all others” option. It’s handy in cases where only one editor is significant and others are a result of code exploration.
This is my favourite one: Using ctrl+shift+e keystroke to display “Open editors” dialog, selecting editors that should stay open (with ctrl pressed), “invert selection”, “close all selected” and finally hitting esc to close the dialog. It may seem complex but trust me it isn’t. It took me only a few attempts to learn how to use this trick effectively. I often do it when I forgot to close tabs for a while and I have a lot of tabs open and what’s worse, some of tabs aren’t visible on tabs bar (arrow icon needs to be clicked to see the hidden tabs).
There is a feature General > Editors > Close editors automatically which closes unused editors automatically.
There is no auto-close feature/plug-in in eclipse. Because user opened all the editors manually and he/she has to close these on their wishes but not automatically.
For your problem I suggest you to use Mylyn plug-in so that you can stick to only those editors(context) you frequent used, hiding all other editors, packages, classes etc.
Also there is an eclipse plug-in for pinning editors refer my answer for the post Eclipse - How to pin editor tabs?

Changing number of rows of tabs visible in NetBeans

There are times when I have a decent number of source files open at once. Is there a way to change the number of rows of tabs that are visible while working in NetBeans?
Also, I have a dual monitor setup here. I could span NetBeans across the two monitors if it were possible to have multiple NetBeans editor windows open at the same time. This is something that I use in the VS Express editions. I tend to group my source files on one monitor and the designer windows in the other. Can I do this in NetBeans?
for versions 8.0.2+:
Tools -> Options -> Appearance -> Document Tabs -> Multi-row tabs
You can also maximum row count if you wish (the default is 3).
There are 2 way's I have done this:
Drag a tab from the editor panel to the side of the editor window until the red outline shows a rectangle running from top to bottom. Drop the tab there and you get another editor pane. Opening from Project or Files will still use the original panel, but you can drag tabs between the panels.
Right click on a tab and choose "Undock Window". This will create a top-level window independent of the main NB window.
When you create files with keyboard shortcuts (eg, Ctrl-N for new file) they will open in the current panel. Likewise, navigating to other files (eg, Ctrl-Shift-B for go to source).
It's not perfect though. Some keyboard actions will dump you back to the main window, then it's Alt-Tab or fiddle with the mouse to get back.
You can control the number of rows of Tabs in Netbeans by going to (on Windows):
Tools>Options>Miscellaneous>Windows> check the multi-row tabs checkbox.
See the maximum row count with the radio button and set your number.