`Missing Reference: _` using Chain.jl

I have been enjoying using Chain.jl. However, the VSCode Linter’s Missing Reference check doesn’t like that it requires using the underscore symbol without declaring a value for it. Is there any workaround for these false positives? Perhaps a way to tell the linter to ignore certain symbols?

Chain.jl really doesn’t play well with linting, because you use the “wrong” call syntax from the linter’s perspective when you omit the first argument… Similarly with the underscore. I don’t know if there’s any way to deal with that except completely disabling linting.

1 Like

I thought so. Ah well! Thanks for the sanity check!

In principle, I guess Chain might be common enough and simple enough that one could write linter exceptions for it. But you quickly get into difficult territory like that.

It would be very cool if we could get the linter tools to the point where it could expand the macro and only mark errors if the resulting transformation still had missing references and whatnot. But even my intermediate knowledge of metaprogramming is enough to know that is… a thorny problem :sweat_smile:

This is similar to what Pluto.jl does for its code analysis, they also have to pre-expand macros so they know if variables are going to be created / modified. @fonsp I always thought that the main problem here is that a macro could in theory run arbitrary code, and that could even be stateful. Have you run into many such cases with Pluto or are macro writers generally well-behaved? :slight_smile: