State Switcher
A VS Code extension that adds a status bar button to cycle through configurable states and execute associated actions.
Features
- Status bar button with a colored dot (no text)
- Configurable states via VS Code settings
- Click to cycle through states in order
- Executes a bash command/script for each state transition
- Color changes based on current state (reverts on failure)
- Hover tooltip shows current active state name
- Defaults to grey when no states are defined
Configuration
Add states in your VS Code settings (settings.json):
{
"stateSwitcher.states": [
{
"name": "Local",
"color": "#008000",
"action": "./scripts/local.sh"
},
{
"name": "Staging",
"color": "#FFA500",
"action": "./scripts/staging.sh"
},
{
"name": "Production",
"color": "#FF0000",
"action": "./scripts/prod.sh"
}
]
}
Development
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode
npm run watch
# Run tests
npm test
Extension Settings
| Setting |
Type |
Description |
stateSwitcher.states |
array |
Array of state objects with name, color, and action properties |
Requirements
- VS Code ^1.85.0
- Node.js >= 18
License
MIT
| |