(sourceContainer: any)
| 453 | } |
| 454 | |
| 455 | private async retrieveSource(sourceContainer: any): Promise<string> { |
| 456 | if (!sourceContainer.source) { |
| 457 | return ""; |
| 458 | } |
| 459 | |
| 460 | const sourceRef = sourceContainer.source.sourceReference; |
| 461 | if (sourceRef && sourceRef > 0) { |
| 462 | // according to the spec, source might be ony available in a debug session |
| 463 | // not yet able to test this branch |
| 464 | const sourceResponse = |
| 465 | await vscode.debug.activeDebugSession?.customRequest("source", { |
| 466 | source: sourceContainer.source, |
| 467 | sourceReference: sourceRef, |
| 468 | }); |
| 469 | return sourceResponse.content; |
| 470 | } else if (sourceContainer.line && sourceContainer.endLine) { |
| 471 | return await this.readRangeInFile( |
| 472 | sourceContainer.source.path, |
| 473 | new vscode.Range( |
| 474 | sourceContainer.line - 1, // The line number from scope response starts from 1 |
| 475 | sourceContainer.column, |
| 476 | sourceContainer.endLine - 1, |
| 477 | sourceContainer.endColumn, |
| 478 | ), |
| 479 | ); |
| 480 | } else if (sourceContainer.line) { |
| 481 | // fall back to 5 line of context |
| 482 | return await this.readRangeInFile( |
| 483 | sourceContainer.source.path, |
| 484 | new vscode.Range( |
| 485 | Math.max(0, sourceContainer.line - 3), |
| 486 | 0, |
| 487 | sourceContainer.line + 2, |
| 488 | 0, |
| 489 | ), |
| 490 | ); |
| 491 | } else { |
| 492 | return "unavailable"; |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | private async _getRepo( |
| 497 | forDirectory: vscode.Uri, |
no test coverage detected