* @inheritdoc
(
debugSession: TSessionImpl,
config: IPseudoAttachConfiguration,
transport: IDapTransport,
)
| 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 |
no test coverage detected