Phate01
Phate01

Reputation: 1795

How to prevent VS Code to close opened files when opening another one

I don't use folders in VS Code. If I have an open (already saved) file, like:

open-file

Then I close VS Code, and either double click on a different file, or right-click onto a file and pick Open with Code, the previously opened file closes:

different-file-open

file-1-is-gone

How can I prevent this behaviour?

Upvotes: 1

Views: 2255

Answers (2)

frank_108
frank_108

Reputation: 719

Not so intuitive, but open Settings-> "Workbench > Editor: Enable Preview" and disable this option.

Further visible explanation:
"Controls whether opened editors show as preview editors. Preview editors do not stay open, are reused until explicitly set to be kept open (via double-click or editing), and show file names in italics."

Upvotes: 5

ax.
ax.

Reputation: 60167

Try setting window.restoreWindows to preserve (since 1.52 November 2020).

Upvotes: 1

Related Questions