Skip to content

editorHoverDescriptions

editorHoverDescriptions<T>(callback, options): BasicExtension<T>

Defined in: extensions/hover.ts:123

Utility that makes it easier to add hover descriptions to tokens.

T extends object

EditorHoverCallback<T>

Function called when a token with only textual children is hovered.

The function gets called with the following arguments:

  • types: Array with the token’s type as the first element, followed by any alises.
  • language: The language at the token’s position.
  • text: The textContent of the token.
  • element: The <span> element of the hovered token.

Lastly, the function should return an array of children that get added to the tooltip. If null or undefined is returned, no tooltip is shown for the token.

EditorHoverOptions = {}

Options for configuring the size and position of the tooltip and the line filter for better performance.

BasicExtension<T>