serverHover

fun serverHover(client: LSPClient, uri: String, hoverTime: Long = com.monkopedia.kodemirror.view.DEFAULT_HOVER_TIME): Extension

Build the editor Extension that shows LSP hover information from the language server wrapped by client for the file at uri.

Ports upstream @codemirror/lsp-client's hoverTooltips. On a hover that rests for hoverTime ms it:

  1. checks the server advertises the hoverProvider capability (else no-op),

  2. flushes pending edits (LSPClient.sync) so the server resolves against the current text,

  3. captures a WorkspaceMapping so the response range can be remapped if the document changes while the request is in flight,

  4. issues textDocument/hover at the pointer position,

  5. parses the contents HoverContents union (parseHoverContents) and renders it to Compose (HoverContent; see its HTML→Compose deviation note), anchored at the Hover.range start when present.

The async hover bridge uses :view's suspending hoverTooltip overload, which debounces by hoverTime and cancels an in-flight request when the pointer moves — matching upstream's hover-delay + cancel-on-move semantics. There is no explicit $/cancelRequest; the in-flight call is cancelled cooperatively through structured concurrency (consistent with serverCompletionSource).

Parameters

client

The LSP client wrapping the language server.

uri

The document URI for this editor's file.

hoverTime

Delay, in milliseconds, before a resting pointer triggers the request. Defaults to :view's DEFAULT_HOVER_TIME.