State and rendering for LSP hover tooltips.
Parses LSP hover markdown content into styled display list draws and renders them in a cursor-anchored floating window. Supports scrolling for long content (j/k when focused) and the LazyVim pattern of pressing K once to show, K again to focus into the hover for scrolling.
Lifecycle
- LSP hover response arrives with markdown content
new/4creates the popup state with parsed content- The render pipeline renders it as an overlay via
render/3 - Any keypress (except K/j/k when focused) dismisses the popup
Summary
Functions
Returns the popup's outer rect {row, col, width, height} in screen cells.
Focus into the hover popup for scrolling.
Creates a new hover popup from LSP hover content.
Returns true when the popup exposes an Open action.
Returns a stable action name for native frontend metadata.
Scroll content down (later lines visible).
Scroll content up.
Sets the action to execute when the popup's Open action is accepted.
Types
@type open_action() :: atom() | {:goto_location, String.t(), non_neg_integer(), non_neg_integer()}
Action available from a focused hover popup.
@type t() :: %MingaEditor.HoverPopup{ anchor_col: non_neg_integer(), anchor_row: non_neg_integer(), content_lines: [MingaAgent.Markdown.parsed_line()], focused: boolean(), open_action: open_action() | nil, scroll_offset: non_neg_integer() }
A hover popup state.
Functions
@spec box(t(), {pos_integer(), pos_integer()}, map()) :: MingaEditor.Layout.rect() | nil
Returns the popup's outer rect {row, col, width, height} in screen cells.
This is the same box render/3 paints into (border, anchor placement, and
viewport clamping included), so the SurfaceRegistry can register the hover
surface's rect from the BEAM's own geometry instead of inventing one. Returns
nil when there is no content to place.
Focus into the hover popup for scrolling.
@spec new(String.t(), non_neg_integer(), non_neg_integer(), keyword()) :: t()
Creates a new hover popup from LSP hover content.
Parses the markdown content and anchors the popup at the given cursor position.
Returns true when the popup exposes an Open action.
@spec open_action_name(open_action() | nil) :: String.t()
Returns a stable action name for native frontend metadata.
Scroll content down (later lines visible).
Scroll content up.
@spec with_open_action(t(), open_action()) :: t()
Sets the action to execute when the popup's Open action is accepted.