-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autoloading .env
file format does not ignore inline comments.
#23799
Comments
Hello @shellvon. Thank you for filing this issue. I appreciate the code reference and suggestion here. Would be curious to see how your environment variables look after the Python extension activates your terminal. |
Yes, When using this extension, my code read |
Ah, the joys of |
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. Happy Coding! |
I think I've given enough information, it would be weird to just close it like this... @anthonykim1 |
Hi @shellvon, yes I am reopening this. Please excuse the bot |
Recently, I discovered that projects opened via VSCode automatically load the
.env
file. Upon further investigation, I confirmed that the issue aligns with what was previously noted by #22982 .In this context, I observed a particular detail: within VSCode, the
.env
file supports inline commenting capabilities.Some other tools that handle env files also support inline comments:
When the
.env
file is processed byms-python
, such inline comment functionality is not recognized. Instead,ms-python
leaves the commented parts of the file intact, treating them as part of the active configuration rather than ignoring them as comments.vscode-python/src/client/common/variables/environment.ts
Lines 141 to 165 in 5fd5098
I believe this behavior can mislead many users because the UI suggests that it is a comment, yet the comments remain when loaded by this plugin. Without additional handling by the program, this can lead to peculiar results.
Perhaps we could maintain consistency with the regular expression found in the dotenv source code:
The text was updated successfully, but these errors were encountered: