-
-
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
REPL help for LaTeX tab completion #19858
Conversation
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.
LGTM, I assume that the usefulness of this feature is more for longer tab-completed names such as
help?> x_φ̄⁵
"x_φ̄⁵" can be typed by x_\varphi<tab>\bar<tab>\^5<tab>
that could be tab completed with x_<tab>
rather than single symbols such as
help?> φ
"φ" can be typed by \varphi<tab>
where the user would have had to input the symbol with \varphi<tab>
to begin with anyway (usually, though perhaps they copy-pasted it from some where).
end | ||
repl_latex(s::String) = repl_latex(STDOUT, s) | ||
|
||
macro repl(ex...) length(ex) == 2 ? repl(ex[1], ex[2]) : repl(ex[1]) end |
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.
Could use two definitions for dispatch to avoid needing the conditional: macro repl(ex) ...
and macro repl(io, ex) ...
, not too important though really.
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.
Oh, I didn't realize that dispatch could be used for macros. Learn something new every day.
@MichaelHatherly, I think it is useful for single symbols, too. There are other (more annoying) ways to type these symbols than by tab completion. For example, you could be looking at someone else's code, see a symbol you don't know how to type, and find out by copy-and-pasting it into the REPL help. Or you could type the symbol on MacOS by the character palette, or by copying and pasting from a web page, or ... |
(For example, if you look at |
…ting the symbol from somewhere
Should be good to merge; the Travis failure is the unrelated x86 problem we are having nowadays. |
In this PR, typing a Unicode symbol into the REPL help now prints information about how to type it using the LaTeX tab completion, if possible:
While I was editing this code, I also made it possible to get the help text in a user-supplied
io
stream rather thanSTDOUT
, which will help with IJulia and similar enviroments.