Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script-style doctests don't appear in the REPL's help?> when OhMyREPL is loaded #293

Open
navidcy opened this issue Mar 1, 2023 · 3 comments
Labels

Comments

@navidcy
Copy link

navidcy commented Mar 1, 2023

I've been struggling with this for a bit and I think it has something to do with OhMyREPL.

I define a function foo with a docstring that includes a doctest with a "script" example. Then I ask for the help?> foo and if OhMyREPL is loaded then the doctest does not appear!

(Note that if I used a REPL example doctest then all is good!)

Here's a MWE.

Af first I load Julia without OhMyREPL. Everything looks OK. If then I load OhMyREPL and ask again of the docstring of foo the example is disappeared!

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.5 (2023-01-08)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |


julia> """
           foo(x)

       A function called foo.

       Example
       =======
       ```jldoctest
       foo(2)
       # output
       2
       ```
       """
       foo(x) = x
foo

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

  foo(x)

  A function called foo.

  Example
  ≡≡≡≡≡≡≡≡≡

  foo(2)
  # output
  2

julia> using OhMyREPL

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

  foo(x)


  A function called foo.

  Example
  ≡≡≡≡≡≡≡≡≡


julia>
@navidcy navidcy changed the title Script style doctests don't appear in the REPL help? > when OhMyREPL is loaded Script style doctests don't appear in the REPL help?> when OhMyREPL is loaded Mar 1, 2023
@navidcy navidcy changed the title Script style doctests don't appear in the REPL help?> when OhMyREPL is loaded Script-style doctests don't appear in the REPL's help?> when OhMyREPL is loaded Mar 1, 2023
@KristofferC KristofferC added the bug label Mar 8, 2023
@KristofferC
Copy link
Owner

The issue here is that you are doing a jldoctest but you do not include the julia> prompt. Doing it as:

"""
           foo(x)

       A function called foo.

       Example
       =======
       ```jldoctest
       julia> foo(2) # <------------- note julia>
       # output
       2
       ```
       """
       foo(x) = x

Makes it work. I'll try fix this nonetheless.

@navidcy
Copy link
Author

navidcy commented Mar 8, 2023

True. But without OhMyREPL it works both ways. So I was getting confused and puzzled why I wasn't seeing the docstring examples but others could see them.

@navidcy
Copy link
Author

navidcy commented May 9, 2023

x-ref: https://discourse.julialang.org/t/doctests-dont-appear-in-repl-help-mode/98534

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants