initializeRequest method

  1. @override
Future<void> initializeRequest(
  1. Request request,
  2. DartInitializeRequestArguments args,
  3. void sendResponse(
    1. Capabilities
    )
)

initializeRequest is the first call from the client during initialization and allows exchanging capabilities and configuration between client and server.

The lifecycle is described in the DAP spec here: https://microsoft.github.io/debug-adapter-protocol/overview#initialization with a summary in this classes description.

Implementation

@override
Future<void> initializeRequest(
  Request request,
  DartInitializeRequestArguments args,
  void Function(Capabilities) sendResponse,
) async {
  // Capture args so we can read capabilities later.
  _initializeArgs = args;

  // TODO(dantup): Capture/honor editor-specific settings like linesStartAt1
  sendResponse(Capabilities(
    exceptionBreakpointFilters: [
      ExceptionBreakpointsFilter(
        filter: 'All',
        label: 'All Exceptions',
        defaultValue: false,
      ),
      ExceptionBreakpointsFilter(
        filter: 'Unhandled',
        label: 'Uncaught Exceptions',
        defaultValue: true,
      ),
    ],
    supportsClipboardContext: true,
    supportsConditionalBreakpoints: true,
    supportsConfigurationDoneRequest: true,
    supportsDelayedStackTraceLoading: true,
    supportsEvaluateForHovers: true,
    supportsValueFormattingOptions: true,
    supportsLogPoints: true,
    supportsRestartRequest: supportsRestartRequest,
    supportsRestartFrame: true,
    supportsTerminateRequest: true,
  ));

  // This must only be sent AFTER the response!
  sendEvent(InitializedEventBody());
}