How to specify pkg environment for Visual Studio Code project?

Hi, I have done:

] activate MyPackage

And then everything works correctly, i.e. adding packages only into this project when doing Pkg.add etc.

But whenever I try to execute some code from Visual Studio Code I have to consistenly activate again if I exit terminal.

How to avoid this?

Kind regards

Press CTRL + Shift + P and search for the command Julia: Start REPL. The REPL will automatically start with the current env that the Julia Extension is using.

Julia Repl


How do I change the current environment?

It still sticks to @v1.8 even when I do it the way you showed me :blush:

Kind regards

If you click were i highlighted in the last image, a menu will open for you to choose an environment.



Normally you wouldn’t need to do that, because the extension can automatically determine which environment to use. But sometimes that doesn’t work.

Edit: you would only need to do this once.

1 Like

Thank you!

Works exactly as you describe. Quite obvious in hindsight, my eyes was just looking everywhere instead of bottom left…

Kind regards