REPL and (VSC Notebook & linter) are seeing different environments

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.

OP here.

What I had changed a couple of weeks ago to cause this problem was to set the setting for Julia > lint: missingrefs to all; before it was none.

Now, I reset the Julia VSC extension to its defaults. I then renamed the Manifest.toml and Project.toml files in the workspace folder to Not Manifest.toml and Not Project.toml. Both REPL and Notebook sessions now operate as expected and the linter reports no missing packages.

So, before renaming the files, the linter was using the Workspace environment instead of the designated environment. I believe this might be a bug.

The only remaining problem is that the linter is reporting a missing reference which is declared in the startup.jl file. So apparently the linter is not seeing this file but everything else is. This file is at /Users/me/.julia/config/startup.jl with a symlink at /Users/jerrybauck/Documents/Programs/Julia/Code/startup link.jl.

FWIW, the reported missing reference from startup.jl PO which looks like this:

Plot_Options = (linewidth=2, color=[:red :blue :green :firebrick :purple :green3 :brown :gold],
    size=(600, 400))
PO = Plot_Options