I get repeated Missing reference warnings in LanguageServer.jl when I use JuMP.jl models.
For example:
@variable(m, x >= 0)
The LS reports Missing reference: x.
I can understand why LanguageServer.jl might have difficulty with this type of syntax.
Just wondering if this is expected behavior and/or if anyone has any workarounds to get some sort of reliable LS support when working with JuMP.
I can’t speak for JuMP specifically, but my guess is no. Currently the LanguageServer does not expand macros, so it can’t see what variables will be defined by macros. I ran into this problem using Sumtypes.jl.
The reason it doesn’t expand is because macros can run arbitrary code that could cause side effects. However, Pluto notebooks already handle this behavior (expand macros silently and check for defined variables) so it should be possible, in theory.
But for the moment, you can just go into the VSCode Julia extension settings and turn off Missing Reference errors.