sendRequestWithInputs<T extends Result> method

Future<T> sendRequestWithInputs<T extends Result>(
  1. String methodName,
  2. WithInputResponses request
)

Sends request like sendRequest does, answering any input_required result before it returns.

Before 2026-07-28 it sends once. An extension adding a method that takes input responses can go through here.

Implementation

Future<T> sendRequestWithInputs<T extends Result>(
  String methodName,
  WithInputResponses request,
) async {
  final version = protocolVersion;
  // An unsettled version is not an error. 2026-07-28 dropped the handshake,
  // and something outside `initialize` settles this one. Either way the
  // connection has not told us it speaks the revision.
  if (version == null || version < ProtocolVersion.v2026_07_28) {
    return sendRequest<T>(methodName, request);
  }
  try {
    return await _retryWhileInputRequired<T>(methodName, request);
  } finally {
    // Every round runs under the progress token the caller put on the first
    // request, so the stream it opened outlives all of them.
    await closeProgress(request);
  }
}