Multiple hoverTooltips

Does hoverTooltip support returning multiple tooltips within the source function?

I know multiple hoverTooltip extensions will merge ( This allows multiple tooltips over the same range to be "merged" together without overlapping. ), but from the documentation and types it seems like only one Tooltip can be returned from each hoverTooltip extension.

I’m wondering if something like this is possible:

hoverTooltip(function myTooltips(
  view: EditorView,
  pos: number,
  side: -1 | 1
) {
  if ( pos === 10 ) {
    return [tooltip1, tooltip2]

Do I have to set up multiple hoverTooltip extensions to get this functionality?

The types show that that is not possible. You could add two tooltip providers or have your tooltip show multiple bits of information in a wrapping DOM element.

Okay. Just wanted to clarify. The language around multiple tooltips was a little confusing.

Related question: Is offset supported in the Tooltips rendered in hoverTooltip? When I try, the offset doesn’t seem to have any effect.

That appears to be an accident. This patch fixes that.

1 Like