How to properly create, activate, and resume, an environment in VSCode

My standard workflow looks like this (I’m on Windows):

Open PowerShell then:

  • cd wherever/I/want/my/project

  • mkdir ProjectName

  • cd ProjectName

  • code .

Now, VS Code will be open in the directory that I just created. I open a Julia REPL from the VS Code menu and then

  • ] to enter the package manager

  • activate .

  • add Whatever Packages Are Needed

After adding packages I have a Project.toml so I click in the lower left:

image

and select the environment ProjectName. Now, every time I want to go back to this project and continue working on it I simply cd into it via PowerShell and type the code . command and it will open in VSCode and the correct environment will be automatically loaded since there is a Project.toml.

10 Likes