disconnectRequest method

  1. @override
Future<void> disconnectRequest(
  1. Request request,
  2. DisconnectArguments? args,
  3. void sendResponse()
)

disconnectRequest is called by the client when it wants to forcefully shut us down quickly. This comes after the terminateRequest which is intended to allow a graceful shutdown.

It's not very obvious from the names, but terminateRequest is sent first (a request for a graceful shutdown) and disconnectRequest second (a request for a forced shutdown).

https://microsoft.github.io/debug-adapter-protocol/overview#debug-session-end

Implementation

@override
Future<void> disconnectRequest(
  Request request,
  DisconnectArguments? args,
  void Function() sendResponse,
) async {
  isTerminating = true;

  await disconnectImpl();
  await shutdownDebugee();
  sendResponse();

  await shutdown();
}