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

`Missing reference` from indirect dependencies

Open chriselrod opened this issue 2 years ago • 1 comments

Minimal example:

module Bar
bar() = 0
export bar
end
module Foo
using ..Bar
export bar
end
using .Foo
# using .Bar # uncommenting gets rid of the warning
bar()

For me, bar is underlined with the message Julia: Missing reference: bar. If instead using Bar, the message goes away.

This can be annoying, as libraries importing methods, extending them, and re-exporting is common practice. Dependent packages may only be interested in the extensions, but they're forced to also explicitly depend on the original package defining the method and using it directly from that source -- which could be viewed as an implementation detail -- to appease the language server.

chriselrod avatar Jan 14 '23 21:01 chriselrod

The funny thing is

julia> names(Bar)
2-element Vector{Symbol}:
 :Bar
 :bar

julia> names(Foo)
2-element Vector{Symbol}:
 :Foo
 :bar

And I'd thought names was used to find the symbols.

chriselrod avatar Jan 15 '23 12:01 chriselrod