I’ve used Julia with VS Code for some years. A few days ago I started getting linting errors from the VSC extension related to missing Julia packages. I don’t know what (I) changed to make this happen.
I’ve learned that there are two environments. During shell or REPL execution of Julia files, running
println(Pkg.project().path)
causes
/Users/me/.julia/environments/v1.10/Project.toml
However, running the same command from a Jupyter notebook causes
/Users/me/Documents/Programs/Julia/Code/Project.toml
These two installations contain different packages. (I only now realized this was happening.) It seems that the linter is seeing the latter path, based on what it complains about regarding missing packages. But the linter has worked without problems for some years. Also, the Julia VSC extension now crashes every time I start VSC.
I have changed pretty much everything that can be changed so I’ve probably messed things up badly. Here’s what I have (macOS):
Julia Executable Path is /Applications/Julia-1.10.app/Contents/Resources/julia/bin/julia
Julia Language Server Executable Path is /Applications/Julia-1.10.app/Contents/Resources/julia/bin/julia
(the same)
Julia Environment Path is /Users/me/.julia/environments/v1.10
There are some other settings which I’m not so sure about. For example, inside .vscode/launch.json
is "juliaEnv": "${command:activeJuliaEnvironment}"
. This seems like a likely culprit.
How do I fix this mess? My preferred installation is the default one for the official macOS Julia installation.