LazyVSCodeBridgeAdapter class

A lazy-connecting adapter that auto-connects on first use.

This adapter defers connection until the first request is made. Useful for CLI tools like d4rt where VS Code integration is optional but should "just work" when needed.

Example:

final adapter = LazyVSCodeBridgeAdapter(port: 19900);
VSCode.initialize(adapter);
// No connection yet...

// First use triggers auto-connect
await VSCode.instance.window.showInformationMessage('Hello!');
Implemented types

Constructors

LazyVSCodeBridgeAdapter({String host = '127.0.0.1', int port = defaultVSCodeBridgePort, void onStatusMessage(String message)?, void onErrorMessage(String message)?})
Creates a lazy VS Code bridge adapter.

Properties

hashCode → int
The hash code for this object.
no setterinherited
host → String
Get the current host.
no setter
isConnected → bool
Whether the underlying client is connected.
no setter
onErrorMessage → void Function(String message)?
Callback for error messages.
final
onStatusMessage → void Function(String message)?
Callback for connection status messages.
final
port → int
Get the current port.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

connect() → Future<bool>
Manually connect to the VS Code integration server.
disconnect() → Future<void>
Disconnect the underlying client.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendRequest(String method, Map<String, dynamic> params, {String? scriptName, Duration timeout = const Duration(seconds: 60)}) → Future<Map<String, dynamic>>
Send a request to VS Code and wait for the response
override
setHostPort(String host, int port) → Future<void>
Update the host and port for future connections.
setPort(int port) → Future<void>
Update the port for future connections.
toString() → String
A string representation of this object.
inherited

Operators

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