-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
REPL: Show input alias (e.g., \\:cat:) for Char display #58181
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
REPL: Show input alias (e.g., \\:cat:) for Char display #58181
Conversation
Seems like a good idea. I wanted to check whether |
Thanks for the feedback! I tested the After running julia> using REPL
julia> @eval REPL function show_repl(io::IO, mime::MIME"text/plain", c::AbstractChar)
println(stderr, ">>> Debug: Entering the @eval'd show_repl method!") # Added for testing
show(io, mime, c)
latex = REPL.symbol_latex(string(c))
if !isempty(latex)
print(io, ", === Alias from @eval'd method: ") # Changed text/color
printstyled(io, latex, color=:yellow)
end
end
show_repl (generic function with 4 methods)
julia> 'α'
>>> Debug: Entering the @eval'd show_repl method!
'α': Unicode U+03B1 (category Ll: Letter, lowercase), === Alias from @eval'd method: \alpha So it seems dynamic definition does work for this call path at runtime, although I understand rebuilding is the standard way to test source changes incorporated during the build process. Regarding |
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.
Welcome, and thanks for the contribution! This seems like a good addition to me. It would be great if you could add tests for this method that exercise the different possible code paths.
- Adds the LaTeX/emoji input alias to the REPL display for Char. - Addresses feedback from PR review (include <tab>, remove comment). - Includes tests covering chars with/without aliases and color output.
Thanks so much for the welcome and the helpful feedback, @ararslan! I really appreciate you taking the time to review. I've pushed commits addressing the suggestions:
The local tests for |
This change addresses reviewer feedback on PR JuliaLang#58158. The test cases for `REPL.show_repl` with `AbstractChar` in `stdlib/REPL/test/repl.jl` have been updated to use `sprint` for capturing output. This makes the tests more concise and idiomatic by replacing the previous `IOBuffer` and `IOContext` setup.
The implementation looks great to me, nice work! It occurred to me that since this is a new feature, a NEW.md entry could also be worthwhile, for example: --- a/NEWS.md
+++ b/NEWS.md
@@ -49,6 +49,8 @@ Standard library changes
#### REPL
+* The display of `AbstractChar`s in the main REPL mode now includes LaTeX input information like what is shown in help mode ([#58181]).
+
#### Test
* Test failures when using the `@test` macro now show evaluated arguments for all function calls ([#57825], [#57839]). |
Documents the new feature where the REPL display of AbstractChar now includes LaTeX/emoji input aliases, as per reviewer suggestion on PR JuliaLang#58181.
Thanks so much for all the guidance, @ararslan! I've added the As this was my first issue, I really appreciate you taking the time for the detailed reviews and helpful suggestions throughout this process. It's been a great learning experience! Ready for another look when you get a chance. |
Thanks for contributing, @ShahabSL! This is a nice usability feature that some folks might come to depend on in some edge cases. Sorry it took so long to get back to you this time with another round of feedback. Everything looked good to me so I went ahead and merged it :) |
Hi @LilithHafner, that's fantastic to hear! Thank you so much for merging this and for your kind words. I'm really glad you see it as a nice usability feature. Absolutely no worries at all about any delay, I truly appreciate you taking the time for the final review and getting it merged. It's wonderful to see it in! I'm especially thrilled as this was my first feature contribution, and it's been such a positive learning experience. 😊 |
Yes, apologies for the delayed response, I've been slammed with work lately and haven't had time to keep up with open source notifications. Thanks for merging, @LilithHafner, and thanks again for the contribution, @ShahabSL! |
This PR enhances the REPL display for Char types.
It adds the LaTeX/emoji input alias after the standard Unicode information, making it consistent with the help?> mode behavior.
For example,
'😼'
will now display as:'😼': Unicode U+1F63C (category So: Symbol, other), input as \:smirk_cat:
(Self-contained paragraph explaining the choice):
Considered modifying
Base.show
directly, but opted for adding aREPL.show_repl
method instead to avoid introducing a dependency fromBase
on theREPL
module's symbol mapping (symbol_latex
). This approach keeps the REPL-specific display logic contained within the REPL module.Closes #58158