Incorporating `methodswith`

When programming in C++ or Rust or Python, we can just click . and obtain a list of available methods for an object. Since Julia is based on multiple dispatch, there is no such thing as obj.method(). But is it possible to incorporate methodswith into the VSCode plugin for Julia? It would be nice if I strike Ctrl+I after a variable whose type is known and get a list of available methods.

methodswith is a bit too simple: because much of an object’s interface is inherited from its abstract supertype, and because many methods rely on duck typing, many relevant methods won’t appear.

However, it’s possible to come up with something a bit more sophisticated: I did that in this comment, in the context of debating a function chaining syntax. Basically, it recursively calls methodswith on supertypes to show all methods that could be called on this object.

In theory, an autocomplete could also be linked to a database of statistical data from GitHub, or even a personal codebase, to sort the shown methods by the frequency with which they’re called on the object’s type.

The latest function chaining syntax proposal is here.

@wujinq consider using the REPLference.jl package. It was specifically designed for that.

3 Likes