File Sessions
🎯 Why File Sessions?Have you ever experienced these frustrating moments?
File Sessions solves all of these problems with three powerful features: ✨ Key Features📁 1. Saved Sessions (Manual)Create named groups of files for different tasks or features. Perfect for organizing your work.
🌿 2. Branch Sessions (Automatic)Automatically save and restore files when switching Git branches. Your context follows your branches!
⏱️ 3. Timeline (Smart History)Intelligent automatic snapshots of your workspace over time. Like "Undo" for your entire editor state.
🚀 Quick StartInstallation
Or install via command line:
📖 Complete Usage Guide📁 Working with Saved SessionsCreating a Session
Opening a SessionMethod 1: Tree View (Recommended)
Method 2: Command Palette
Managing Sessions
Example Use Cases:
🌿 Working with Branch Sessions (Automatic)Branch Sessions are completely automatic and require no manual intervention. Once enabled (default), they work seamlessly with your Git workflow. How It Works
Managing Branch SessionsView all branch sessions in the "Branch Sessions" section:
Branch Session Best Practices✅ Let it work automatically - Don't overthink it, just switch branches normally ⏱️ Working with Timeline (Smart History)Timeline automatically creates smart snapshots of your workspace context. Think of it as version control for your editor state. How Timeline WorksThe Timeline feature uses intelligent detection to create snapshots when significant context changes occur: 🎯 Smart Triggers:
📸 Snapshot Contents:
Using TimelineView Timeline:
Restore a Snapshot:
Manage Timeline:
Timeline Use Cases💡 "What was I working on yesterday?" - Check timeline to see your context ⚙️ ConfigurationAccess settings via
Manual Sessions
|
| Scenario | enabled | autoCreate | autoRestoreOnSwitch | Behavior |
|---|---|---|---|---|
| Full Auto (Default) | ✅ | ✅ | ✅ | Save & restore automatically |
| Manual Restore | ✅ | ✅ | ❌ | Save auto, restore manually |
| Manual Control | ✅ | ❌ | ❌ | Everything manual |
| Disabled | ❌ | N/A | N/A | Feature off |
Timeline (Smart History)
fileSessions.timeline.enabled
Type: boolean | Default: true
Enable/disable automatic timeline snapshots.
{
"fileSessions.timeline.enabled": true
}
🎯 Real-World Use Cases
1. 🔄 Multi-Feature Development
Problem: Working on 3 features simultaneously, constantly losing context.
Solution:
- Create sessions: "Feature A - Payment", "Feature B - Auth", "Feature C - Reports"
- Instantly switch between contexts
- Each session has exactly the files you need
2. 🌿 Clean Git Workflow
Problem: Switching branches loses your carefully opened files.
Solution:
- Branch Sessions automatically save/restore your files
- Each branch maintains its own context
- Review all changed files before committing
3. 📚 Code Review Overload
Problem: PR with 50+ files, hard to organize and review.
Solution:
- Create session "PR #123 Review"
- Group files logically (frontend, backend, tests)
- Resume review exactly where you left off
4. 🐛 Complex Debugging
Problem: Debugging requires 15+ files open across multiple folders.
Solution:
- Open all relevant files once
- Save as "Debug - Memory Leak Issue"
- Instantly restore this context whenever needed
5. 📖 Documentation Work
Problem: Documentation spread across many markdown files.
Solution:
- Create "Docs - API Reference" session
- All docs open together
- Switch to/from code work effortlessly
6. 🔥 Emergency Hotfix
Problem: Must switch to hotfix branch, don't want to lose feature work.
Solution:
- Branch Sessions automatically save your feature context
- Switch to hotfix branch
- Return to feature branch with all files restored
💼 Multi-Root Workspace Support
File Sessions has full support for multi-root workspaces:
✅ Files from different workspace folders in the same session
✅ Workspace folder stored with each file
✅ Graceful handling when folders are removed
✅ Separate storage per workspace
Example Multi-Root Session:
Session: "Full Stack Feature"
├─ [frontend] src/components/UserProfile.tsx
├─ [backend] src/controllers/userController.ts
├─ [backend] src/models/User.ts
└─ [shared] types/user.d.ts
---
## 🎨 User Interface Overview
File Sessions adds a new Activity Bar icon with **three views**:
### 📁 Saved Sessions
Manual sessions you create for different tasks and features.
**Actions:**
- 💾 **Save** (toolbar) - Create new session from open files
- 📂 **Open** - Restore all files from session
- ➕ **Add File** - Add currently open file to session
- ✏️ **Rename** - Change session name
- 🗑️ **Delete** - Remove session
- ✖️ **Remove File** - Remove single file from session
---
### 🌿 Branch Sessions
Automatic sessions tied to Git branches.
**Actions:**
- 📂 **Open** - Restore files from a branch session
- 🗑️ **Delete** - Remove branch session
- ✖️ **Remove File** - Remove single file from session
**Status Indicators:**
- Current branch session highlighted
- Last opened timestamp visible
- File count shown for each session
---
### ⏱️ Timeline
Smart automatic history of your workspace context.
**Actions:**
- ⏮️ **Restore** - Restore workspace to snapshot state
- 🗑️ **Delete** - Remove single snapshot
- 🗑️ **Clear All** (toolbar) - Delete all snapshots
**Information Shown:**
- Timestamp of snapshot
- Number of files in snapshot
- Chronological order (newest first)
---
## 🎹 Keyboard Shortcuts & Commands
All features accessible via **Command Palette** (`Ctrl+Shift+P` / `Cmd+Shift+P`):
### Available Commands
- **File Sessions: Save File Session** - Create new manual session
- **File Sessions: Open Extension Settings** - Quick access to settings
**Note:** Most actions (open, rename, delete) are context-specific and available via right-click menus in the tree views.
---
## 🏗️ Architecture & Design
File Sessions follows **clean architecture principles** for maintainability and testability:
### Layered Structure
📦 src/ ├─ 🎨 ui/ # UI Layer │ ├─ commands.ts # Command handlers │ ├─ treeProvider.ts # Saved sessions tree │ ├─ branchTreeProvider.ts # Branch sessions tree │ ├─ timelineTreeProvider.ts # Timeline tree │ └─ *TreeItems.ts # Tree item definitions │ ├─ 💼 application/ # Application Layer │ ├─ sessionService.ts # Manual session logic │ ├─ branchSessionService.ts # Branch session logic │ ├─ timelineService.ts # Timeline logic │ └─ gitBranchOrchestrator.ts# Git integration │ ├─ 🎯 domain/ # Domain Layer │ ├─ session.ts # Core entities │ └─ validators.ts # Business rules │ ├─ 🔧 infrastructure/ # Infrastructure Layer │ ├─ sessionRepository.ts # Storage abstraction │ ├─ gitAdapter.ts # Git operations │ ├─ vscodeAdapter.ts # VS Code API │ └─ storageMigrations.ts # Data migrations │ └─ 📡 events/ # Event System └─ sessionEvents.ts # Event emitters
### Key Design Principles
- **Separation of Concerns**: Each layer has a single responsibility
- **Dependency Injection**: Services receive dependencies via constructor
- **Event-Driven**: Loose coupling via event system
- **Testability**: Logic separated from VS Code API
- **Type Safety**: Full TypeScript with strict mode
---
## 🔍 Troubleshooting
### Session not appearing after save
1. Check the **Output panel**: `View → Output → File Sessions`
2. Look for error messages or warnings
3. Verify you had files open when saving
4. Ensure workspace is a valid folder (not empty workspace)
### Files not opening from session
**Common causes:**
❌ **Files moved/deleted** - File paths no longer valid
**Solution:** Remove these files from session or restore them
❌ **Workspace folder removed** (multi-root)
**Solution:** Re-add workspace folder or delete session
❌ **File permissions issues**
**Solution:** Check file system permissions
❌ **Corrupted session data**
**Solution:** Delete and recreate session
### Branch sessions not working
**Checklist:**
✅ Is Git repository initialized?
✅ Is `gitBranchSessions.enabled` set to `true`?
✅ Are you switching branches via Git commands?
✅ Check Output panel for error messages
### Timeline not creating snapshots
**Verify:**
✅ Is `timeline.enabled` set to `true`?
✅ Are you opening/closing files? (triggers detection)
✅ Has 2+ minutes passed since last snapshot?
✅ Check Output panel for timeline logs
### Performance issues with many sessions
**Tips:**
- Delete old unused sessions
- Clear timeline history regularly
- Disable timeline if not needed
- Close File Sessions views when not in use
### Reset extension data
If you need to start fresh:
**Option 1: Delete individual data**
- Delete sessions one by one from tree view
**Option 2: Reset all workspace data**
1. Close VS Code
2. Navigate to workspace storage directory (varies by OS)
3. Delete workspace state files
4. Reopen workspace
**Note:** This will reset ALL extension data for that workspace, not just File Sessions.
---
## 📊 Storage & Privacy
### Where is data stored?
File Sessions stores all data in **VS Code's workspace state** (local only):
- **Location**: VS Code's built-in storage mechanism
- **Scope**: Per-workspace (each workspace has separate sessions)
- **Format**: JSON (easily inspectable)
- **Privacy**: Never sent to external servers
### What is stored?
✅ Session names
✅ File paths (absolute)
✅ Workspace folder names
✅ Timestamps
❌ **NOT stored:**
- File contents
- Git credentials
- Personal information
- Any data outside workspace
### Data security
- All data stored locally
- No network requests
- No telemetry
- No external dependencies
- Open source code (auditable)
---
## 🎓 Tips & Best Practices
### 💡 Naming Conventions
**Good session names:**
- ✅ "Feature - User Authentication"
- ✅ "Bug [#234](https://github.com/rodrigocvv/file-sessions/issues/234) - Memory Leak"
- ✅ "Refactor - Payment Module"
- ✅ "Review PR [#456](https://github.com/rodrigocvv/file-sessions/issues/456)"
**Avoid:**
- ❌ "Session 1" (not descriptive)
- ❌ "Files" (too generic)
- ❌ "Temp" (temporary things become permanent)
### 💡 Session Organization
- Keep sessions focused (10-20 files max)
- Delete sessions when task is complete
- Use branch sessions for feature work
- Use manual sessions for cross-branch work
### 💡 Git Branch Workflow
1. Create feature branch
2. Open relevant files
3. Let branch sessions auto-save on switch
4. Return later → files auto-restore
5. Delete branch session after merge
### 💡 Timeline Usage
- Use for exploratory work
- Check before major refactoring
- Clear timeline weekly to save space
- Great for "what was I doing?" moments
### 💡 Performance Optimization
- Limit sessions to relevant files only
- Clean up old sessions regularly
- Disable timeline if not needed
- Close tree views when not in use
---
## 🐛 Known Limitations
- **Git only**: Branch sessions require Git repository (not SVN, Mercurial, etc.)
- **Local files**: Only local files supported (not remote SSH/WSL files via remote extensions)
- **Open editors only**: Only saves visible tabs, not editor groups layout
- **No file contents**: Doesn't save file changes (use Git for that!)
- **Timeline cap**: Maximum 50 snapshots (oldest auto-deleted)
---
## 🤝 Contributing
Contributions are welcome! This is an open-source project.
### Development Setup
```bash
# Clone repository
git clone https://github.com/your-username/file-sessions.git
cd file-sessions
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode (auto-compile on save)
npm run watch
# Open in VS Code
code .
# Press F5 to launch Extension Development Host
Project Structure
See Architecture & Design section above for detailed structure.
Guidelines
- Follow existing code style
- Add tests for new features
- Update README for user-facing changes
- Use conventional commits
- Create issues before major changes
📝 License
MIT License - see LICENSE file for details.
💬 Support & Feedback
- 🐛 Bug Reports: GitHub Issues
- 💡 Feature Requests: GitHub Issues
- ⭐ Rate & Review: VS Code Marketplace
🙏 Acknowledgments
Built with ❤️ for developers who are tired of losing their workspace context.
Special thanks to:
- VS Code team for excellent extension API
- Open source community for inspiration
- All contributors and users
If this extension helps your workflow, please ⭐ star and ✍️ review it!



