Skip to content

LanguageServerPluginOptions

LanguageServerPluginOptions = LanguageServerLaneHostOptions & object

readonly optional capabilities?: lsp.ClientCapabilities

Merged over defaultClientCapabilities(), so a host declares only what it adds. Build a semantic-tokens block with semanticTokensClientCapability() from @singapore-editor/lsp rather than by hand: it refuses the flags this editor cannot honour, each of which a real server acts on.

readonly optional clientInfo?: lsp.InitializeParams["clientInfo"]

At least one real server branches on this. The value is the host’s to pick.

readonly optional connectionProvider?: LspConnectionProvider

Borrows the connection rather than owning one per view, so a file switch that rebuilds the view does not also rebuild the websocket and re-run initialize. The route and options above still describe the connection — the provider is handed them and builds from them the first time it sees a key. See LspConnectionProvider.

readonly optional documentSync?: LanguageServerDocumentSyncOptions

Which documents reach the server, and under what language id.

readonly optional getDiagnosticActions?: LanguageServerDiagnosticActions

readonly optional initializationOptions?: unknown

readonly optional notificationHandlers?: Readonly<Record<string, LspNotificationHandler<LspClient>>>

Merged around the plugin’s own handlers. An entry for textDocument/publishDiagnostics runs after the plugin’s and cannot displace it, because the diagnostics feature hangs off it.

readonly optional onDefinitionLinkHover?: (target) => void | (() => void)

Reports the selected destination when Ctrl/Cmd-hover renders a jumpable link.

LanguageServerDefinitionTarget

void | (() => void)

readonly optional onDiagnostics?: (summary) => void

LanguageServerDiagnosticSummary

void

readonly optional onDidNavigateDiagnostic?: (event) => LanguageServerDiagnosticMarkerClaim

LanguageServerDiagnosticMarkerEvent

LanguageServerDiagnosticMarkerClaim

readonly optional onError?: (error) => void

unknown

void

readonly optional onInteractiveReady?: () => void

void

readonly optional onOpenDefinition?: (target, options?) => void | boolean

LanguageServerDefinitionTarget

LanguageServerNavigationOptions

void | boolean

readonly optional onOpenReferences?: (result) => void | boolean

LanguageServerReferencesResult

void | boolean

readonly optional onRequestError?: (serverId, method, error) => void

string

string

unknown

void

readonly optional onStatusChange?: (status) => void

LanguageServerStatus

void

readonly optional rootUri?: lsp.DocumentUri | null

readonly optional semanticTokens?: LanguageServerSemanticTokensOptions

Turns on the semantic token layer, and is how the host gets hold of one: a layer needs a viewport, a snapshot and a lifecycle, so the contribution creates it and hands it over through onLayer. Supplying nothing creates no layer and fires no demand signal.

readonly optional serverRequestHandlers?: Readonly<Record<string, LspServerRequestHandler<LspClient>>>

Answers requests the server sends the client, such as a server asking the host for files. A method the plugin answers itself (workspace/diagnostic/refresh) stays the plugin’s.

readonly optional timeoutMs?: number

readonly webSocketRoute: string | URL

readonly optional webSocketTransportOptions?: LspWebSocketTransportOptions

optional onConnected(context): void

The same context again, once initialize has come back and server capabilities are known.

LanguageServerConnectionContext

void

optional onConnectionCreated(context): void | EditorDisposable

Hands the host the connection the moment it exists, which is the only way to reach the LspClient — and therefore the only way to issue a request, override the timeout for one, or cancel one. Returning a disposable ties the host’s own controller to the connection’s life.

LanguageServerConnectionContext

void | EditorDisposable