Skip to content

Add support for dotenv #267333

@remcohaszing

Description

@remcohaszing

The dotenv format uses subset of the bourne shell syntax to define key-value pairs.

# This is a comment
SOME_VARIABLE=some value  # Another comment
another_variable="A value in a quoted string"
YET_another_variable='A value with a # sign in it'

Unlike other languages, files of this type are not recognizable by a name suffix (file extension). Instead, these files are typically recognizable by a name prefix. Some popular file names include:

  • .env
  • .env.development
  • .env.production
  • .env.test
  • .env.local
  • .env.development.local
  • .env.production.local
  • .env.test.local
  • .flaskenv
  • user-dirs.dirs

This format is supported by many popular environments, including the Node.js, Next.js, Flask, and the XDG user dir specification.

There are two popular existing Dotenv extensions:

The most popular is DotENV. It doesn’t specify the correct file patterns. Instead, it defines extensions. This extension was last updated 7 years ago.

The extension Dotenv Official +Vault looks more official. It has the same problem as DotENV, but additionally it writes to user settings as a workaround. This is solved by dotenv-org/dotenv-vscode#105, but this has gone unnoticed for over a year.

Both projects appear to be unmaintained. Given how commonly dotenv files are used, I think it would be good to include basic dotenv support in VSCode as a builtin extension.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code Insidersverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions