VScode Folder automatically closes when vscode get closed - visual-studio-code

Before:
After:
When i am doing quit(cmd+Q) and reopening it, it loads the previous folder which i am working at, but if i press the top left red button and reopen everything is gone, i have to reopen the folder.

You can choose the corresponding settings in Window: Restore Window. Default is all
If you prefer the settings.json
"window.restoreWindows": "all"
Copied from vscode document:
Controls how windows are being reopened after starting for the first
time. This setting has no effect when the application is already
running.
preserve: Always reopen all windows. If a folder or workspace is opened (e.g. from the command line) it opens as a new window unless it
was opened before. If files are opened they will open in one of the
restored windows.
all: Reopen all windows unless a folder, workspace or file is opened (e.g. from the command line).
folders: Reopen all windows that had folders or workspaces opened unless a folder, workspace or file is opened (e.g. from the command
line).
one: Reopen the last active window unless a folder, workspace or file is opened (e.g. from the command line).
none: Never reopen a window. Unless a folder or workspace is opened (e.g. from the command line), an empty window will appear.

Related

Disabling VSCode Workspace Auto Opening

I'm working with a directory which looks like the following
packageName/src/packageName.
When I attempt to open the high level folder, VSCode automatically opens the lower level folder as a workspace which is incredibly frustrating. I've attempted to modify the "path" setting in the workspace settings file, but I had no luck- on an attempt to reopen the desired folder, the path parameter value was automatically changed back. How can I disable this functionality?

How to disable VSCode from remembering opened editors in the folder I opened before?

After I use VSCode to open a folder and some editors for the files, I close the folder. When I close and reopen the folder, VSCode opens the editors I opened last time.
How to prevent VSCode from reopening the editors I opened last time?
I have already set "window.restoreWindows": "none". When I exit directly from VSCode, it won't restore windows. I am saying when I reopen a folder, the editors I opened last time before I close the folder, will still be opened.
To stop Visual Studio Code from opening your previous folder all the time, then you have to edit settings.json.
To achieve this, open the settings.json. Do this by following the steps below.
Open the Command Palette by pressing F1.
Type, "Open settings".
When you see the options, select Open Settings (JSON).
After that, add the following option.
{
"window.restoreWindows": "none"
}
This should prevent Visual Studio Code from opening the previous folder when launching the application.
I just open vscode from my terminal, it's way faster and efficient in my opinion.
Just browse to your wished folder and write "code ." in your terminal.
Follow this process
Open VS Code, goto file>preferences>settings.
search for restore Window or click on Window tab then find restore window .select none from selection.
https://i.stack.imgur.com/FLx4a.png
https://i.stack.imgur.com/TAuHT.png
https://i.stack.imgur.com/B8W5a.png

Open the same folder in two different windows in VS Code

I want to open the same folder in two different windows. I opened the folder in the first window, but when I tried to open the folder in the second window, VS Code just jumped to the first window, instead of opening it in the second window.
I want to do this because I want to divide my files into two windows and I am using VSCoq, which requires VS Code to open a particular folder to work.
This worked for me in VS Code 1.66.2
https://www.ryanchapin.com/running-multiple-vscode-windows-from-the-same-workspace/
CTRL+SHIFT+P
Then type
Workspaces: Duplicate As Workspace in New Window
open your folder as Workspace inside the new Window
CTRL+SHIFT+P
Workspaces: Duplicate As Workspace in New Window

Cannot open saved workspace in vscode

I have created a workspace with five folders in it. It works fine whenever I first create it. I go File > Save Workspace as and save it in my Documents directory. Then I close and reopen VSCode and go to open the workspace, and it isn't there. I go to open recent workspaces, and there are no files visible in explorer window. I can open the workspace configuration file but I cannot open the workspace itself.
I'm on Linux Mint tessa
I found the problem. The workspace was saved without a file extension. I manually added .code-workspace to the filename and now I can open it as a workspace.

How to reopen last opened file in vscode

If i close the vscode editor after saving a file and reopen the editor again, the session is not restored. I am unable to find the file in open recent. The only way how can I open the file is navigating to the directory in open menu. Thats very annoying is it some problem with my editor or default behaviour?
You must have a folder opened to restore previously opened files.
Go to 'File' menu
Open folder
Select a folder (my documents for example)
Now open any files, close vscode and re-open. Your files are still in the editor.
"window.restoreWindows": "all" will do ;)
The complete settings are
"window.restoreWindows": "all",
"files.hotExit":"onExitAndWindowClose",
Note that with:
VSCode 1.42 (Jan. 2020) it does work even in case of "hot exit" (unexpected exits): see "Visual Studio Code never reopens previous file or folder".
VSCode 1.51 (Oct. 2020), that will also restore a search tab if you had one (issue 102659 resolved by issue 99694, and commit 8bf0e20)