LanguageServer.jl
LanguageServer.jl copied to clipboard
feat: autocomplete using inferred type instead of declared type in a function
A function parameter's declared type is used to autocomplete that parameter throughout the function, even when a more precise inferred type is known. For example:
abstract type Parent end
struct Child1 <: Parent
field1::Int
end
struct Child2 <: Parent
field2::String
end
function foo(x::Parent)
if x isa Child1
# can't autocomplete x.field1
x::Child1
# still can't autocomplete x.field1
x = x::Child1
# still can't autocomplete x.field1, even though the language server knows x is of type Child1
(x::Child1) # still can't autocomplete x.field1
end
end
This issue is a feature request to use the inferred type for autocompletion, instead of always using the declared type from the function signature.