Autocomplete for keys of keyword arguments; is it possible?

is there anyway to have autocomplete for keyword arguments?

1 Like

In what editor? Repl?

Any one, REPL, etc.

I don’t remember why I asked, because I don’t think it’s implemented anywhere. In theory, you could have the repl use the definitions of functions to do this, and editors could at least complete for any function definitions in your files^†. But I don’t think any do. Part of the reason is that a lot of functions accept any keyword argument, function f(x; kwargs...), so it would probably be a lot of work for a feature that doesn’t even apply half of the time.

^† Note that there’s a hazard here, since different methods can accept different kwargs.

# In a file you don't own
function cook(p::Potato; peeled=false)
    # definition
end

# in your file
function cook(c::Chicken; plucked=true)
    # definition
end

Auto complete would now suggest cook(potato; plucked).

1 Like

https://github.com/JuliaLang/julia/pull/43536

5 Likes

Is there a way to do that in vscode?
I turned run time complete on but it does not autocomplete kwargs of functions in Makie.jl.