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

Class Binder

src/binder.ts:83–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 * @see https://microsoft.github.io/debug-adapter-protocol/overview for control flows
82 */
83export class Binder implements IDisposable {
84 private readonly _disposables = new DisposableList();
85 private _dap: Dap.Api;
86 private _targetOrigin: ITargetOrigin;
87 private _launchParams?: AnyLaunchConfiguration;
88 private _asyncStackPolicy?: IAsyncStackPolicy;
89 private _serviceTree = new WeakMap<ITarget, Container>();
90
91 /** Root of the session tree. Undefined until a launch/attach request is received. */
92 private _root = new TreeNode(undefined);
93
94 constructor(
95 private readonly _delegate: IBinderDelegate,
96 connection: DapConnection,
97 private readonly _rootServices: Container,
98 targetOrigin: ITargetOrigin,
99 ) {
100 this._dap = connection.dap();
101 this._targetOrigin = targetOrigin;
102 this._disposables.callback(() => disposeContainer(_rootServices));
103 this._disposables.push(
104 installUnhandledErrorReporter(
105 _rootServices.get(ILogger),
106 _rootServices.get(ITelemetryReporter),
107 _rootServices.get(IsVSCode),
108 ),
109 );
110
111 connection.attachTelemetry(_rootServices.get(ITelemetryReporter));
112
113 const dap = this._dap;
114 let lastBreakpointId = 0;
115 let selfProfile: SelfProfile | undefined;
116
117 dap.on('initialize', async clientCapabilities => {
118 this._rootServices.bind(IInitializeParams).toConstantValue(clientCapabilities);
119 const capabilities = DebugAdapter.capabilities();
120 if (clientCapabilities.clientID === 'vscode') {
121 filterErrorsReportedToTelemetry();
122 }
123
124 setTimeout(() => dap.initialized({}), 0);
125 return capabilities;
126 });
127 dap.on('setExceptionBreakpoints', async () => ({}));
128 dap.on('setBreakpoints', async params => {
129 if (params.breakpoints?.length) {
130 _rootServices.get(DiagnosticToolSuggester).notifyHadBreakpoint();
131 }
132
133 return {
134 breakpoints: params.breakpoints?.map(() => ({
135 id: ++lastBreakpointId,
136 verified: false,
137 message: l10n.t('Unbound breakpoint'),
138 })) ?? [],
139 };
140 });

Callers

nothing calls this directly

Calls 5

targetListMethod · 0.95
_attachToNewTargetsMethod · 0.95
onceFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected