MCPcopy
hub / github.com/microsoft/vscode-js-debug / handle

Function handle

src/dapDebugServer.ts:102–126  ·  view source on GitHub ↗
(
      launchParams: Dap.LaunchParams | Dap.AttachParams,
    )

Source from the content-addressed store, hash-verified

100
101 return new Promise<IInitializationCollection>(resolve => {
102 const handle = async (
103 launchParams: Dap.LaunchParams | Dap.AttachParams,
104 ): Promise<Dap.LaunchResult | Dap.AttachResult> => {
105 // By spec, clients should not call launch until after ConfigurationDone...
106 // but VS Code doesn't actually do this, and breakpoints aren't sent
107 // until ConfigurationDone happens, so make sure to wait on it.
108 await configurationDone.promise;
109
110 const deferred = getDeferred<Dap.LaunchResult | Dap.AttachResult>();
111 if (!initializeParams) {
112 throw new Error(`cannot call launch/attach before initialize`);
113 }
114
115 resolve({
116 initializeParams,
117 setExceptionBreakpointsParams,
118 setBreakpointsParams,
119 customBreakpoints,
120 xhrBreakpoints,
121 launchParams: launchParams as AnyResolvingConfiguration,
122 deferred,
123 });
124
125 return deferred.promise;
126 };
127 dap.on('launch', p => handle(p));
128 dap.on('attach', handle);
129 });

Callers 1

collectInitializeFunction · 0.70

Calls 2

getDeferredFunction · 0.90
resolveFunction · 0.85

Tested by

no test coverage detected