MCPcopy Index your code
hub / github.com/modem-dev/hunk / buildDiffSectionRowPlan

Function buildDiffSectionRowPlan

src/ui/diff/diffSectionRowPlan.ts:47–84  ·  view source on GitHub ↗
({
  expandedKeys = EMPTY_EXPANDED_GAP_KEYS,
  file,
  highlightedDiff = null,
  layout,
  showHunkHeaders,
  sourceLineSpans,
  sourceStatus,
  theme,
  visibleAgentNotes = EMPTY_VISIBLE_AGENT_NOTES,
}: BuildDiffSectionRowPlanOptions)

Source from the content-addressed store, hash-verified

45
46/** Build the shared file-level diff plan consumed by rendering and geometry measurement. */
47export 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}

Callers 2

PierreDiffViewFunction · 0.90

Calls 5

expandCollapsedRowsFunction · 0.90
findMaxLineNumberInRowsFunction · 0.90
findMaxLineNumberFunction · 0.90
buildReviewRenderPlanFunction · 0.90
buildBaseRowsFunction · 0.85

Tested by

no test coverage detected