env-doctor

VS Code Extension

The env-doctor VS Code extension provides real-time environment variable validation, intelligent autocomplete, and seamless navigation directly in your editor. Stop switching between filesβ€”get instant feedback as you code.

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Go to Extensions (Cmd+Shift+X / Ctrl+Shift+X)
  3. Search for β€œenv-doctor”
  4. Click Install

Or install directly:

code --install-extension theaccessibleteam.env-doctor-vscode

From Source

# Clone and build
git clone https://github.com/WOLFIEEEE/env-doctor.git
cd env-doctor/packages/vscode-extension
npm install
npm run build

# Package and install
npm run package
code --install-extension env-doctor-vscode-1.0.0.vsix

Features

πŸ”΄ Real-time Diagnostics

See issues instantly as you typeβ€”no need to run the CLI:

// ❌ This will show a warning squiggle
const apiKey = process.env.STRIPE_SECRT_KEY;
//                         ~~~~~~~~~~~~~~~~
//                         ⚠️ "STRIPE_SECRT_KEY" is not defined
//                         πŸ’‘ Did you mean "STRIPE_SECRET_KEY"?

// βœ… This is correctly defined
const dbUrl = process.env.DATABASE_URL;

Diagnostic Types:

Icon Type Severity Description
πŸ”΄ Missing Required Error Required variable not defined
🟑 Missing Optional Warning Used variable not defined
πŸ”΅ Unused Hint Defined but never used
πŸ”΄ Secret Exposed Error Secret used in client code

πŸ’‘ Smart Autocomplete

When you type process.env. or import.meta.env., get intelligent suggestions:

const config = {
  database: process.env.|
  //                    ↓ Autocomplete dropdown appears
  //  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  //  β”‚ $ DATABASE_URL      postgres://...      β”‚
  //  β”‚ $ DATABASE_POOL     10                  β”‚
  //  β”‚ $ DATABASE_SSL      true                β”‚
  //  β”‚ $ DEBUG_MODE        false               β”‚
  //  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
};

Each suggestion shows:

πŸ“– Hover Information

Hover over any environment variable to see rich documentation:

const url = process.env.DATABASE_URL;
//                      ^^^^^^^^^^^^
// β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
// β”‚ 🌿 DATABASE_URL                             β”‚
// β”‚                                             β”‚
// β”‚ Value: postgres://user:***@host:5432/db     β”‚
// β”‚ Type: url | Required: Yes                   β”‚
// β”‚                                             β”‚
// β”‚ PostgreSQL connection string for the main   β”‚
// β”‚ application database.                       β”‚
// β”‚                                             β”‚
// β”‚ ────────────────────────────────────────    β”‚
// β”‚ πŸ“ Defined in: .env:3                       β”‚
// β”‚                                             β”‚
// β”‚ πŸ“Š Used in 5 files:                         β”‚
// β”‚ β€’ src/lib/db.ts:5                           β”‚
// β”‚ β€’ src/api/users.ts:12                       β”‚
// β”‚ β€’ src/api/posts.ts:8                        β”‚
// β”‚ β€’ ...and 2 more                             β”‚
// β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”— Go to Definition

Ctrl+Click (or Cmd+Click on Mac) on any environment variable to jump directly to its definition in the .env file.

Works both ways:

⚑ Quick Fixes

One-click fixes for common issues:

Issue Quick Fix Options
Undefined variable β€œAdd to .env”, β€œDid you mean X?”
Unused variable β€œRemove from .env”
Typo detected β€œChange to CORRECT_NAME”
Exposed secret β€œMove to server-side”

Example:

// STRIPE_SECRT_KEY is not defined
const key = process.env.STRIPE_SECRT_KEY;
//                      ~~~~~~~~~~~~~~~~
// πŸ’‘ Quick Fix:
//   β–Έ Add "STRIPE_SECRT_KEY" to .env
//   β–Έ Change to "STRIPE_SECRET_KEY"
//   β–Έ Add to .env.example

πŸ“Š Status Bar

See the health of your environment at a glance:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ... β”‚ βœ“ env-doctor β”‚                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↑
   Click to run analysis

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ... β”‚ ⚠️ env-doctor: 2 β”‚                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↑
   2 issues detected

Configuration

VS Code Settings

Open Settings (Cmd+, / Ctrl+,) and search for β€œenv-doctor”:

Setting Default Description
envDoctor.enable true Enable/disable the extension
envDoctor.configPath "" Custom path to env-doctor config
envDoctor.envFiles [".env", ".env.local", ".env.development"] Environment files to analyze
envDoctor.diagnostics.enable true Enable real-time diagnostics
envDoctor.diagnostics.showUnused true Show unused variable hints
envDoctor.diagnostics.showMissing true Show missing variable warnings
envDoctor.diagnostics.showSecrets true Show exposed secret errors
envDoctor.diagnostics.severity.missing "warning" Severity for missing variables
envDoctor.diagnostics.severity.unused "hint" Severity for unused variables
envDoctor.diagnostics.severity.secret "error" Severity for exposed secrets
envDoctor.autocomplete.enable true Enable autocomplete
envDoctor.autocomplete.showValues true Show values in suggestions
envDoctor.autocomplete.redactSecrets true Hide secret values
envDoctor.hover.enable true Enable hover information
envDoctor.hover.showUsages true Show usage locations in hover
envDoctor.hover.maxUsages 5 Maximum usages to display
envDoctor.statusBar.enable true Show status bar item

Workspace Settings

Create .vscode/settings.json in your project:

{
  "envDoctor.enable": true,
  "envDoctor.envFiles": [
    ".env",
    ".env.local",
    ".env.development",
    ".env.production"
  ],
  "envDoctor.diagnostics.severity.missing": "error",
  "envDoctor.hover.maxUsages": 10
}

Commands

Open the Command Palette (Cmd+Shift+P / Ctrl+Shift+P) and type β€œenv-doctor”:

Command Description
env-doctor: Analyze Run full environment analysis
env-doctor: Refresh Refresh analysis after manual changes
env-doctor: Add Variable to .env Add a new variable interactively
env-doctor: Sync .env.example Run the sync command
env-doctor: Show Matrix Open environment comparison matrix
env-doctor: Generate Schema Generate TypeScript runtime schema

Keyboard Shortcuts

Action Shortcut
Go to Definition Cmd+Click / Ctrl+Click
Find All References Shift+F12
Quick Fix Cmd+. / Ctrl+.
Show Hover Cmd+K Cmd+I / Ctrl+K Ctrl+I

Supported Languages

Full support (diagnostics + autocomplete + hover):

Special support:

Performance

The extension is optimized for large projects:

For very large projects (500+ files), the initial analysis may take 2-3 seconds.

Troubleshooting

Diagnostics not appearing

  1. Check extension is enabled: Open Settings β†’ search β€œenvDoctor.enable”
  2. Verify .env files exist: Extension needs at least one .env file
  3. Check output panel: View β†’ Output β†’ select β€œenv-doctor” from dropdown
  4. Reload window: Cmd+Shift+P β†’ β€œDeveloper: Reload Window”

Autocomplete not working

  1. Trigger manually: Type process.env. and wait 100ms
  2. Check language: Ensure file is TypeScript or JavaScript
  3. Verify .env format: Variables must be KEY=value format

Extension not activating

The extension activates when:

High CPU usage

Try these settings to reduce analysis frequency:

{
  "envDoctor.diagnostics.enable": false
}

Then use the env-doctor: Analyze command manually.

Integration with env-doctor CLI

The extension uses the same analysis engine as the CLI:

# CLI analysis
npx @theaccessibleteam/env-doctor

# Same results in VS Code - just open the project!

Configuration in env-doctor.config.js is automatically used by both.

Feedback & Issues


Next Steps: