Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alecmev opened this issue Sep 11, 2019 · 8 comments
Open

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

alecmev opened this issue Sep 11, 2019 · 8 comments

Comments

@alecmev
Copy link
Contributor

alecmev commented Sep 11, 2019

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.

@davidanthoff davidanthoff added this to the Backlog milestone Sep 11, 2019
@fredcallaway
Copy link

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

@pgagarinov
Copy link

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.

@zot
Copy link
Contributor

zot commented May 19, 2021

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

@fredcallaway
Copy link

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

@zot
Copy link
Contributor

zot commented May 19, 2021

In Emacs, customize Lsp Julia Default Environment

@roiholtzman
Copy link

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?

@zot
Copy link
Contributor

zot commented May 3, 2022

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

@davidanthoff davidanthoff removed this from the Backlog milestone Oct 15, 2022
@g-adel
Copy link

g-adel commented May 18, 2024

Any update on this issue? I've encountered it recently in a fully set-up environment on VSC.
Edit: I've managed to fix this by just copying the code from one environment to another that previously worked and now it works fine. I don't understand this inconsistency. Why would it work for one environment but not the other when they're both set up in the same way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants