MCPcopy Create free account
hub / github.com/Snapchat/Valdi / createNewSession

Method createNewSession

valdi/vscode_debugger/src/sessionManager.ts:134–174  ·  view source on GitHub ↗

* @inheritdoc

(
    debugSession: TSessionImpl,
    config: IPseudoAttachConfiguration,
    transport: IDapTransport,
  )

Source from the content-addressed store, hash-verified

132 * @inheritdoc
133 */
134 public createNewSession(
135 debugSession: TSessionImpl,
136 config: IPseudoAttachConfiguration,
137 transport: IDapTransport,
138 ): Session<TSessionImpl> {
139 let session: Session<TSessionImpl>;
140
141 const pendingTargetId = config.__pendingTargetId;
142 if (pendingTargetId) {
143 const pending = this._pendingTarget.get(pendingTargetId);
144 if (!pending) {
145 throw new Error(`Cannot find target ${pendingTargetId}`);
146 }
147
148 const { target, parent } = pending;
149 session = new Session<TSessionImpl>(
150 debugSession,
151 transport,
152 parent.logger,
153 parent.sessionStates,
154 );
155
156 this._pendingTarget.delete(pendingTargetId);
157 session.debugSession.name = target.name();
158 session.listenToTarget(target);
159 const callbacks = this._sessionForTargetCallbacks.get(target);
160 this._sessionForTargetCallbacks.delete(target);
161 callbacks?.fulfill?.(session);
162 } else {
163 const root = new RootSession(
164 debugSession,
165 transport,
166 createTopLevelSessionContainer(this.globalContainer),
167 );
168 root.createBinder(this);
169 session = root;
170 }
171
172 this._sessions.set(debugSession.id, session);
173 return session;
174 }
175
176 /**
177 * @inheritdoc

Callers 2

createSessionMethod · 0.80

Calls 8

createBinderMethod · 0.95
listenToTargetMethod · 0.80
getMethod · 0.65
deleteMethod · 0.65
nameMethod · 0.65
setMethod · 0.65
fulfillMethod · 0.45

Tested by

no test coverage detected