# LSP "Missing reference" woes

**URL:** <https://discourse.julialang.org/t/lsp-missing-reference-woes/98231>\
**Category:** General Usage\
**Created:** [May 3, 2023, 4:03am UTC](https://discourse.julialang.org/t/lsp-missing-reference-woes/98231 "2023-05-03T04:03:40Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [May 11, 2023, 5:00pm UTC](https://discourse.julialang.org/t/lsp-missing-reference-woes/98231/16 "2023-05-11T17:00:44Z")

</div>

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 https://github.com/JuliaLang/Example.jl`, open the project in VSCode and add a `script.jl` file at its root. It should look like this:

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

```

```julia
# script.jl
using Example

println(hello("World"))

```

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:

```julia
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
    include("../script.jl")
end

end

```

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

---

_[View the full topic](https://discourse.julialang.org/t/lsp-missing-reference-woes/98231)._
