formatDocumentExtension

fun formatDocumentExtension(client: LSPClient, uri: String, keymap: Boolean = true): Extension

Build the editor Extension that enables LSP whole-document formatting for the file at uri served by client.

Mirrors how upstream @codemirror/lsp-client wires formatting: it carries this editor's per-editor binding through the formatServer facet so formatDocument resolves its client/uri from the session it runs in (no module-level mutable state), and — unless keymap is false — installs the formatKeymap (Shift-Alt-f) at high precedence.

Parameters

client

The LSP client wrapping the language server.

uri

The document URI for this editor's file.

keymap

When true (the default), the formatKeymap binding is installed at high precedence. Pass false to bind formatDocument yourself.