Tab completion to find methods for given variable(s)

I just noticed that for the REPL got merged to be included in the next Julia version. This means that the REPL will tab-complete statements like ?(x, y) to yield all methods that apply to x and y. Is there something similar planned for the VSCode extension?

1 Like

Yes, eventually.

Thanks for the fast reply and that you are planning to integrate this. Does this concern the language server side mainly inside textDocument_completion_request ? If there’s no-one working on this yet, I could try to prototype something in a PR.

Yes, but I’d also like to see some improvements to have a better in-editor UX than having to type that ?. Feel free to play around with this though :wink:

1 Like

Sure! Let’s keep some ideas posted here - my first and most blasphemic one would be to just allow OO-like variable.<tab> instead of ?(variable,<tab> - but I guess it will take a longer discussion until something is fixed.

Honestly, just (variable,<tab>/(variable,variable2)<tab>/ <tab>(variable,variable2) might work just fine.

1 Like

You’re right, the first idea was complete nonsense, since it masks struct members with loads of methods. I think your variant without the “?” is a very natural one!

I’d like to vote for (variable,<tab>.


++ (variables,<tab> as well as (variables)<tab> for a fixed number of arguments in addition as in the REPL. I’m anyway wondering why they choose to use ?, as it clashes with the help system.

I filed an issue Autocomplete of methods for given variables · Issue #979 · julia-vscode/LanguageServer.jl · GitHub
and a PR Autocomplete of methods for given variables by krystophny · Pull Request #980 · julia-vscode/LanguageServer.jl · GitHub .

Hope to have something useful soon.

1 Like

One more thing: Per default, Julia matches also methods where any type is allowed as a method argument. This is a bit problematic, as the number of matches becomes very large. Should one limit the completions at least to exclude Any as a type?