VS Code is not detecting parent environment

I am using julia 1.6.2 on Windows 10 OS and have installed julia extension in vs code 1.59. But its not detecting parent environment , I have to manually select the environment in .julia folder. Can anyone tell me what is going wrong

We only auto-detect environments in your workspace, but do not traverse parent folders outside of that. Primarily for security reasons: VS Code asks you to make a trust decision about the stuff inside the workspace, and we can’t “interpret” that as extending beyond the workspace folders.

1 Like

So, in that case how should I start vscode for working in global (system wide) environment, like am I supposed to select the environment to $HOME.julia\environments\v1.6 manually to work in it, I am asking it because most of the packages which I require are installed in there only

If you change the env in a workspace once, it will save that setting in a .vscode/settings.json file and the next time you open VS Code it will make that env activate again, I think that would probably be the smoothest way to do this.

1 Like

Thanks a lot I will try this

@davidanthoff: I just updated vscode from v1.3.28 to v1.3.30 on my Mac, and have a similiar problem.
Previously, when I typed ] to go to the pkg session, I got the prompt: (@v1.6) pkg> and did all the updates. Now, when I do the same, it goes to the current folder: (julia_test) pkg>. As @usman0311 mentioned, I also often work on the global environment, and I want to get back to the previous situation. I edited the settings.json file, in particular, I modified: "julia.environmentPath": "$HOME/.julia/environments/v1.6", which was previously set as the empty string "". Then, I quit from the vscode, and did the same. But it didn’t reflect the specified environment. It still says: (juliat_test) pkg>. What should I do if I want to recover the previous situation? Thanks for your help!

PS: By the way, when I modified and saved this setting.json file, the only line I changed was that julia.environmentPath variable. However, the other variable "editor.find.seedSearchStringFromSelection": false generated an error when I reran the vscode/julia session. It says that it has to be a string selected from the list: “never”, “always”, etc. And false was not accepted. Is this a bug reported?

@davidanthoff: BTW, in my above posting, I changed settings.json file by the following steps:

  1. Select Extensions icon and then select Julia
  2. Click the gear icon (manage) of the Julia/vscode package and select Extensions Setting from the pulldown menu
  3. Select User; then select Julia Environment Path’s Edit in settings.json
  4. Set "julia.environmentPath": "$HOME/.julia/environments/v1.6"

Now, in Step 3 above, I checked Workspace instead of User. Then, that’s settings.json file contains:
"julia.environmentPath": "", i.e., specified yet. Do I need to do the same for this settings.json file? Or do this setting only on settings.json under Workspace and that under User should be kept as an empty string? Thanks for your help!

I don’t think we support interpolation of env variables. The easiest to change this setting is to just use the command Julia: Change current environment, it will automatically save your choice in the correct settings.json file.

@davidanthoff; ;thanks a lot. In fact, instead of changing those environmental variables or changing the current environment, all I have to do is to run just activate at the pkg prompt. Then, the prompt goes back to (@v1.6) pkg>.
By the way, my previous question in the postscript part. That is:

when I modified and saved this setting.json file, the only line I changed was that julia.environmentPath variable. However, the other variable "editor.find.seedSearchStringFromSelection": false generated an error when I reran the vscode/julia session. It says that it has to be a string selected from the list: “never”, “always”, etc. And false was not accepted. Is this a bug reported?

What should I do? Can I change it back to false instead of "never"?

I’m not familiar with that specific config setting, but I think you can just delete the entire setting and then it should fall back to its default value.

Thanks a lot! So, it seems to me the default value of that variable is "always", which I confirmed after I deleted that line from both User and Workspace settings.json files. Somehow, previously, that variable was set as false, most likely by some other packages, but my guess is that the VSCode got updated in the meantime, and that variable is not a bool variable anymore. It has to be a string from three choices: "never", "always", "selection". See editor.find.seedSearchStringFromSelection section at Visual Studio Code User and Workspace Settings