Open stefnotch opened 1 year ago
Old note: Mathlive autocomplete (accept with space, I guess) limn[space] turns into lim_{n \to \infin} limnto-[space] turns into lim n to -infinity lim[space] turns into lim liminf is \lim \inf What shortcut does Mathcad have for infinity? (00 or oo could work?)
Inside a $\lim_{cat \to 42} |$, the word "cat" is very much something that the autocomplete could suggest, if the user provides a parser that tracks variables and such.
Open question:
\sum_
Bonus points if for a sum symbol, it can show "sum as text" in its autocomplete suggestions.
What should space do? Accept or reject? Also, should a^2+4
followed by space jump out of the exponent?
Space should simply insert a space
character. We need that for $a\ b$ being two separate symbols. After all, we have a greedy lexer/parser, and thus we need a way to "stop" it.
Space could also be used as a placeholder, and as a way of pushing symbols around.
e.g. When we have $\frac{a}{\color{blue}|\color{black}b}$, then hitting space could do something like $\frac{a}{\quad \color{blue}|\color{black}}b$
Oh look at what super smart thing MathICanDo does!
How does autocomplete even work when there are multiple cursors?
I'm autocompleting
lim
but I also have a second cursor at an empty place.
Answer: Not sure if there is even an intuitive answer. So doing literally anything[1] is fine.
[1] Anything other than failing horribly.
Regarding autocorrect
/_^ logic is simply
Reasoning is very simple: it'd be annoying if 1_a_b
suddenly behaved differently, just because someone implemented a _italics_
parser. Same goes for a^=
and other stuff.
That logic is hardcoded, which is fine, I think.
The delayed autocorrect can handle quite a lot. The user can type stuff like inN
to get $\in \mathbb{N}$. Notice how there's no space between the $in$ and the N
.
That is because $\in$ is the only sensible symbol for in
. So the parser picks up on that and makes use of the knowledge.
Depending on user testing, we might have to scale it back though. Maybe it is confusing?
Vscode snippets sqrt => \sqrt{$1} root => \sqrt[$1]{$2} .box() => Box(prev token) / => \frac{prev}{next} \/ => escaped slash "/" or "\/"
What if I change the autocompletion logic to actually look at the syntax tree? Well then => wouldn't work? But what if I change it to be able to also look at the syntax tree?