Go To Definition (F12) does not work for functions in an included file

When I highlight the name of a function foo that was defined in a file myfile.jl that was included in my code like this:

# Contents of myfile.jl
some code
include(myfile.jl)
some more code
x = foo(y)
still more code

where the function foo is defined in myfile.jl, and then hit F12 I get a message

No definition found for 'foo'

Is there an easy way to fix this?

This sounds like the behavior of an editor or IDE. What are you using? VSCode? Atom? Emacs?

VSCode. Sorry, I should have specified it.