2

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?

2 Answers 2

8

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

Sign up to request clarification or add additional context in comments.

1 Comment

"workbench.editor.enablePreview": false for the JSON inclined
1
+50

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

4 Comments

So easy but I hadn't found anything on the internet
where do we do it?
@Mandroid You could try Google "visual studio code settings", eg. code.visualstudio.com/docs/getstarted/settings
I actually did that, but nothing worked for me.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.