VS Code New Power Feature:Reopen bulk-closed Editor
What is the most desperate moment in a programmer’s life?
It’s not accidentally dropping the production database. It’s not forgetting to git commit before a major refactor. It’s when you are juggling a dozen files—frantically jumping between logic, styles, and config files—and your finger slips. You accidentally click “Close Others.”
Staring at the suddenly empty, barren wasteland of your tab bar, you take a deep breath and console yourself: “It’s fine. I’ll just hit Ctrl+Z to undo… oh wait, no, I need to hit Ctrl+Shift+T (Reopen Closed Editor) to bring them back.”
So, you press it once. One file returns. You press it again. A second file appears. You press it a third time. A third file is back…
If you just closed 15 files, congratulations. You now need to act like a human typewriter, mashing the shortcut a dozen times in a row, all while praying you don’t accidentally hit the wrong key combination and mess up the sequence. It feels exactly like dropping a stack of coins on the floor and having to squat down to pick them up one by one. It’s a massive waste of energy, and frankly, it’s terrible for your mental health.
Well, this “anti-human” experience has finally been slain by a recent VS Code update.
The VS Code team has completely overhauled the file history service: “Reopen Closed Editor” now supports bulk operations!
Simply put, if you use a destructive, screen-clearing action like “Close All” or “Close Others” to wipe out N files, you now only need to press Ctrl+Shift+T once. All N files will return to your screen in a group, in the exact order they were closed. It perfectly recreates your workspace from right before you slipped up.
Let’s take a look at the magic in action:
Get golang学习记’s stories in your inbox
Join Medium for free to get updates from this writer.
Use the shortcut Ctrl+K, M (Close All) to close everything:
Now it’s completely empty.
Then press Ctrl+Shift+T, and instantly, all the closed tabs are restored one by one:
🧠 How does it work under the hood? (The Programmer’s Magic)
It sounds simple, but the underlying implementation is quite delicate. How does the editor know if you “closed a bunch at once” versus “closed them one by one manually”?
The VS Code team introduced a brilliant mechanism: the Batch ID (batchId).
In the code, every file closure is tagged. If several files are closed within the same “synchronous turn,” they share the same batchId, meaning they are treated as a single "batch." Once the timeline moves to the next "microtask," the batch resets.
This allows the system to accurately distinguish between “bulk close” and “single close,” while preserving the original index and “sticky state” of each file at the lower level.
🎉 The End of “Memory Game” Overtime
Although the code change for this feature isn’t massive, the exponential boost it brings to daily developer happiness is huge. It rescues countless developers who have panicked and spammed shortcuts after accidentally hitting “Close All.”
Now, your undo capabilities finally match the speed of your clumsy fingers. No matter how many files you impulsively close, a single shortcut brings the entire army marching right back. After all, a programmer’s time should be spent writing bugs, not practicing the one-finger typing technique on keyboard shortcuts.










