VSCode being strange about environment files. Even though it shows the correct file icon for the example.env
as a dotenv file in the file view/tab, only .env
is syntax-highlighted correctly when opening the file.
.env
(correct):
example.env
(no syntax highlighting):
What’s the best way to get all .env
files syntax highlighted properly in VSCode?
2
Answers
I guess vscode env formetter extension is build to get highlights all files starting with ".env" not anything before the name in your case "example.env". I guess it is treating a separate language file which definations is not installed.
If you want to have separate env for local and production you can name them as ".env.local" for local and ".env" for production. Vscode will hightlights syntax for these.
I use the extension DotENV. Works flawlessly for me.