({
expandedKeys = EMPTY_EXPANDED_GAP_KEYS,
file,
highlightedDiff = null,
layout,
showHunkHeaders,
sourceLineSpans,
sourceStatus,
theme,
visibleAgentNotes = EMPTY_VISIBLE_AGENT_NOTES,
}: BuildDiffSectionRowPlanOptions)
| 45 | |
| 46 | /** Build the shared file-level diff plan consumed by rendering and geometry measurement. */ |
| 47 | export function buildDiffSectionRowPlan({ |
| 48 | expandedKeys = EMPTY_EXPANDED_GAP_KEYS, |
| 49 | file, |
| 50 | highlightedDiff = null, |
| 51 | layout, |
| 52 | showHunkHeaders, |
| 53 | sourceLineSpans, |
| 54 | sourceStatus, |
| 55 | theme, |
| 56 | visibleAgentNotes = EMPTY_VISIBLE_AGENT_NOTES, |
| 57 | }: BuildDiffSectionRowPlanOptions): DiffSectionRowPlan { |
| 58 | if (!file) { |
| 59 | return { |
| 60 | lineNumberDigits: 1, |
| 61 | plannedRows: [], |
| 62 | }; |
| 63 | } |
| 64 | |
| 65 | const baseRows = buildBaseRows(file, layout, highlightedDiff, theme); |
| 66 | const expansionSide = file.metadata.type === "deleted" ? "old" : "new"; |
| 67 | const rows = expandCollapsedRows(baseRows, { |
| 68 | layout, |
| 69 | expandedKeys, |
| 70 | sourceLineSpans, |
| 71 | sourceStatus, |
| 72 | side: expansionSide, |
| 73 | }); |
| 74 | |
| 75 | return { |
| 76 | lineNumberDigits: String(findMaxLineNumberInRows(rows, findMaxLineNumber(file))).length, |
| 77 | plannedRows: buildReviewRenderPlan({ |
| 78 | fileId: file.id, |
| 79 | rows, |
| 80 | showHunkHeaders, |
| 81 | visibleAgentNotes, |
| 82 | }), |
| 83 | }; |
| 84 | } |
no test coverage detected