Package-level declarations

Types

Link copied to clipboard
data class DocumentSyncMode(val openClose: Boolean, val change: TextDocumentSyncKind)

How a document's changes should be synchronized to the server, as negotiated through the server's textDocumentSync capability.

Link copied to clipboard
class LSPClient(val server: LanguageServer, val config: LSPClientConfig = LSPClientConfig())

A client that connects a kodemirror editor to a language server.

Link copied to clipboard
data class LSPClientConfig(val rootUri: String? = null, val workspaceFolders: List<WorkspaceFolder>? = null, val clientInfo: InitializeParamsClientInfo? = DEFAULT_CLIENT_INFO, val capabilities: ClientCapabilities = ClientCapabilities(), val initializationOptions: LSPAny? = null, val createWorkspace: (LSPClient) -> Workspace = { client -> Workspace(client) })

Configuration for an LSPClient.

Link copied to clipboard

The ViewPlugin that ties an LSPClient to a single editor session for a given file URI and language id.

Link copied to clipboard
data class ReferenceLocation(val uri: String, val range: Range)

A single reference location reported by textDocument/references: the target document uri and the range of the reference within it.

Link copied to clipboard
data class ServerCompletionConfig(val override: Boolean = false, val validFor: Regex? = null)

Configuration for serverCompletion.

Link copied to clipboard
data class SignatureHelpConfig(val keymap: Boolean = true)

Configuration for signatureHelp.

Link copied to clipboard
open class Workspace(val client: LSPClient)

Tracks the set of open files for an LSPClient and synchronizes their contents with the language server.

Link copied to clipboard

Represents a single document tracked by a Workspace.

Link copied to clipboard
data class WorkspaceFileUpdate(val file: WorkspaceFile, val prevDoc: Text, val changes: ChangeSet)

A pending update for a file, produced by Workspace.syncFiles.

Link copied to clipboard

Maps positions from the document version a request was issued against to the current document version.

Properties

Link copied to clipboard

The default find-references key bindings, matching upstream's findReferencesKeymap: Shift-F12 runs findReferences (preventing the default action) and Escape runs closeReferencePanel.

Link copied to clipboard

The default formatting key bindings, matching upstream's formatKeymap: Shift-Alt-f runs formatDocument (preventing the default action).

Link copied to clipboard

The default go-to-definition key bindings, matching upstream's jumpToDefinitionKeymap: F12 runs jumpToDefinition (preventing the default action).

Link copied to clipboard

The default rename key bindings, matching upstream's renameKeymap: F2 runs renameSymbol (preventing the default action). Escape cancels an open rename prompt (cancelRename).

Link copied to clipboard

The default signature-help key bindings, matching upstream's signatureKeymap:

Functions

Link copied to clipboard

Close the reference panel, if it is open.

Link copied to clipboard
fun definitionJumps(client: LSPClient, uri: String, keymap: Boolean = true): Extension

Build the editor Extension that enables the LSP go-to-definition family (jumpToDefinition / jumpToDeclaration / jumpToTypeDefinition / jumpToImplementation) for the file at uri served by client.

Link copied to clipboard

Ask the server to locate all references to the symbol at the cursor and, when any are returned, show them in a panel.

Link copied to clipboard
fun findReferencesExtension(client: LSPClient, uri: String, keymap: Boolean = true): Extension

Build the editor Extension that enables LSP find-references for the file at uri served by client.

Link copied to clipboard

Format the whole document via the language server.

Link copied to clipboard
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.

Link copied to clipboard
fun fromPosition(pos: Position, doc: Text): Int

Convert an LSP Position to a kodemirror document offset.

Link copied to clipboard

Jump to the declaration of the symbol at the cursor.

Link copied to clipboard

Jump to the definition of the symbol at the cursor.

Link copied to clipboard

Jump to the implementation of the symbol at the cursor.

Link copied to clipboard

Jump to the type definition of the symbol at the cursor.

Link copied to clipboard
fun languageServerSupport(client: LSPClient, uri: String, languageId: String): Extension

Public entry point: build the editor Extension that connects an editor for a single file to a language server through client.

Link copied to clipboard

If a signature tooltip with multiple signatures is showing, move to the next one. Ports upstream's nextSignature. Returns false when no tooltip is active.

Link copied to clipboard

If a signature tooltip with multiple signatures is showing, move to the previous one. Ports upstream's prevSignature. Returns false when no tooltip is active.

Link copied to clipboard

Prompt the user for a new name for the symbol at the cursor and, on confirmation, ask the language server to rename it.

Link copied to clipboard
fun renameSymbolExtension(client: LSPClient, uri: String, keymap: Boolean = true): Extension

Build the editor Extension that enables LSP rename for the file at uri served by client.

Link copied to clipboard
fun serverCompletion(client: LSPClient, uri: String, config: ServerCompletionConfig = ServerCompletionConfig()): Extension

Register the language-server completion source as the editor's autocompletion source.

Link copied to clipboard
fun serverCompletionSource(client: LSPClient, uri: String, config: ServerCompletionConfig = ServerCompletionConfig()): SuspendCompletionSource

The suspend completion source that requests completions from the language server wrapped by client for the file at uri.

Link copied to clipboard

Editor extension that renders LSP diagnostics pushed by the language server.

Link copied to clipboard
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.

Link copied to clipboard

Explicitly prompt the server to provide signature help at the cursor.

Link copied to clipboard
fun signatureHelp(client: LSPClient, uri: String, config: SignatureHelpConfig = SignatureHelpConfig()): Extension

Build the editor Extension that enables LSP signature help from the language server wrapped by client for the file at uri.

Link copied to clipboard
fun toPosition(offset: Int, doc: Text): Position

Convert a kodemirror document offset to an LSP Position.