You are reading some code and you see process.env.PORT. What is the value? So you open the .env file, scroll to find the line, and then go back to where you were. I wanted to skip that step, so I built a small VS Code extension.
It is called DotEnv Lens, and it is free and open source.
Hover to see the value
Hover over process.env.ANYTHING in a JavaScript or TypeScript file, and the value appears right there, with the file it came from.
The hover tells you more than the value:
- A warning when the value is empty.
- An error when the key is not set anywhere.
- A hint when your
.env.examplelists a key that your.envis missing.
It reads .env.local first and then .env, the way most frameworks do, and it updates as soon as you save the file.
What about secrets?
Showing values is the whole point, so the full value is shown by default. But if you share your screen or record a video, one setting masks secret-looking values (keys with words like KEY, SECRET, TOKEN or PASSWORD, and passwords inside connection URLs). It is called dotenvlens.maskSecrets, and it is off by default.
The extension only reads local files. It makes no network calls.
Compare .env with your template
The first feature I built was a comparison. Right-click a .env file (or use the command palette) and run DotEnv Lens: Compare .env with template. It tells you which keys are missing, extra, empty or duplicated compared with .env.example. The report shows key names only, never values.
How it is built
The parser and the comparison logic are plain TypeScript with no VS Code dependency, so they are unit tested on their own (79 tests so far). The VS Code part is a thin layer on top. The parser handles comments, quoted values, export prefixes, values with = inside, and duplicate keys.
Try it
Search for "DotEnv Lens" in the VS Code Extensions panel, or install it from the VS Code Marketplace.
The source code is on GitHub.
What should I build next?
I am thinking about jump to definition, autocomplete for env keys, and Vite and Python support. Which one would you use? Tell me in the comments.
