LanguageServer.jl icon indicating copy to clipboard operation
LanguageServer.jl copied to clipboard

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

Open alecmev opened this issue 4 years ago • 8 comments

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.

alecmev avatar Sep 11 '19 11:09 alecmev

I'm having this problem as well. LSP is tagging all my non-base imports as missing reference. Is there a hot fix workaround?

fredcallaway avatar Jul 10 '20 22:07 fredcallaway

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.

pgagarinov avatar Mar 26 '21 16:03 pgagarinov

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...

zot avatar May 19 '21 15:05 zot

Thanks, @zot! Where did you change the configuration (i.e. which file)?

fredcallaway avatar May 19 '21 16:05 fredcallaway

In Emacs, customize Lsp Julia Default Environment

zot avatar May 19 '21 16:05 zot

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?

roiholtzman avatar May 03 '22 07:05 roiholtzman

Sorry, I do most of my work with 1.6, right now, so I haven't used it with 1.7 much.

zot avatar May 03 '22 18:05 zot