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

Colorize output of methods in REPL #30110

Closed
oxinabox opened this issue Nov 21, 2018 · 6 comments · Fixed by #45069
Closed

Colorize output of methods in REPL #30110

oxinabox opened this issue Nov 21, 2018 · 6 comments · Fixed by #45069
Labels
display and printing Aesthetics and correctness of printed representations of objects. REPL Julia's REPL (Read Eval Print Loop)

Comments

@oxinabox
Copy link
Contributor

The output of methods can be hard to read in the REPL
It would be good to use some colour (/bold)
to seperate the signature from the line-info.

You can see that in the stacktrace at the top of the image below.
Contrast how easy to read it is, vs the methods list at the bottom.

image

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Nov 21, 2018

Seems like an OhMyREPL enhancement rather than a Base one? cc @KristofferC

@oxinabox
Copy link
Contributor Author

could be
though OhMyREPL does not currently do any reformatting of outputs / display/show

And doing this would most definately be monkey-patching show.

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Nov 21, 2018

The colorization in your REPL is not due to Base and requires OhMyREPL/CSTParser, which is not a stdlib. So doing this would either require including CSTParser and much of OhMyREPL in stdlib or it would require having OhMyREPL monkey-patch Base's printing of methods to colorize them.

@KristofferC
Copy link
Member

It could perhaps be colorized in the same way as the stacktrace.

screenshot 2018-11-21 at 11 17 12

@oxinabox
Copy link
Contributor Author

The colorization in your REPL is not due to Base and requires OhMyREPL/CSTParser, which is not a stdlib.

The colorisation in the outputs of my REPL, is entirely due to Base.
(You are correct that the colorisation of the inputs are OhMyREPL, which I should have turned off before taking the screenshot, so as to avoid confusion).

No CSTParser is needed to color the method printing.
It would just need some tweaking in this method

function show(io::IO, m::Method; kwtype::Union{DataType, Nothing}=nothing)

@kshyatt kshyatt added REPL Julia's REPL (Read Eval Print Loop) display and printing Aesthetics and correctness of printed representations of objects. labels Nov 28, 2018
@o314
Copy link
Contributor

o314 commented Oct 24, 2019

It seems to me that print(IOContext(stdout, :compact => true), methods(+)) does not handle compact correctly. It could be a good thing to fix them both by the way, they're very close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display and printing Aesthetics and correctness of printed representations of objects. REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
5 participants