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

Add support for syntax highlighting for code_llvm and code_native #36984

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

kimikage
Copy link
Contributor

This adds the support for syntax highlighting for code_llvm and code_native in InteractiveUtils.

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 in InteractiveUtils, and in fact, there are both opinions as to whether or not it should be implemented in InteractiveUtils.

Also, this is just a cosmetic change, i.e. this only changes the colors. (cf. #36634 (comment))

Closes #36634

@kimikage
Copy link
Contributor Author

I'll close this, but you can re-open this if you want.

@kimikage kimikage closed this Aug 29, 2020
@musm
Copy link
Contributor

musm commented Aug 30, 2020

Are we just looking for someone to review this?

@musm musm reopened this Aug 30, 2020
@musm
Copy link
Contributor

musm commented Aug 30, 2020

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 InteractiveUtils, plus there's a lot of positive support in the linked issue.

@StefanKarpinski
Copy link
Member

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}(
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@musm
Copy link
Contributor

musm commented Oct 1, 2020

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.

@musm musm added triage This should be discussed on a triage call and removed triage This should be discussed on a triage call labels Oct 1, 2020
@JeffBezanson
Copy link
Member

👍

@musm musm merged commit 4422648 into JuliaLang:master Oct 1, 2020
@kimikage
Copy link
Contributor Author

kimikage commented Oct 1, 2020

Thanks for the reviews and merging.

Perhaps we'll get some feedback from the nightly build users. Suggestions for improvement are welcome.

@kimikage kimikage deleted the colored_ll_codes branch October 1, 2020 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Colored printing of code_llvm and code_native
4 participants