VS Code State
As developers, having our IDE’s reload our previous state allows us to switch contexts and to pick up where we left off.
VS Code, as modern IDE, implements this in two different ways. The first is based on the current directory.
Start VS Code in directory A (code .), open a bunch of files and then quit. If you re-run VS Code it will re-open those files. Switch to a different directory B, run VS Code and it will open in it’s initial state, no files loaded. Open a bunch of files and exit. Change back to directory A and re-run VS Code and it will open those files previously opened when you ran VS Code in directory A.
VS Code associates it’s state with the directory where it was started.
The other mechanism that VS Code maintains state is through a Workspace file (.code-workspace). Workspaces are a file that is used to maintain that state. It also allows a developer to manage more than one folder at a time.
The advantage with Workspaces is that you associate state with a workspace file. However, VS Code maintains that state based on the directory where the workspace file is stored. Move the file to a different directory and VS Code will give you a new state.