Finding functions

One issue I have with Julia is remembering the name of functions and what they do. In a typical OOP language and IDE/editor typing the name of an object and then the dot character a pop-up window will produce a list of all available functions and their documentation. In VS Code is there some facility to help with this issue?

2 Likes

If I understand correctly, this is a quite general problem given how multiple dispatch creates a large number of possible operations on a given type. I remember reading a discussion about the same issue here:

It’s already a few years old, so I’m not sure if there are some new developments in VSC since then, but maybe you find methodswith helpful.

Also just found this (haven’t looked at the suggestions in detail yet, but sounds like it could be usefule as well):

1 Like

Also note that entering a word in quotes within the help mode (which triggers the InteractiveUtils.apropos function) gives you a list of all the methods in whose docstrings said word appears.

6 Likes

The problem is that one may not even know what function name to look for but only that he wants to find a function that does something specific and it is applicable to a datatype of interest.

Perhaps, an AI-based search system could do the job using as input the functionality a user is looking for (typed words) and the datatype of interest, using for the search the available documentation.

That’s why I like apropos: if your function does “something specific”, the something specific may not be in the function name but it has more likelihood of popping up in the function docstring

1 Like

– and in which package is it contained :slightly_smiling_face:

Here, asking the question is probably currently the best way. But you are right, this is the case where AI could be very helpful.

1 Like

I believe @xgdgsc has a working proof-of-concept of postfix completion, which lets one still use the dot syntax for autocomplete. See Allowing the object.method(args...) syntax as an alias for method(object, args ...) - #218 by xgdgsc. Last I checked, they were still trying to upstream it into the VS Code extension and Julia language server.

3 Likes

That completion user interface is quite unintuitive, it seems like it would completely confuse anyone who doesn’t know about this specific feature. Wouldn’t it be all-around much better to have a new window pop up or something like that?

Ever since Julia 1.8 (julia#38791 by @tim.holy), you can type ??(object, <tab> and it will list methods that take that object type as a first argument.

You can also use methodswith(typeof(object)) to list all methods that take any argument of that type (whether or not it is the first argument).

9 Likes

Please, do not. I still hate R for forcing our lab servers to install a full graphic environment just so someone can select the mirror during the first run.

I’m talking about the proposed VS Code PR. Pretty sure that Code requires a graphical environment anyway.