Link to .env file not working
Describe the bug
The link to .env file option is not working. Saving the environment variables does not save to the selected file.
To Reproduce
Follow the steps described in the README file, Environment section, item 3. env file
Expected behavior
The variables should be saved to the selected file
Platform:
- OS: Windows 10 (21H2)
- vscode version: 1.66.1
- extension version: v1.14.4
Solution:
n/a
Screenshot:

Hi @brk9394
Link to .env file is a read only operation, the extension will not write back to file, this is by design.
The feature was implemented based on feedback from users.
read this comment https://github.com/rangav/thunder-client-support/issues/74#issuecomment-846612958
Thanks for the info rangav. However, there still appears to be a problem with the read only operation. The variables stored in a .env file are not displayed after linking the file. I have also tried enabling the setting to save the request data in workspace, but that had no effect.
Open the environment again, please select the .env file again and save it.
now test the request with the variables
Yes, the request works with the variables stored in the linked .env file, thank you!
However, I find this feature confusing an unintuitive for a couple of reasons:
- There is no indication which variables are stored in the linked .env file, so I need to open the file in a separate tab or editor
- The same variable name can be stored in both the Thunder Client tab and in the linked .env file. When this happens, the Thunder Client variable takes precedence (which is fine). But again, there is no indication to the user which variable is used, or that there are 2 conflicting variable names.
Suggestion: Display the env file variables in a read-only list at the bottom of the page. Then refresh the list when the tab loads, or maybe add a refresh button.
Thanks @brk9394 for feedback, will review the suggestions. definitely there is room for improvements like mouse hover on the variable show extra info like environment used etc..
and also as you are using it for first time, it may seem confusing. you will get used to it after a while.
Useful comment on how to use different env's https://github.com/rangav/thunder-client-support/issues/441#issuecomment-1016226790
I am closing this issue, feel free to re-open if needed