-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add support for syntax highlighting for code_llvm
and code_native
#36984
Conversation
2adaf79
to
70dd495
Compare
I'll close this, but you can re-open this if you want. |
Are we just looking for someone to review this? |
I think there's a question whether syntax highlighting belongs here. I know we don't highlight Julia code, but this is more benign and doesn't rely on a parser to determine highlighting. I believe the code is simple enough and strongly increases usability of these functions to be considered in |
I agree that this seems worth having. It doesn't add any external dependencies and these formats are pretty stable. And whenever we switch to using a better parser for Julia itself, we'll probably add syntax highlighting for Julia code in the REPL too. |
@@ -1,17 +1,46 @@ | |||
# This file is a part of Julia. License is MIT: https://julialang.org/license | |||
|
|||
# highlighting settings | |||
highlighting = Dict{Symbol, Bool}( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these dictionaries be const
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, there is no public API to change the configuration, so I think specifying const
would only make them less convenient.
Of course, I'm in favor of adding the public API. However, it should be designed to be consistent with the design for customization APIs of other features (e.g. stack traces). I think that requires a separate discussion.
I added the triage label, to discuss if this is ok to merge. IMO I think it is and as you mention Stefan, if we had a better/faster Julia parser in Julia we would also syntax highlight Julia code in the REPL. |
👍 |
Thanks for the reviews and merging. Perhaps we'll get some feedback from the nightly build users. Suggestions for improvement are welcome. |
This adds the support for syntax highlighting for
code_llvm
andcode_native
inInteractiveUtils
.This code comes from the newly registered package
ColoredLLCodes.jl
.With that package, you can try out the syntax highlighting feature.I have no intention of abandoning the maintenance of
ColoredLLCodes.jl
in order to use the syntax highlighting within older versions of Julia. Therefore, there is no need to implement this feature inInteractiveUtils
, and in fact, there are both opinions as to whether or not it should be implemented inInteractiveUtils
.Also, this is just a cosmetic change, i.e. this only changes the colors. (cf. #36634 (comment))
Closes #36634