Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Env BlocksNew to Visual Studio Code? Get it now.
Env Blocks

Env Blocks

David Moll

|
2 installs
| (0) | Free
Easily switch between blocks in .env files by commenting them in/out.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Env Blocks logo

Marketplace version Installs Rating License Last commit Open issues

Env Blocks

Switch between blocks in .env files (databases, API endpoints, environments, …) by commenting them in and out.

Your .env
# @block database:local
# DB_HOST="localhost"
# DB_PORT=5432
# DB_USER="dev"
# DB_PASSWORD="dev"
# @end

# @block database:staging
DB_HOST="db.staging.example.com"
DB_PORT=5432
DB_USER="app"
DB_PASSWORD="staging-secret"
# @end

# @block api:sandbox
API_URL="https://sandbox.api.example.com"
API_KEY="sk_test_123"
# @end

# @block api:production
# API_URL="https://api.example.com"
# API_KEY="sk_live_456"
# @end

# @block debug
# LOG_LEVEL="debug"
# VERBOSE=true
# @end
The example .env in VS Code with Use / Disable buttons above each block
  • # @block group:name … # @end marks a block. A block without its # @end is ignored and shows a warning. Blocks in the same group act like radio buttons — enabling database:local disables database:staging.
  • A block without a group (# @block debug) is a plain on/off toggle.
  • Only KEY=value lines are toggled (including multi-line quoted values); ordinary comments stay untouched.
  • Add @danger to mark a block as dangerous, e.g. @block database:production @danger. Switching to it asks for confirmation, it shows a ❗ in the switcher and above the block, and the status bar turns red while it is active.

Switching: the status bar item per group, the buttons above each # @block line, or the command "Env Blocks: Switch Block".

Settings: envBlocks.file (default .env) and envBlocks.autoSave (default true).

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft