Start using Julia#

See Julia in Visual Studio Code for details.

Tools#

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#

Pkg in Julia docs

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()