Skip to content

IronGeek/vscode-env

Repository files navigation

ENV

GitHub build GitHub release (latest by date) GitHub package.json version Visual Studio Marketplace Version GitHub

Adds formatting and syntax highlighting support for env files (.env) to Visual Studio Code

Features

  • Syntax highlighting

    Syntax highlighting

  • Folding

    The extension will enable folding on file content that are wrapped with the following pattern:

    # ...       << begin with comment(s)
    ...
    ...         << folded content
    ...
                << end with a blank line
    

    Folding

  • Formatting

    Use the Format Document command (CTRL+SHIFT+I) from the Command Pallete (CTRL+SHIFT+P) to format the current env file

    Formatting

Custom env file extension

The extension support env files with the following name:

  • .env
  • .env.sample
  • .env.example

To enable support for other env files with specific naming convention/ file extension, use the files.associations settings in Visual Studio Code.

For example, the following settings will enable support for *.env.development and *.env.production files:

  "files.associations": {
    "*.env.development": "env",
    "*.env.production": "env"
  }

Known Issues

  • Highlighting/ Formatting/ Folding doesn't work

    Other extensions (like shell-format) could also provides contributions to env files (.env). When two or more extensions providing contributions to a same file, there's a chance the contributions of previous extension will be overwritten by the later (see: github.com/microsoft/vscode-docs/issues/2862).

    To workaround this issue, use Visual Studio Code files.associations to force the language of .env files to be always specified as env:

    Issue #3: Workaround 1

    Other non permanent solution is by using the Select Language Mode button on the Visual Studio Code status bar and set the language to Environment Variables (alias of env) on the opened file:

    Issue #3: Workaround 2

Acknowledgements

License

This project is licensed under the terms of the MIT license.

About

.ENV formatter for Visual Studio Code

Resources

License

Stars

Watchers

Forks

Packages

No packages published