# VS Code is not detecting parent environment

**URL:** <https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393>\
**Category:** New to Julia\
**Created:** [August 14, 2021, 1:57pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393 "2021-08-14T13:57:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![usman0311](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@usman0311](https://discourse.julialang.org/u/usman0311)\
**Post date:** [August 14, 2021, 1:57pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/1 "2021-08-14T13:57:01Z")

</div>

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

 ![vscode](https://global.discourse-cdn.com/julialang/original/3X/a/3/a327177e8ee312cfc5fc56cf84a735eab2bfc317.jpeg)

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [August 14, 2021, 4:00pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/2 "2021-08-14T16:00:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![usman0311](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@usman0311](https://discourse.julialang.org/u/usman0311)\
**Post date:** [August 14, 2021, 6:09pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/3 "2021-08-14T18:09:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [August 14, 2021, 6:25pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/4 "2021-08-14T18:25:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![usman0311](https://avatars.discourse-cdn.com/v4/letter/u/2bfe46/32.png) [@usman0311](https://discourse.julialang.org/u/usman0311)\
**Post date:** [August 15, 2021, 9:59am UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/5 "2021-08-15T09:59:13Z")

</div>

Thanks a lot I will try this

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [August 19, 2021, 8:37pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/6 "2021-08-19T20:37:24Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [August 19, 2021, 8:52pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/7 "2021-08-19T20:52:55Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [August 19, 2021, 9:40pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/8 "2021-08-19T21:40:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [August 19, 2021, 10:52pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/9 "2021-08-19T22:52:04Z")

</div>

@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"`?

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [August 19, 2021, 11:58pm UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/10 "2021-08-19T23:58:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Post date:** [August 20, 2021, 1:53am UTC](https://discourse.julialang.org/t/vs-code-is-not-detecting-parent-environment/66393/11 "2021-08-20T01:53:07Z")

</div>

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](https://code.visualstudio.com/docs/getstarted/settings#_default-settings)
