Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>dotenv Sync & ValidatorNew to Visual Studio Code? Get it now.
dotenv Sync & Validator

dotenv Sync & Validator

ActiveClientMods

|
1 install
| (0) | Free
Keep your local .env files automatically in sync with .env.example templates and easily fix missing keys.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

dotenv Sync & Validator

Keep your local .env files in sync with their .env.example / .env.template templates — right inside the editor. The extension continuously compares every template against its matching .env file and flags any key that a teammate added to the template but that you're still missing locally. One action fills them in.

No more "works on my machine" because someone forgot to add STRIPE_SECRET_KEY to their .env.

Features

Live validation

Every key defined in a template but absent from the corresponding .env file is underlined as a diagnostic in the editor and listed in the Problems panel. Validation runs automatically as you type or save — no command needed.

# .env.example
DATABASE_URL=            # ok, present in .env
STRIPE_SECRET_KEY=       # missing from .env  -> flagged
SENTRY_DSN=              # missing from .env  -> flagged

One-action Quick Fix

Put the cursor on a flagged key and open the Code Actions menu (Ctrl + . on Windows/Linux, Cmd + . on macOS):

  • Sync missing key(s) to .env — appends the key under the cursor.
  • Sync all N missing keys to .env — appends every missing key at once.

You can also use the sync button that appears in the editor title bar while a template file is open.

Keys are appended with empty values (KEY=), so your secrets are never overwritten and nothing is copied out of the template. If the .env file doesn't exist yet, it is created for you.

Template matching

The extension pairs templates to env files by stripping the template suffix:

Template Local file
.env.example .env
.env.template .env
.env.production.example .env.production

Commands

Available from the Command Palette (Ctrl/Cmd + Shift + P):

Command Description
dotenv Sync: Sync all missing keys to .env Sync every missing key for the active template.
dotenv Sync: Re-validate .env files Force a re-scan of the workspace.

Extension Settings

Setting Default Description
dotenvSyncValidator.enable true Enable/disable validation.
dotenvSyncValidator.diagnosticSeverity Warning Severity for missing keys (Error, Warning, Information, Hint).

How it works

The extension watches all .env* files in your workspace. When a template or an env file changes, it re-parses both, computes the set difference of their keys, and updates the diagnostics. Only key names are ever read from your files — values are never inspected, logged, or transmitted.

Try it in this repo

The samples/ folder ships a template and a partly-filled .env. Press F5 to launch the Extension Development Host, open samples/.env.example, and try the Quick Fix. See samples/README.md for the full walkthrough.

Development

This project uses Bun and oxlint.

bun install
bun run check-types   # tsc --noEmit
bun run lint          # oxlint
bun run test          # vscode-test (headless integration tests)
bun run package       # production bundle via esbuild

License

MIT © ActiveClientMods

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft