thunder-client-support icon indicating copy to clipboard operation
thunder-client-support copied to clipboard

Link to .env file not working

Open brk9394 opened this issue 4 years ago • 6 comments

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:

image

brk9394 avatar Apr 06 '22 02:04 brk9394

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

rangav avatar Apr 06 '22 04:04 rangav

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.

brk9394 avatar Apr 06 '22 17:04 brk9394

Open the environment again, please select the .env file again and save it.

now test the request with the variables

rangav avatar Apr 06 '22 17:04 rangav

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:

  1. 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
  2. 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.

brk9394 avatar Apr 06 '22 18:04 brk9394

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

rangav avatar Apr 06 '22 20:04 rangav

I am closing this issue, feel free to re-open if needed

rangav avatar Apr 07 '22 08:04 rangav