forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply syntax highlighting to Exprs in REPL (JuliaLang#54446)
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.
- Loading branch information
Showing
4 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters