LSP "Missing reference" woes

AFAICT, VS Code (or the Language Server, more precisely) has trouble with source code that uses the current package but is not part of it. Such as scripts, that are typically placed outside the src subdir (which seems to be the case of your acousticcolorplot.jl file above).

I know of 2 (rather hacky) ways to work around this problem:

  1. put the bulk of the script code in a function inside the sources of the package (ACol in your case). Then your script becomes mostly empty: it reduces to something like

    import ACol
    ACol.acousticcolorplot(...)
    
  2. trick the Language Server into thinking that your script is actually part of the package sources (but in a separate Module so that it sees the same exported names as an independent piece of code). It seems that this can be achieved by putting something like this in ACol.jl:

    @static if false
        module Foo  include("../myscript.jl")  end
    end
    
4 Likes