In-line auto completions

One of the features I am wanting to add to the AI plug is auto-completion in various spots. E.g. in a space-script code fence.

For example, in vscode, I can get something like this:

Instead of popping up an auto-complete suggestion box, it puts a single “hint” in a different color and lets you tab to select it. There may be shortcut keys to cycle between different suggestions too.

In SB right now, I have a prototype using the current auto complete that looks like this:


and after accepting the suggestion:

This example is in a code block, but it looks the same in a normal note too. One of the issues is that it doesn’t show the full multi-line suggestion, so you won’t know what you get until you accept it.

So all that to say, I found this codemirror plugin: GitHub - saminzadeh/codemirror-extension-inline-suggestion: A CodeMirror extension to display inline suggestions

It looks like it would do the trick. Would there be any objections to adding it (or something else if there is something better), and then maybe setting up a new event like editor:inline-complete separate from the existing editor:complete event.

4 Likes

This is pretty cool. It has potential to escalate into people wanting SB to turn into a full blown IDE (don’t tempt me), but if we can do something valuable that is relatively low effort, let’s do it (with that CM plugin, that looks nice). If it doesn’t add another 100K to the bundle size that is.

2 Likes

It looked relatively simple, I’ll give it a shot.

And isn’t SB already a full blown IDE? :grin:

1 Like

Quick preview:
sb-inline-completion

At the moment, it doesn’t feel super practical/useful outside of code blocks, but it’s still pretty neat. I’m trying to think of use cases that would be useful built-in

2 Likes