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

[Nvim] LanguageServer does not find types defined inside an `@eval` block.

Open MarcoRiggirello opened this issue 8 months ago • 1 comments

As the title says, when I define a type inside @eval block the language is not able to find it. Here's a MWE

x = :MyAbstractType
y = :MyConcreteType

@eval begin
    abstract type $(x) end
    struct $(y) <: $(x)
        a::Real
    end
end

z = MyConcreteType(3)

This code works fine in the REPL but in nvim I get this warning from lsp:

Image

I'm using julia 1.11.3 installed with juliaup and nvim v0.10.4 on linux. Here you can find my nvim config.

MarcoRiggirello avatar Mar 07 '25 13:03 MarcoRiggirello

I think @eval in active environment is not supported. https://discourse.julialang.org/t/symbolserver-cstparser-and-juliasyntax/124075

So, we only use this strategy for packages that are not in the current workspace but are referenced by the active project (roughly).

qwjyh avatar Mar 15 '25 16:03 qwjyh