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.
Cmd+Shift+X / Ctrl+Shift+X)Or install directly:
code --install-extension theaccessibleteam.env-doctor-vscode
# 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
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 |
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 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 β
// βββββββββββββββββββββββββββββββββββββββββββββββ
Ctrl+Click (or Cmd+Click on Mac) on any environment variable to jump directly to its definition in the .env file.
Works both ways:
.env file.env file β Jump to first usage in codeOne-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
See the health of your environment at a glance:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ... β β env-doctor β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
Click to run analysis
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ... β β οΈ env-doctor: 2 β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
2 issues detected
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 |
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
}
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 |
| 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 |
Full support (diagnostics + autocomplete + hover):
.ts, .tsx).js, .jsx)Special support:
.env files (syntax highlighting, hover for usages)The extension is optimized for large projects:
.env files are parsed once and cachedFor very large projects (500+ files), the initial analysis may take 2-3 seconds.
.env files exist: Extension needs at least one .env fileCmd+Shift+P β βDeveloper: Reload Windowβprocess.env. and wait 100ms.env format: Variables must be KEY=value formatThe extension activates when:
.env* file exists in the workspaceenv-doctor.config.* file existsTry these settings to reduce analysis frequency:
{
"envDoctor.diagnostics.enable": false
}
Then use the env-doctor: Analyze command manually.
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.
Next Steps: