non-Jedi / eglot-jl

Wrapper for using Julia LanguageServer.jl with emacs eglot
Creative Commons Zero v1.0 Universal
62 stars 11 forks source link

Missing references with macros #41

Closed johannesnauta closed 1 year ago

johannesnauta commented 1 year ago

I am unsure if this is the right repository to post this question/issue, but I am experiencing missing references when using eglot-jl, mostly when using macros (e.g. the Symbolics.jl macro @variables). Other than having flymake suppress missing references, is there perhaps a patch that fixes this? Or do you have any idea where the error might originate from?

image

ffevotte commented 1 year ago

Yes, I think this has to do with LanguageServer.jl. AFAIK the issue is that @variables introduces a new binding t, which is something that you (as a human) know thanks to the semantics of the macro, but the language server does not. In other words, consider that:

@show x      # missing reference
@variables y # this is actually fine

AFAIU the Language Server does not (yet?) distinguish between these two very similar constructs.

See also e.g. julia-vscode/LanguageServer.jl#1161

johannesnauta commented 1 year ago

Yeah that makes sense, I will close this issue here as it appears to not be an issue with eglot-jl specifically. I understand that it might be difficult to parse, but macros are widely used in Julia. For now I will just suppress the warnings until a patch appears, or until I find time to look into it more myself.