I’m writing a custom autocomplete extension, but my completions have multiple text insertions.
E.g. if I type def add( and the parentheses auto-close to def add(<cursor>), I’d have completions for a,b at the cursor location, and :\n return a+b at offset 2 from the cursor.
The Autocomplete module doesn’t seem to support this. How hard would it be to add multi-insert completions to it?
That’s not something @codemirror/autocomplete will do for you (though it’s possible to implement something like that using the functions that query the currently selected completion).
gotcha. My current plan is to make it from scratch with a state field (for the current completion), view plugin (for rendering) and command (for acceptance). Does that seem reasonable, or is there some part of the API that would make this more straightforward?
I assumed you’d want a tooltip like the existing autocomplete, plus a type-ahead display of the text. If you want something that doesn’t have the tooltip, you probably don’t need to use the regular autocompletion extension.