Start using Julia
See Julia in Visual Studio Code for details.
Tools
- Install Julia in the official website or via the Windows store.
- Install VS Code.
- Install the Julia extension for VS Code
- (Optional) Install the Jupyter extension for VS Code for opening and running Jupyter notebooks with Julia kernels in VS Code.
Running Julia in VS Code
Julia extension will be automatically activated upon opening a Julia file (*.jl).
You can open the command palette (Ctrl + Shift + P in windows) and search “Julia” for available commands and keyboard shortcuts. The most used on is Shift + Enter: to execute the current selected line.
Package management in Julia
In regular environments Project.toml and Manifest.toml describe the dependencies.
Install packages
In the Julia script
using Pkg
# Using the current directory as the project folder
Pkg.activate(".")
# Or: Using the directory where the script resides as the project folder
Pkg.activate(@__DIR__)
# Add packages
Pkg.add("Plots")See installed packages
using Pkg
Pkg.status()Remove packages
using Pkg
Pkg.remove("Plots")Update installed packages
using Pkg
Pkg.update()Create / Use a environment
using Pkg
# Activate environment in the foldername directory
Pkg.activate("foldername")
# Or activate the current working directory
# current_project() is a little bit misleading
# since it actually looks for an available Project.toml file
Pkg.activate(".")
# Reproduce the environment
Pkg.instantiate()
# If the above failed, try this
Pkg.resolve()