LanguageServer.jl
LanguageServer.jl copied to clipboard
"Missing reference" on module imports which aren't missing
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:
https://github.com/julia-vscode/LanguageServer.jl/blob/fe9d9bd348f137f99cfe9b7f528d9a572876593f/src/languageserverinstance.jl#L20
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 https://github.com/julia-vscode/LanguageServer.jl/issues/313 too.
I'm having this problem as well. LSP is tagging all my non-base imports as missing reference. Is there a hot fix workaround?
Same problem here - I'm using JupyterLab with jupyterlab-lsp, the latter detects LS.jl but those "missing references" warnings completely kill the user experience. I would be good to know some workaround.
I had this problem with Emacs and it was because the default configuration used the v1.0 julia environment. I changed it to v1.6 and the missing reference errors disappeared. Hope this helps...
Thanks, @zot! Where did you change the configuration (i.e. which file)?
In Emacs, customize Lsp Julia Default Environment
I am having this same problem even when I set lsp-julia-default-environment
to "~/.julia/environments/v1.7"
.
@zot do you know why it does not fix the problem?
Sorry, I do most of my work with 1.6, right now, so I haven't used it with 1.7 much.