LSP "Missing reference" woes

First, be aware it’s very hacky and messes up a bit with inline evaluation (which I don’t use much because I actually use Emacs for my day-to-day work). But let me try and give a step-by-step procedure that demonstrates this trick on a simple package like Example.jl. You should be able to reproduce this on your system.

First, git clone, open the project in VSCode and add a script.jl file at its root. It should look like this:

├── Project.toml
├── script.jl       # <-- newly added file
└── src
    └── Example.jl
# script.jl
using Example


At first, LanguageServer is not happy with the reference to Example.hello: for example, neither the inline doc nor the “Go to definition” command work.

Now, if you edit src/Example.jl to read:

module Example
export hello, domath

# [...]
# I'm skipping the definitions of `hello` and `domath`

# Add this part to "trick" LSP into thinking that `../script.jl`
# is actually part of the sources
@static if false


Now VSCode / LSP should be more happy and find what hello refers to in script.jl. Does that work for you?