# [GSoC Idea] Autocomplete System

Hello!

One feature that I keep hoping for is autocomplete support! It'll make life a ton easier specially with KaTex as I use it heavily.
Instead of building something specifically for Math autocompletion though, I'm thinking my GSoC project could be about autocompletion API added into the plugin system!

Again just like my last post about Git Syncing, this post is also just gauging interest and seeing if this idea is fit. So nothing is final. (ofcourse)

• I'm yet to understand fully how the plugin API works, but we'd somehow provide developers ability to register autocomplete phrases for their own content scripts. Maybe only limit it to fenced blocks or as a special case, dollar sign blocks for math... They'd input something like:
{
name: '\frac'
content: '\frac{}{}'
description: 'Adds a fraction to the text'
}

• Ofcourse I don't need to explain behavior of an autocomplete xD.. In short, A menu would show up as soon as you type something that's registered in the list of items and auto-completes on selection. Hopefully as well provide tab support where you can tab to positions of interest like \frac{$0}{$1}.
• It'll probably use CodeMirror's already existing addon showHint as a base. I'm not sure what does it provide but it's open source Ability to extend it is always there! CodeMirror 6 Reference Manual or CodeMirror: User Manual (Not sure what version do we use)
• I don't need to put this here, but it's obvious there'll be tons of items in the AC menu, and optimizations will have to be made. A basic Trie Data Structure for fast searching the items is for example the least we can do if CodeMirror doesn't do that

Let me know what do you think!

btw:Sorry if I'm posting in the wrong place! I've got ideas beside the original ideas list but I'm not sure if any fit as a GSoC project or even if they're wanted by the community.. I ain't sure where should I propose them. Thought here would be a best fit.

2 Likes

This would be an excellent feature, and very useful.

2 Likes

Bump.

Wouls be awesome if I can get a reply from any of the staff soon so I can start preping my Proposal. Just don't want to waste my effort if the idea is entirely rejected.

I suppose it could be useful for katex, other that that - not sure.

There is already the API within CodeMirror that lets plugin authors build autocomplete, all it requires is to provide a list of completions.

I personally have no use for katex autocomplete, but I'm sure there are people who do.

Cannot reply much on this tbh, I'm not entirely sure as well what else can it be used for besides Katex but I still believe having the feature there would be nice.

I didn't know you could access CodeMirror instance directly from a plugin. However, I think handling Autocomplete internally would be beneficial in case multiple plugins want to add to it. You don't want each and every plugin to be able to just modify it overwriting other plugin additions.
In addition, With internal implementation we could make autocomplete ONLY work inside fenced blocks introduced by the same plugin.

We could also add a feature where users can add custom autocomplete stuff into Joplin. Something like "AKA" would complete to "Also known as". etc etc.. Kinda like Custom User Snippets in VsCode

Uhh this confused me. Would be really great if I can get a definite decision soon on the idea. Don't get me wrong though, I'm fully aware you could say Yes here and then get rejected later depending on a lot of factors.
Basically, I just need to know if I should stick to the ideas list or not I hope you understand what I mean.

I may be biased cause I'm an Engineering Student but Autocomplete for Katex would be a huge life saver for me lol. It's not about forgetting the names, I memorized em from practice. The autocomplete itself saves time.

1 Like

You can from a content script.

This will break some things so better not.

Let's wait what others have to say.

This would be really nice, since you can create arbitrary html blocks and put them in Joplin, so users could create their own html blocks and easily add them to Joplin

For example, I use Joplin mainly for maths, and its handy to have boxes for definitions, theorems, lemmas etc. It is easy to add the html tags, but it would be much better to just start typing it and having an autocomplete or hitting a shortcut in the keyboard

Even if its only for KaTeX it would be useful, I am tired of typing \mathcal{} every time!

2 Likes