The Env Switcher - Smart Environment Switcher for VS Code
🚀 Instantly switch between environment configurations without leaving VS Code!
Features
✨ Core Features:
- 🔍 Auto-detect
.env* files in your workspace
- 🔄 Quick switch between environments via Command Palette
- 📊 Status bar indicator showing current environment with color coding
- 💾 Automatic backup of current
.env before switching
- ⚙️ Configurable file patterns and search locations
Quick Start
- Install the extension from VS Code Marketplace
- Open a project with
.env files (e.g., .env.dev, .env.staging, .env.prod)
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type "Select Environment" and choose your desired environment
- See the active environment in your status bar!
Commands
| Command |
Description |
Shortcut |
EnvSwitcher: Select Environment |
Open environment picker |
Ctrl+Shift+P → "Select Environment" |
EnvSwitcher: Reload Environment |
Refresh current environment detection |
Ctrl+Shift+P → "Reload Environment" |
EnvSwitcher: Show Current Environment |
Display current environment info |
Ctrl+Shift+P → "Show Current" |
Status Bar Indicators
The extension shows your current environment in the status bar with intuitive color coding:
- 🟢 DEV/DEVELOPMENT - Green for development
- 🟠 STAGING/STAGE - Orange for staging
- 🔴 PROD/PRODUCTION - Red for production
- ⚪ OTHER - White for custom environments
Configuration
Customize the extension behavior in your VS Code settings:
{
"envSwitcher.envFolder": "./", // Folder to search for env files
"envSwitcher.filePattern": ".env*", // File pattern to match
"envSwitcher.backupEnabled": true, // Enable automatic backups
"envSwitcher.showStatusBar": true // Show status bar indicator
}
Configuration Options
| Setting |
Type |
Default |
Description |
envSwitcher.envFolder |
string |
"./" |
Folder path to search for environment files |
envSwitcher.filePattern |
string |
".env*" |
File pattern to match environment files |
envSwitcher.backupEnabled |
boolean |
true |
Enable backup of current .env file before switching |
envSwitcher.showStatusBar |
boolean |
true |
Show current environment in status bar |
Example Workflow
Setup your project with multiple environment files:
my-project/
├── .env.dev
├── .env.staging
├── .env.prod
└── .env # Current active environment
Switch environments:
- Press
Ctrl+Shift+P
- Type "Select Environment"
- Choose
.env.staging
- Extension copies
.env.staging → .env
- Status bar updates to show "🟠 STAGING"
Backup protection:
- Your previous
.env is automatically backed up as .env.backup.TIMESTAMP
- Never lose your current configuration!
Supported File Patterns
The extension automatically detects files matching these patterns:
.env
.env.dev
.env.development
.env.staging
.env.stage
.env.prod
.env.production
.env.local
.env.test
- Any file starting with
.env
Requirements
- VS Code 1.74.0 or higher
- Node.js project with
.env files
Extension Settings
This extension contributes the following settings:
envSwitcher.envFolder: Folder path to search for environment files
envSwitcher.filePattern: File pattern to match environment files
envSwitcher.backupEnabled: Enable backup of current .env file before switching
envSwitcher.showStatusBar: Show current environment in status bar
Known Issues
- Environment detection is based on file content comparison
- Large
.env files may take slightly longer to process
Release Notes
0.1.0
- ✨ Initial release
- 🔍 Auto-detection of environment files
- 🔄 Quick environment switching
- 📊 Status bar indicator with color coding
- 💾 Automatic backup functionality
- ⚙️ Configurable settings
Contributing
Found a bug or have a feature request? Please open an issue on our GitHub repository.
License
MIT License - see LICENSE file for details.
Enjoy seamless environment switching! 🚀