"Missing reference" warnings with Julia in VS Code?

Hello,

I tried giving VS Code a shot (Atom is my go-to editor). I guess I got too motivated after reading the recent opinions on optimal IDE for Julia…I was wondering if anyone has encountered a “Missing Reference” error could provide some help? The code runs fine but I’d like to not have these warnings, if possible. Happy to provide a screenshot if it helps but this seems similar to what was mentioned here

https://github.com/julia-vscode/julia-vscode/issues/800

Thanks!

4 Likes

2 Likes

I’m also getting these…

1 Like

Same here

1 Like

Same here. I guess a lot of people are having a look into VS Code these days …

EDIT: a few minutes these warnings disappeared …

EDIT: … and then appeared again.

1 Like

In my experience they do not yet work very well. However, there is an option in the VS Code extension settings to have the linter running, but also disable “missing reference” warning.

1 Like

I am also having this issue. Would you mind providing more detail about finding this setting? I went to File->Settings and clicked on extensions. There are a lot of options under extensions.

1 Like

You look up your extensions, click on the wheel for the Julia extension, then click on “extension settings” or something similar and then you choose this:

grafik

If you do not want to use the linter at all, you can also untick this option:
grafik

3 Likes

Thank you. That seems to have fixed some of the warnings. I still find an error that says:

Possible method call error.Julia(Julia)

which underlines my methods in the file. I will report back if I figure out how to fix that.

3 Likes

The problem with this is that I really do want the missing ref warnings, I just want them to be accurate. Turning this off makes debugging more difficult if you’ve misspelled a function name or something like that.

I’m wondering if there’s a way to add references so that the extension is aware of them? Maybe @davidanthoff has a good solution for this? I’d be happy to contribute here as I use VS Code on a daily basis and lately I’ve been using a lot of DataFramesMeta.jl and Makie.jl and I have to prefix all of my function calls to avoid the warnings (e.g. DataFramesMeta.where() or Makie.plot()).

In the case of plotting, this usually isn’t a big deal, but with DataFramesMeta I use the @linq macro to chain a bunch of operations together so prefixing everything with DataFramesMeta results in really nasty-looking code.

1 Like

This is a known problem, we just need to fix it. Not super trivial, but I think we should hopefully resolve it relatively soonish (think weeks not months).

7 Likes

I just installed JuliaPro on my laptop and installed the Julia extension to VS Code and got all the Missing Reference errors anytime I have a using statement

1 Like

I’m more than happy to put some time into assisting with this if you all need an extra pair of hands. I don’t know anything about writing a VS Code extension but, according to the Microsoft docs, it requires having Node.js installed. JavaScript/Node was my first programming language so if there’s something here I can do (without getting in the way), I’m willing to put in a couple of hours per week on this to make the tool better :slightly_smiling_face:. Feel free to reach out and let me know.

2 Likes

So I think this is a problem the core extension team will have to fix, unfortunately. The design questions are too deep in the guts of the code base.

4 Likes

Everything works except those error messages from Julia plugin

Any update regarding this issue? I still get these warnings when using packages. I could disable them but the linter still doesn’t know what packages I’m using so I miss out on a lot of info regarding the methods in the package and possible syntax errors.

Development of Atom has sunsetted:

There have been and still are many false-positive “Missing Reference” issues with LanguageServer.jl. You’d need to create and post a minimum reproducer before we could check and see if your problem is a known issue or a new one. The one people run into most often is LanguageServer does not index active project/package · Issue #988 · julia-vscode/LanguageServer.jl · GitHub.

Check out the read me of GitHub - PetrKryslUCSD/VSCode_Julia_portable: Portable Julia running in VSCode.
That works for me.

It’s really easy to reproduce. Simply creating a new Julia file and having a using Example (where Example is an added package in the global environment), the linter would show a warning underlining Example and any functions in it saying “Missing Reference”. Running the REPL runs the code just fine. Should I post an issue in LanguageServer or the VSCode extension?