Debug why docstrings not showing in REPL help

How can I debug the docstrings not showing up in my REPL?


julia> """
       Function Roger() prints Wilco
       """
"Function Roger() prints Wilco\n"

julia> function Roger()
           println("Wilco")
       end
Roger (generic function with 1 method)
julia> Roger()
Wilco

Now type ? at the julia> prompt to get into help:

help?> Roger
search: Roger RogersTanimoto rogerstanimoto ApproximateSignedRankTest FisherNoncentralHypergeometric PROGRAM_FILE RoundingMode    

  No documentation found.

  Roger is a Function.

  # 1 method for generic function "Roger":
  [1] Roger() in Main at REPL[145]:1

Thanks.

The docstring has to be entered in the same execution. Use alt+enter.

julia> "adsf"
       function foo()
       2
       end
foo

help?> foo
search: foo floor pointer_from_objref OverflowError RoundFromZero unsafe_copyto! functionloc StackOverflowError

  adsf
2 Likes

You can also document an existing function with @doc:

julia> function Roger()
                  println("Wilco")
              end
Roger (generic function with 1 method)

julia> @doc """
              Function Roger() prints Wilco
              """ Roger
Roger

help?> Roger
search: Roger PROGRAM_FILE RoundingMode

  Function Roger() prints Wilco

vs. CTRL-enter?

Use Alt-Enter instead of a simple Enter (or, yes, vs CTRL-Enter since in the REPL that’s the same I think :slight_smile: ).

But Alt-Enter might not work if you’re on Windows apparently, see PSA: Inserting a new line in the REPL and Pick a different key binding for "Insert new line without executing it" at least on Win · Issue #18295 · JuliaLang/julia · GitHub.

1 Like