VS Code Workspaces
VS Code workspace files preserve your editor state, allowing you to pick up exactly where you left off.
How VS Code State Works
VS Code maintains state in two ways:
- Directory-based: Run
code .in a directory, open files, quit. Re-runcode .in the same directory and your files reopen. State is tied to the directory path. - Workspace files: A
.code-workspacefile explicitly stores state, can include multiple folders, and is portable.
Workspace Integration
Workareas associates each worktree with a VS Code workspace file. This means:
- Each branch/worktree gets its own editor state
- Open files, terminal sessions, and settings persist
- Switching worktrees means switching complete contexts
Workspace Commands
| Command | Description |
|---|---|
wa code | Launch VS Code with workspace for current worktree |
wa set ws --filename=myproject | Set workspace filename for current worktree |
wa set ws --path=/full/path/to/file.code-workspace | Set full workspace path |
wa get ws --filename | Get current workspace filename |
Workspace Storage
Workspace files are stored in a central directory:
# Default location
~/.workareas/workspaces/
# Or set custom location
export WORKAREAS_WORKSPACE_DIR=/path/to/workspaces
When you run wa code, Workareas looks up the workspace file and launches VS Code with it, restoring your complete editor context.
Workspace File Format
VS Code workspace files are JSON:
{
"folders": [
{"path": "/home/user/projects/myproject"}
],
"settings": {
"editor.fontSize": 14
}
}
Workareas can create these automatically when you associate a workspace with a worktree.