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?


VS Code has a way to manually define the file association of certain extension types.
To do so for
.envfiles:Ctrl+,or File > Preferences > Settings.file asssociation.Files: Associations.*.envand under Value, addproperties.You can also do the same for
.env.examplefiles.Switching back to your file, you should see the syntax highlighted.