Tab completion to find methods for given variable(s)

I just noticed that https://github.com/JuliaLang/julia/pull/38791 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:

2 Likes

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>.

3 Likes

++ (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 https://github.com/julia-vscode/LanguageServer.jl/issues/979
and a PR https://github.com/julia-vscode/LanguageServer.jl/pull/980 .

Hope to have something useful soon.

2 Likes

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?

1 Like

I recently found an issue about this problem on the Julia github repository.
https://github.com/JuliaLang/julia/issues/52661#issuecomment-1872156534

You can try my branch Feat/methodswith dot completion by xgdgsc · Pull Request #3240 · julia-vscode/julia-vscode (github.com) at Release A quick dot methods completion demo · xgdgsc/julia-vscode (github.com)