editor

How to keep tabs in VS Code all the time


If you open a file with the menu "open with -> Visual Studio Code" when VS Code is was closed, then the previously opened tabs are lost, how can you make them stay open?


Solution

  • Usually, VS Code will retain your tabs if you close it properly.

    I've looked and can't seem to find a specific setting, so I'm assuming this is the issue:

    1. Either you're not closing Code properly so it doesn't save your tabs.
    2. Or you are opening a file through your system file manager using VS Code.

    It's probably the second one - if you click 'open with Code' through your file manager, it will open a new instance of VS Code. This means that your other tabs and the workspace (file view) will not be visible.

    What should happen is that it opens two windows - your old workspace and tabs, as well as a new window with the file you wanted in.

    Try this:

    1. Open VS Code and open some files in that window (ctrl + o).
    2. Close the window with alt + f4.
    3. Find a file on your computer and use the 'open with code' option to open a new VS Cod(ium) instance.

    You should see that two windows open - your old tabs, then another window with the new file.

    I hope this helps, feel free to ask me for more info :)