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

Method constructor

src/adapter/debugAdapter.ts:61–137  ·  view source on GitHub ↗
(
    dap: Dap.Api,
    private readonly asyncStackPolicy: IAsyncStackPolicy,
    private readonly launchConfig: AnyLaunchConfiguration,
    private readonly _services: Container,
  )

Source from the content-addressed store, hash-verified

59 private readonly _cdpProxyProvider = this._services.get<ICdpProxyProvider>(ICdpProxyProvider);
60
61 constructor(
62 dap: Dap.Api,
63 private readonly asyncStackPolicy: IAsyncStackPolicy,
64 private readonly launchConfig: AnyLaunchConfiguration,
65 private readonly _services: Container,
66 ) {
67 this._configurationDoneDeferred = getDeferred();
68
69 this.sourceContainer = _services.get(SourceContainer);
70
71 // It seems that the _onSetBreakpoints callback might be called while this method is being executed
72 // so we initialize this before configuring the event handlers for the dap
73 this.breakpointManager = _services.get(BreakpointManager);
74
75 const performanceProvider = _services.get<IPerformanceProvider>(IPerformanceProvider);
76 const telemetry = _services.get<ITelemetryReporter>(ITelemetryReporter);
77 telemetry.onFlush(() => {
78 telemetry.report('breakpointStats', this.breakpointManager.statisticsForTelemetry());
79 telemetry.report('statistics', this.sourceContainer.statistics());
80 });
81
82 this.dap = dap;
83 this.dap.on('initialize', params => this.onInitialize(params));
84 this.dap.on('setBreakpoints', params => this._onSetBreakpoints(params));
85 this.dap.on('setExceptionBreakpoints', params => this.setExceptionBreakpoints(params));
86 this.dap.on('configurationDone', () => this.configurationDone());
87 this.dap.on('loadedSources', () => this._onLoadedSources());
88 this.dap.on('disableSourcemap', params => this._onDisableSourcemap(params));
89 this.dap.on('source', params => this._onSource(params));
90 this.dap.on('threads', () => this._onThreads());
91 this.dap.on('stackTrace', params => this._withThread(thread => thread.stackTrace(params)));
92 this.dap.on('variables', params => this._onVariables(params));
93 this.dap.on('readMemory', params => this._onReadMemory(params));
94 this.dap.on('writeMemory', params => this._onWriteMemory(params));
95 this.dap.on('setVariable', params => this._onSetVariable(params));
96 this.dap.on('setExpression', params => this._onSetExpression(params));
97 this.dap.on('continue', () => this._withThread(thread => thread.resume()));
98 this.dap.on('pause', () => this._withThread(thread => thread.pause()));
99 this.dap.on('next', () => this._withThread(thread => thread.stepOver()));
100 this.dap.on('stepIn', params => this._withThread(thread => thread.stepInto(params.targetId)));
101 this.dap.on('stepOut', () => this._withThread(thread => thread.stepOut()));
102 this.dap.on(
103 'restartFrame',
104 params => this._withThread(thread => thread.restartFrame(params)),
105 );
106 this.dap.on('scopes', params => this._withThread(thread => thread.scopes(params)));
107 this.dap.on('evaluate', params => this.onEvaluate(params));
108 this.dap.on('completions', params => this._withThread(thread => thread.completions(params)));
109 this.dap.on('exceptionInfo', () => this._withThread(thread => thread.exceptionInfo()));
110 this.dap.on('setCustomBreakpoints', params => this.setCustomBreakpoints(params));
111 this.dap.on('toggleSkipFileStatus', params => this._toggleSkipFileStatus(params));
112 this.dap.on('toggleSkipFileStatus', params => this._toggleSkipFileStatus(params));
113 this.dap.on('prettyPrintSource', params => this._prettyPrintSource(params));
114 this.dap.on('locations', params => this._onLocations(params));
115 this.dap.on('revealPage', () => this._withThread(thread => thread.revealPage()));
116 this.dap.on(
117 'getPerformance',
118 () => this._withThread(thread => performanceProvider.retrieve(thread.cdp())),

Callers

nothing calls this directly

Calls 15

onInitializeMethod · 0.95
_onSetBreakpointsMethod · 0.95
configurationDoneMethod · 0.95
_onLoadedSourcesMethod · 0.95
_onDisableSourcemapMethod · 0.95
_onSourceMethod · 0.95
_onThreadsMethod · 0.95
_withThreadMethod · 0.95
_onVariablesMethod · 0.95
_onReadMemoryMethod · 0.95
_onWriteMemoryMethod · 0.95

Tested by

no test coverage detected