# Finding functions

**URL:** <https://discourse.julialang.org/t/finding-functions/105285>\
**Category:** General Usage\
**Tags:** question, vscode\
**Created:** [October 22, 2023, 5:44pm UTC](https://discourse.julialang.org/t/finding-functions/105285 "2023-10-22T17:44:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![panos.asproulis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/panos.asproulis/32/23368_2.png) [@panos.asproulis](https://discourse.julialang.org/u/panos.asproulis)\
**Post date:** [October 22, 2023, 5:44pm UTC](https://discourse.julialang.org/t/finding-functions/105285/1 "2023-10-22T17:44:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Sevi](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@Sevi](https://discourse.julialang.org/u/Sevi)\
**Post date:** [October 22, 2023, 8:37pm UTC](https://discourse.julialang.org/t/finding-functions/105285/2 "2023-10-22T20:37:01Z")

</div>

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:

> [@How to discover functions which apply to a given object?](https://discourse.julialang.org/t/how-to-discover-functions-which-apply-to-a-given-object/21087):
>
> This is, at it’s heart, a question related to user experience, particular with an eye toward rapid prototyping. For me, one of the things which makes Python so great for rapid prototyping is the ability to easily discover functionality without digging through the source code or the documentation. I can create an object A, hit A.\<tab\>, and I will be presented with a list of all the sorts of things I might want to do with A. The tab-complete and shift-tab lookup in Jupyter makes it possible to ge…

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):

> [@Usability idea for IDEs - dotting your way through](https://discourse.julialang.org/t/usability-idea-for-ides-dotting-your-way-through/35213/2):
>
> Good idea. Let me point out that this has come up before here on discourse. For example, take a look at [My mental load using Julia is much higher than, e.g., in Python. How to reduce it? - #48 by ninjaaron](https://discourse.julialang.org/t/my-mental-load-using-julia-is-much-higher-than-e-g-in-python-how-to-reduce-it/18902/48), or [Why is multiple dispatch a feature? - #24 by jonathanBieler](https://discourse.julialang.org/t/why-is-multiple-dispatch-a-feature/31101/24), or [Typeaware autocompletion](https://discourse.julialang.org/t/typeaware-autocompletion/3268). Also, you might want to check out implementations in similar directions, like [InteractiveCodeSearch.jl](https://github.com/tkf/InteractiveCodeSearch.jl).

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [October 23, 2023, 5:47am UTC](https://discourse.julialang.org/t/finding-functions/105285/3 "2023-10-23T05:47:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![panos.asproulis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/panos.asproulis/32/23368_2.png) [@panos.asproulis](https://discourse.julialang.org/u/panos.asproulis)\
**Post date:** [October 23, 2023, 5:37pm UTC](https://discourse.julialang.org/t/finding-functions/105285/4 "2023-10-23T17:37:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [October 23, 2023, 5:41pm UTC](https://discourse.julialang.org/t/finding-functions/105285/5 "2023-10-23T17:41:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [October 23, 2023, 5:45pm UTC](https://discourse.julialang.org/t/finding-functions/105285/6 "2023-10-23T17:45:27Z")

</div>

> [@panos.asproulis](#):
>
> The problem is that one may not even know what function name to look for

– and in which package is it contained 🙂

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

---

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [October 23, 2023, 9:48pm UTC](https://discourse.julialang.org/t/finding-functions/105285/7 "2023-10-23T21:48:04Z")

</div>

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](https://discourse.julialang.org/t/allowing-the-object-method-args-syntax-as-an-alias-for-method-object-args/62051/218). Last I checked, they were still trying to upstream it into the VS Code extension and Julia language server.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 24, 2023, 1:10am UTC](https://discourse.julialang.org/t/finding-functions/105285/8 "2023-10-24T01:10:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [October 24, 2023, 1:15am UTC](https://discourse.julialang.org/t/finding-functions/105285/9 "2023-10-24T01:15:17Z")

</div>

> [@panos.asproulis](#):
>
> 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?

> [@panos.asproulis](#):
>
> 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.

Ever since Julia 1.8 ([julia#38791](https://github.com/JuliaLang/julia/pull/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))](https://docs.julialang.org/en/v1/stdlib/InteractiveUtils/#InteractiveUtils.methodswith) to list all methods that take any argument of that type (whether or not it is the first argument).

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [October 24, 2023, 2:33am UTC](https://discourse.julialang.org/t/finding-functions/105285/10 "2023-10-24T02:33:16Z")

</div>

> [@nsajko](#):
>
> Wouldn’t it be all-around much better to have a new window pop up or something like that?

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.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 24, 2023, 10:10am UTC](https://discourse.julialang.org/t/finding-functions/105285/11 "2023-10-24T10:10:59Z")

</div>

> [@Henrique\_Becker](#):
>
> forcing our lab servers to install a full graphic environment

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

---

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [May 2, 2024, 2:36pm UTC](https://discourse.julialang.org/t/finding-functions/105285/12 "2024-05-02T14:36:10Z")

</div>

> [@stevengj](#):
>
> Ever since Julia 1.8 ([julia#38791](https://github.com/JuliaLang/julia/pull/38791) by @tim.holy), you can type `??(object, <tab>` and it will list methods that take that object type as a first argument.

I had high hopes when I read that, but in many cases it seems pretty useless. For example, I have a `Dict{String, Any}` (the result of `ArgParse.parse_args()`), and I wanted to see what methods are available for getting stuff out of it. Here’s what I see:

```julia
help?> ?(args
rem(x, y, ::RoundingMode{:FromZero}) @ Base div.jl:103
rem(x, y, r::RoundingMode{:Nearest}) @ Base div.jl:100
rem(x, y, ::RoundingMode{:Up}) @ Base div.jl:99
rem(x, y, ::RoundingMode{:Down}) @ Base div.jl:98
rem(x, y, ::RoundingMode{:ToZero}) @ Base div.jl:97
rem(a::T, b::Base.MultiplicativeInverses.MultiplicativeInverse{T}) where T @ Base.MultiplicativeInverses multinverses.jl:168
getproperty(x, f::Symbol, order::Symbol) @ Base Base.jl:58

... 287 lines total ...

reduce(op::OP, x::SentinelArrays.ChainedVector) where OP @ SentinelArrays ~/.julia/packages/SentinelArrays/1kRo4/src/chainedvector.jl:781
reduce(op, A::AbstractArray; kw...) @ Base reducedim.jl:406
StepRange(start::T, step::S, stop::T) where {T, S} @ Base range.jl:379

```

Most of that stuff is decidedly non-useful to use on this `Dict` object. Maybe it’s a useful technique on a much more focused type, but it seems like we’d still get caught in the driftnet of methods whose first argument is untyped.

Is there a better technique for using this capability effectively?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 2, 2024, 5:20pm UTC](https://discourse.julialang.org/t/finding-functions/105285/13 "2024-05-02T17:20:33Z")

</div>

> [@Ken\_Williams](#):
>
> it seems like we’d still get caught in the driftnet of methods whose first argument is untyped.

Yeah, it might be more useful to filter out methods that match only because they are untyped (`Any`) arguments, also suggested by @tim.holy [here](https://github.com/JuliaLang/julia/pull/38791#issuecomment-886250355).

---

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [May 3, 2024, 9:29pm UTC](https://discourse.julialang.org/t/finding-functions/105285/14 "2024-05-03T21:29:08Z")

</div>

Yes, or perhaps to use a ranking system to surface the methods that are most likely to be applicable and only show the first n results by default?
