LspClient class final

A live connection to one language server process.

Constructors

LspClient({required LspServerConfig config, required String rootPath, required LspTransport transport, int? processId, Duration requestTimeout = defaultLspRequestTimeout, void onExit()?})
Creates an LspClient over transport. The read loop starts immediately; call initialize before issuing document requests.

Properties

config LspServerConfig
The server definition this client was spawned for.
final
diagnostics Map<String, List<LspDiagnostic>>
Latest published diagnostics per document URI (omp's client.diagnostics).
final
diagnosticsStream Stream<String>
Emits a document URI every time the server publishes diagnostics.
no setter
diagnosticsVersion int
Bumped on every publishDiagnostics notification (omp's diagnosticsVersion).
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
lastActivity DateTime
Last activity timestamp for the manager's idle sweep (omp's lastActivity).
getter/setter pair
onExit → void Function()?
Called exactly once when the connection dies (crash, stream close, or shutdown).
final
openFiles Map<String, int>
Open documents: URI → current content version (omp's openFiles).
final
processId int?
The host process id advertised in initialize (the server exits when the parent dies). Null when the host cannot provide one (e.g. tests).
final
requestTimeout Duration
Default timeout for requests without an explicit one.
final
rootPath String
Workspace root the server was started in.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serverCapabilities Map<String, dynamic>?
Server capabilities from the initialize result, when connected.
getter/setter pair
status LspClientStatus
Lifecycle state.
getter/setter pair
transport LspTransport
The byte channel to the server process.
final

Methods

closeFile(String path) → void
Sends textDocument/didClose for path when tracked.
ensureOpen(String path, String content, String languageId) → void
Opens path with content if not already tracked (omp's ensureFileOpen): sends textDocument/didOpen with version 1.
initialize({Duration? timeout}) Future<void>
Runs the initialize/initialized handshake and pushes the configured settings. Throws LspRequestException on failure.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify(String method, Object? params) → void
Sends a notification (no response expected).
request(String method, Object? params, {Duration? timeout}) Future<Object?>
Sends a request and awaits its result. Throws LspRequestException on a server error response, on timeout, or when the connection dies mid-flight.
shutdown() Future<void>
Graceful shutdown: shutdown request, exit notification, then wait briefly for the process to leave before killing it (omp's shutdown path). Always safe to call; errors during shutdown are swallowed.
syncContent(String path, String content, String languageId) → void
Syncs in-memory content for path (omp's syncContent): opens the document when untracked, otherwise sends a full-content textDocument/didChange with a bumped version.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited