In Notepad++ there is an option called 'Save session' that saves a list of all opened files (in the current window), bookmarks, code foldings, cursor position, etc., so I can reopen that state later even if I close the files.
In Visual Studio Code, I have not found an option like that. It seems the Workspace only saves the folder path and some settings defined to that workspace.
Is there a way to create something like a Notepadd++ session in Visual Studio Code?
I think the most similar thing to what you are asking for are Workspaces. From testing, they do in fact keep the files you had open, so long as you close the workspace in the menu first.
A Visual Studio Code "workspace" is the collection of one or more folders that are opened in a VS Code window (instance). In most cases, you will have a single folder opened as the workspace but, depending on your development workflow, you can include more than one folder, using an advanced configuration called Multi-root workspaces.
The concept of a workspace enables VS Code to:
- Configure settings that only apply to a specific folder or folders but not others.
- Persist task and debugger launch configurations that are only valid in the context of that workspace.
- Store and restore UI state associated with that workspace (for example, the files that are opened).
- Selectively enable or disable extensions only for that workspace.
If you look under File, you'll see the Workspace options:
The way it works is it saves a file that is a .code-workspace
extension, but really the underlying structure is JSON. For example, the file might look like:
{
"folders": [
{
"path": "..\\..\\..\\..\\dev\\Project Files\\Project\\MyProject"
}
],
"settings": {}
}