Julia: Colorize output of `methods` in REPL

Created on 21 Nov 2018  Â·  6Comments  Â·  Source: JuliaLang/julia

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

REPL display and printing

Most helpful comment

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

screenshot 2018-11-21 at 11 17 12

All 6 comments

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

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

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

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.

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

screenshot 2018-11-21 at 11 17 12

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

https://github.com/JuliaLang/julia/blob/ee27e9169e0f7f0e829e6b54a0742417ddb45f20/base/methodshow.jl#L105

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StefanKarpinski picture StefanKarpinski  Â·  3Comments

wilburtownsend picture wilburtownsend  Â·  3Comments

ararslan picture ararslan  Â·  3Comments

dpsanders picture dpsanders  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments