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

Apply syntax highlighting to Exprs in REPL #54446

Merged
merged 1 commit into from
Jul 24, 2024

Commits on May 15, 2024

  1. Apply syntax highlighting to Exprs in REPL

    Large exprs (such as those produced by @macroexpand) can be hard to read
    and interpret. This is a problem made easier by JuliaSyntaxHighlighting,
    and with it we can easily apply syntax highlighting when showing exprs.
    
    Normally this would be implemented in Base's show method for Exprs,
    however since JuliaSyntaxHighlighting is a stdlib we must look
    elsewhere, and REPL seems like a sensible place.
    
    To ensure that the IOContext of the REPL IO is properly respected,
    we change the show invocation within the REPL display method to use
    show_repl which falls back to just calling show, as before. We then add
    a show_repl(::IO, ::MIME"text/plain", ::Expr) specialisation, which
    prints expressions with syntax highlighting.
    tecosaur committed May 15, 2024
    Configuration menu
    Copy the full SHA
    2929aa9 View commit details
    Browse the repository at this point in the history