| 499 | } |
| 500 | |
| 501 | public async getDebugSession(): Promise<DartDebugSessionInformation | undefined> { |
| 502 | if (debugSessions.length === 0) { |
| 503 | this.logger.info("No debug session to use!"); |
| 504 | return undefined; |
| 505 | } else if (debugSessions.length === 1) { |
| 506 | this.logger.info("Using only available debug session"); |
| 507 | return debugSessions[0]; |
| 508 | } else { |
| 509 | this.logger.info("Multiple debug sessions available, will prompt user:"); |
| 510 | |
| 511 | const sessions = debugSessions.map((s) => ({ |
| 512 | description: s.session.workspaceFolder ? s.session.workspaceFolder.name : undefined, |
| 513 | detail: s.session.configuration.deviceName || `Started ${s.sessionStart.toLocaleTimeString()}`, |
| 514 | label: s.session.name, |
| 515 | session: s, |
| 516 | })); |
| 517 | |
| 518 | for (const session of sessions) |
| 519 | this.logger.info(`${session.label} ${session.description} (${session.detail})`); |
| 520 | |
| 521 | const selectedItem = await vs.window.showQuickPick(sessions, { placeHolder: "Which debug session?" }); |
| 522 | |
| 523 | return selectedItem?.session; |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | public handleBreakpointChange(e: vs.BreakpointsChangeEvent): void { |
| 528 | if (this.hasPromptedAboutDebugSettings) |