Skip to content

"Missing reference" on module imports which aren't missing #391

@alecmev

Description

@alecmev

I'm using LS.jl with Sublime. A problem I've encountered is that sometimes some imports get marked as "Missing reference", but not in VSC and not when running the script.

After some digging, I believe I have found the culprit, which is env_path defaulting to "" here:

function LanguageServerInstance(pipe_in, pipe_out, debug_mode::Bool = false, env_path = "", depot_path = "", packages = Dict())

Since ("" == nothing) == false, the second branch gets executed here, instead of the first:

https://github.com/julia-vscode/SymbolServer.jl/blob/54e5263f30720a4629d7753f8b2ef9034a5c49ac/src/SymbolServer.jl#L39-L43

This doesn't affect VSC because the extension supplies an environment unconditionally:

https://github.com/julia-vscode/julia-vscode/blob/f34438f110c7a21b7883fbdd6fa843aafed9d925/src/extension.ts#L149

https://github.com/julia-vscode/julia-vscode/blob/f34438f110c7a21b7883fbdd6fa843aafed9d925/src/jlpkgenv.ts#L147-L183

LS.jl should either default to nothing, or SS.jl should handle empty strings. Not making a PR because I don't know what you prefer. Supplying nothing to SymbolServerProcess appears to have resolved the issue for me.

May or may not be the cause of #313 too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions