LspClientManager class final

Owns the LspClient pool for one lsp tool instance.

Constructors

LspClientManager({required ExecutionEnv env, required LspConfig config, required LspTransportFactory transportFactory, int? processId, Duration requestTimeout = defaultLspRequestTimeout, Duration initTimeout = defaultLspRequestTimeout, Duration? idleTimeout, Duration idleCheckInterval = const Duration(minutes: 1), int maxRestarts = 3, Duration initFailureBackoff = const Duration(minutes: 3), Duration crashWindow = const Duration(seconds: 10)})
Creates an LspClientManager. idleTimeout defaults to LspConfig.idleTimeout; Duration.zero disables the sweep.

Properties

clients Map<String, LspClient>
The live clients, keyed server:root (omp's getActiveClients).
no setter
config LspConfig
The resolved server configuration.
final
crashWindow Duration
A server exiting within this window of its start counts as a crash.
final
env ExecutionEnv
The workspace the servers operate on.
final
hashCode int
The hash code for this object.
no setterinherited
idleCheckInterval Duration
How often the idle sweep runs.
final
idleTimeout Duration
Idle timeout after which unused servers are shut down.
final
initFailureBackoff Duration
How long a server stays negative-cached after repeated crashes or an init failure (omp's INIT_FAILURE_BACKOFF_MS).
final
initTimeout Duration
Timeout for the initialize handshake.
final
maxRestarts int
Consecutive quick crashes tolerated before the backoff kicks in.
final
processId int?
Host process id forwarded to initialize; null when unknown.
final
requestTimeout Duration
Default request timeout for spawned clients.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
transportFactory LspTransportFactory
Spawns server processes (the io-side factory on native hosts, a fake in tests).
final

Methods

checkIdle() Future<void>
Runs one idle sweep: shuts down clients idle longer than idleTimeout. The periodic timer calls this; tests may call it directly.
clientForFile(String path) Future<LspClient>
Resolves the client for path, starting the server lazily when needed. Throws LspNoServerException when no server matches, LspServerUnavailableException when the server cannot be spawned or is in backoff, and LspRequestException when the handshake fails.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shutdownAll() Future<void>
Shuts down every client and stops the idle sweep.
toString() String
A string representation of this object.
inherited

Operators

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