sendRequest method
Sends a request and completes with its result, or completes with a
ResponseError if the server replied with an error.
Implementation
Future<Object?> sendRequest(String method, [Object? params]) {
if (_closed) {
throw StateError('LspClient is closed');
}
final id = _nextId++;
final completer = Completer<Object?>();
_pending[id] = completer;
_endpoint.writeMessage({
'jsonrpc': '2.0',
'id': id,
'method': method,
'params': ?params,
});
return completer.future;
}