LanguageServer.jl
LanguageServer.jl copied to clipboard
Submodules can't find types from Main module
For a main program project, VSCode and Emacs show type information for the Person struct in included.jl but not in submodule.jl.
When the project itself is a module, things seem to work properly.
Here's the test case that breaks it:
LsTest.jl:
struct Person
name::AbstractString
address::AbstractString
end
include("submodule.jl")
include("included.jl")
submodule.jl:
module Submodule
import ..Main: Person
println(Person)
println(Main.Person)
end
included.jl:
println(Person)
The test case that works is almost the same, except it uses the project module instead of Main...
LsTest2:
module LsTest2
struct Person
name::AbstractString
address::AbstractString
end
include("submodule.jl")
include("included.jl")
end # module
submodule.jl:
module Submodule
import ..LsTest2: Person
println(Person)
println(Main.Person)
end
included.jl:
println(Person)
FWIW, import ..Person works fine in both cases :)
OK, that's a decent workaround in the interim...