# VSCode's 'Go to definition' to recognise functions from other libraries

**URL:** <https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688>\
**Category:** VS Code\
**Tags:** question\
**Created:** [November 2, 2023, 10:55am UTC](https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688 "2023-11-02T10:55:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![molecularMaestro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/molecularmaestro/32/202902_2.png) [@molecularMaestro](https://discourse.julialang.org/u/molecularMaestro)\
**Post date:** [November 2, 2023, 10:55am UTC](https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688/1 "2023-11-02T10:55:51Z")

</div>

I cannot seem to inspect functions or classes defined in external libraries using VSCode’s ‘Go to definition’ (F12) feature. For example, with the following simple example:

```julia
using Plots

plot([1, 2, 3], [1, 2, 3])

```

I get a `No definition found for 'plot'` message when trying to inspect the plot function from the `Plots` library. It seems to work fine with some basic functions like `+`, but not with others like `typeof`. It seems like it should be possible to get the VSCode Julia extension to recognise functions imported from libraries.

---

<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:** [November 2, 2023, 1:08pm UTC](https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688/2 "2023-11-02T13:08:42Z")

</div>

> [@molecularMaestro](#):
>
> It seems to work fine with some basic functions like `+`, but not with others like `typeof`.

I think `typeof` doesn’t even have a definition consisting of Julia source that you could go to, because it’s a builtin:

```julia-repl
julia> typeof
typeof (built-in function)

julia> +
+ (generic function with 189 methods)

```

---

<div class="post-metadata">

**Author:** ![molecularMaestro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/molecularmaestro/32/202902_2.png) [@molecularMaestro](https://discourse.julialang.org/u/molecularMaestro)\
**Post date:** [November 2, 2023, 2:29pm UTC](https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688/3 "2023-11-02T14:29:21Z")

</div>

Ah ok fair enough, so that example may not be related to the original question. But it still stands to reason that you should be able to located the definition of a function imported from some other library. Particularly because Julia approach of inclusion with `using Package` naturally means it’s very difficult to find the source of a function without this sort of code inspection.

I’d frankly be amazed if I was the only person to have encountered this issue.

---

<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:** [November 2, 2023, 2:56pm UTC](https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688/4 "2023-11-02T14:56:37Z")

</div>

TBH I never tried the “Go to definition” feature, I always just use `@which f(x)`, so I can’t help you much,

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [November 2, 2023, 3:57pm UTC](https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688/5 "2023-11-02T15:57:51Z")

</div>

Make sure the environment selected in VS Code (check the status bar) actually contains the package (Plots in this case) and is resolved. Also check Output \> Julia Language Server for errors in case something about the extension is straight up broken.

---

<div class="post-metadata">

**Author:** ![molecularMaestro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/molecularmaestro/32/202902_2.png) [@molecularMaestro](https://discourse.julialang.org/u/molecularMaestro)\
**Post date:** [November 2, 2023, 4:39pm UTC](https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688/7 "2023-11-02T16:39:23Z")

</div>

Yes the environment selected definitely has Plots installed, as I can activate the same environment in the REPL and run the same lines of code without any issue. However, it seems there are two things going on here, and the issue with the Plots example I gave above may not be related to the problem in the title.

Regarding ‘Go to definition’: after going away and doing some other stuff on my laptop, then coming back deactivating and reactivating the environment a few times (to check on your question of the environment in the status bar), the ‘Go to definition’ feature now seems to be working for most packages and functions where I would expect it to work.

However, it still does not want to recognise the definition of `Plots.plot`, and I now also get a ‘possible method call error’ warning for the `plot` function. If however I replace it with a call to plot3D I get no such warning and am also able to use the ‘go to definition’ tool. So I’m not sure what’s going on there, but it seems to be specific to the example I chose to illustrate a point that has now largely resolved itself.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [November 2, 2023, 7:14pm UTC](https://discourse.julialang.org/t/vscodes-go-to-definition-to-recognise-functions-from-other-libraries/105688/8 "2023-11-02T19:14:41Z")

</div>

What else is in your environment?
