Hi!
The existing @codemirror/autocomplete plugin allows for some customisation via the addToOptions
function. However, there’s two limitations:
- It’s part of the extension config, so it can’t (easily) be configured per source
- It can only access data on the
Completion
item, which only has a few string fields (label
,type
,detail
, etc) to choose from.
It’d be convenient if Completion
s could provide a render: () => Node
function that would be called in CompletionTooltip.createListBox rather than the individual sources/columns provided by default by the extension/config.
I considered if CompletionSource
s should be providing the render function instead, but we run into the same problem (2) that we can only access data that exists on Completion
s. With the render function per Completion
you can capture the relevant information in a closure.
I’ve found some related discussions around this, but they seem slightly different:
- need help about highly customized codemirror/autocomplete (a completely different interaction model)
- Custom renderer for Autocomplete (a bit vague - maybe related to code snippets too?)
Of course this can be implemented with tooltips, but I’d end up re-implementing much of @codemirror/autocomplete
just to change the look of the completions.
Let me know what you think