Skip to content

show multiple docstrings in REPL more clearly #25651

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

Merged
merged 2 commits into from
Jan 22, 2018
Merged

Conversation

KristofferC
Copy link
Member

This is done by printing a vertical line next to each separate docstring

Before (hard to see where one docstring ends and the other starts):

screen shot 2018-01-20 at 12 05 38

After:

screen shot 2018-01-20 at 12 05 13

This line is only showed when there are multiple docstrings, otherwise print as usual.

@JeffBezanson
Copy link
Member

Maybe a horizontal line between them would make more sense?

@KristofferC
Copy link
Member Author

KristofferC commented Jan 20, 2018

Alright, I change to that. But then I am not changing again! ;)

@KristofferC
Copy link
Member Author

Ok:

screen shot 2018-01-20 at 21 41 19

this is done by printing a horizontal line after each separate docstring
@nalimilan
Copy link
Member

I think we had suggested adding just a very short (2-3 chars) horizontal line in another issue. Have you tried that?

@KristofferC
Copy link
Member Author

I tried it but didn't really like it. Too short and it is not visible enough and when you increase the length it looks odd that it just stops in the middle. I think the current version is pretty ok.

@StefanKarpinski
Copy link
Member

How about bracketed lines like our logging messages?

@JeffBezanson
Copy link
Member

I think a horizontal rule is the natural thing here. We probably wouldn't add a bracket or vertical line for a single doc string, and it's a bit odd for them to suddenly appear when there are multiple doc strings. With log messages there is usually other surrounding output to distinguish them from.

@KristofferC
Copy link
Member Author

KristofferC commented Jan 20, 2018

Yes, I have tried a lot of versions and I like this the most. Having a long vertical line appear just because there are multiple docstrings is a bit weird. Copy pasting docstrings will also be awkward with vertical lines. I think we should try this out.

@ararslan ararslan added the REPL Julia's REPL (Read Eval Print Loop) label Jan 20, 2018
@@ -990,8 +990,8 @@ dynamic_test.x = "test 2"
@test @doc(dynamic_test) == "test 2 Union{}"
@test @doc(dynamic_test(::String)) == "test 2 Tuple{String}"

@test Docs._repl(:(dynamic_test(1.0))) == Expr(:escape, Expr(:macrocall, Symbol("@doc"), LineNumberNode(196, doc_util_path), :(dynamic_test(::typeof(1.0)))))
@test Docs._repl(:(dynamic_test(::String))) == Expr(:escape, Expr(:macrocall, Symbol("@doc"), LineNumberNode(196, doc_util_path), :(dynamic_test(::String))))
@test Docs._repl(:(dynamic_test(1.0))) == Expr(:escape, Expr(:macrocall, Symbol("@doc"), LineNumberNode(214, doc_util_path), :(dynamic_test(::typeof(1.0)))))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really dislike these tests...

@rfourquet
Copy link
Member

x-ref #22870 where this has been also discussed

@JeffBezanson JeffBezanson merged commit bea2fb7 into master Jan 22, 2018
@JeffBezanson JeffBezanson deleted the kc/boxify_docstrings branch January 22, 2018 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants