VSCodeBridgeClient class
Client for communicating with VS Code VS Code Bridge.
Example:
final client = VSCodeBridgeClient();
if (await client.connect()) {
final result = await client.executeExpression('VSCode.showMessage("Hello")');
print(result.output);
await client.disconnect();
}
Constructors
- VSCodeBridgeClient({String host = '127.0.0.1', int port = defaultVSCodeBridgePort, Duration connectTimeout = const Duration(seconds: 5), Duration requestTimeout = const Duration(seconds: 30)})
- Creates a VS Code bridge client.
Properties
- connectTimeout → Duration
-
Connection timeout.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- host → String
-
The host to connect to.
final
- isConnected → bool
-
Whether the client is connected.
no setter
- port → int
-
The port to connect to.
final
- requestTimeout → Duration
-
Request timeout.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connect(
) → Future< bool> - Attempts to connect to the VS Code bridge.
-
disconnect(
) → Future< void> - Disconnects from the VS Code bridge.
-
executeExpression(
String expression) → Future< VSCodeBridgeResult> - Executes a D4rt expression via VS Code bridge.
-
executeScript(
String code) → Future< VSCodeBridgeResult> - Executes D4rt script code via VS Code bridge.
-
executeScriptFile(
String filePath) → Future< VSCodeBridgeResult> - Executes a D4rt script file via VS Code bridge.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendRequest(
String method, Map< String, dynamic> params) → Future<Map< String, dynamic> > - Sends a JSON-RPC request to the bridge.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
isAvailable(
{String host = '127.0.0.1', int port = defaultVSCodeBridgePort}) → Future< bool> - Checks if the VS Code bridge is available.