@inheritdoc
(target: ITarget)
| 140 | |
| 141 | /** @inheritdoc */ |
| 142 | public async acquireDap(target: ITarget): Promise<DapConnection> { |
| 143 | const existing = this.sessions.get(target.id()); |
| 144 | if (existing) { |
| 145 | const { connection } = await existing.promise; |
| 146 | return connection; |
| 147 | } |
| 148 | |
| 149 | const parent = target.parent(); |
| 150 | let dap: Dap.Api; |
| 151 | if (parent) { |
| 152 | const parentCnx = this.sessions.get(parent.id())?.settledValue; |
| 153 | if (!parentCnx) { |
| 154 | throw new Error('Expected parent session to have a settled value'); |
| 155 | } |
| 156 | dap = parentCnx.connection.dap(); |
| 157 | } else { |
| 158 | dap = this.dapRoot; |
| 159 | } |
| 160 | |
| 161 | const deferred = getDeferred<ISessionInfo>(); |
| 162 | this.sessions.set(target.id(), deferred); |
| 163 | |
| 164 | // don't await on this, otherwise we deadlock since the promise may not |
| 165 | // resolve until launch is finished, which requires returning from this method |
| 166 | dap |
| 167 | .startDebuggingRequest({ |
| 168 | request: target.launchConfig.request, |
| 169 | configuration: { |
| 170 | type: target.launchConfig.type, |
| 171 | name: target.name(), |
| 172 | __pendingTargetId: target.id(), |
| 173 | }, |
| 174 | }) |
| 175 | .catch(e => deferred.reject(e)); |
| 176 | |
| 177 | return deferred.promise.then(d => d.connection); |
| 178 | } |
| 179 | |
| 180 | /** @inheritdoc */ |
| 181 | public async initAdapter(adapter: DebugAdapter, target: ITarget): Promise<boolean> { |
nothing calls this directly
no test coverage detected