-
-
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
RFC: tab substitution of LaTeX symbols in REPL #6911
Conversation
Just gave it a try, very handy! |
This is very slick. One thing that would be nice is to detect |
…looks like the most reasonable choice is listed first in the unicode.xml file
@StefanKarpinski, I agree that would be nice, but the REPL doesn't really seem to be set up right now to do that kind of 2-level substitution (since you really want to see the LaTeX symbol name first, I think, and not just a list of Unicode characters). My thinking was that this sort of refinement could go into a later patch. Or are you thinking that you would hit TAB once and it would complete to |
Oh, absolutely. That's definitely a nice-to-have-later addition and not a show-stopper at all. I'm down to merge this right now :-) |
Another plus: this patch uses a multiline comment. |
The astrological symbols feel a bit out of place :) |
I always check the horoscope before naming my variables. |
Now we just need to define what |
I propose that we use horoscope signs for base 12 numeric literals. |
and Chinese for base-50,000 arithmetic. |
+♈ for astro-literals. Astrologicals? … What's Latex/Unicode doing here?
I've been meaning to play with two-phase tab completion for a while now. But it'll be tricky. The standard way to do it is that one-tab expands to the first branch, and then the second tab lists the options. Surely there are symbols whose names are a subset of other valid names. What happens then? This is exciting. |
@mbauman, I think the W3C There are a whole bunch of other gender symbols in Unicode, but we can always add more later as needed. For now, I'm trying to stick to symbols with defined LaTeX names so that I'm not making up my own spellings. |
👍 very cool |
Since no one has complained that this isn't working and it seems that everyone loves the functionality, what say we merge it? |
RFC: tab substitution of LaTeX symbols in REPL
🍰 |
Agreed, this is really great. Now I'm wishing the default Windows console weren't so lousy and annoying to copy from (maybe I'll find and set up a better one), and that all editors would start doing this too! |
You could just use IJulia... The Windows console is intolerable. |
Grumble grumble Python dependency grumble grumble. But I may finally break down and do it now. |
There's also Sublime Text, which works on Windows and has an add-on package that supports this exact behavior. It's pretty great being able to do this in the same way a) in the REPL, b) in my editor, and c) in IJulia. |
The Julia REPL is quickly replacing the MacOS character palette as my Unicode IME of choice for all but the obscurest characters. |
Strange it does not work work me on 2.1 IJulia notebook, neither on master. I also got some exception with master :
Where text is a completion key which was removed in the new version of the protocol but should be automatically handled by the shim. Anyway I wanted to propose also that |
@Carreau, sounds like a bug in IPython, not sending the 4.0-protocol version of the |
Maybe but I can't it to work on 2.1 either, which does not use the new protocol, so I would like to have it to work (you said you had it to work in 2.x)
|
Hmm, that's weird, since
@vtjnash, is this the wrong way to conditionally include a module? (Also, I don't understand how this could give a |
Pkg was saying IJulia was up to date, but it was not, I reseted the git repo manualy to last master and it's ok. Wil investigate the errors on the 4.0 kernels adapter. |
@Carreau, |
Yep, maybe, and indeed you pushed to metadata 1 min after pushing to IJulia repo. Not sure what append. Anyway it does work with master IPython, the 4.0 adapter seem to swallow some logging errors though. Will narrow that and send upstream. |
Adapter should be fixed on IPython master the traceback handler had a forgotten parameter. |
This patch allows you to type things like
\alpha<TAB>
in the REPL to getα
(as discussed in #6340). You can even type e.g.x\dot<TAB>
to getẋ
.Currently, you have to type out the whole LaTeX symbol....it seemed too complicated (at least in a first implementation) to support a two-level completion scheme where you could get a list of LaTeX symbols with a given prefix.
The list of substitutions is automatically generated from the W3C LaTeX/Unicode mapping.