Why isn't this example function being documented?

I am trying to document my functions with mixed results. This simple example, which I pasted on the julia> prompt, does not seem to work:

"""
    foo(x, y)

Some comment.

Another comment.
"""
function foo(x, y)
    return x + y^2
end    

What I get is:

help?> foo
search: foo floor wf_boot_CI portfoliocomposition portfoliocomposition! ft_nonothing

  No documentation found.

  foo is a Function.

  # 1 method for generic function "foo":
  [1] foo(x, y) in Main at REPL[240]:1

What am I doing wrong?

do ? bar instead of ? bar(x, y)

A simplified version, with “foo” instead of “bar”, still does not work:

help?> foo
search: foo floor wf_boot_CI portfoliocomposition portfoliocomposition! ft_nonothing

  No documentation found.

  foo is a Function.

  # 1 method for generic function "foo":
  [1] foo(x, y) in Main at REPL[240]:1

I cannot reproduce your issue, i just copied and pasted your code, and it works as expected for me (Julia v1.7.1 on Linux)

Make sure that you paste the code as one piece. It might happen that the multi-line string and the function definition get evaluated separately when you paste the code line by line.