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

Function PierreDiffView

src/ui/diff/PierreDiffView.tsx:61–418  ·  view source on GitHub ↗
({
  codeHorizontalOffset = 0,
  copySelectedRowRanges,
  copySelectedSide,
  expandedGapKeys = EMPTY_EXPANDED_GAP_KEYS,
  file,
  layout,
  onHover,
  onActiveAddNoteAffordanceChange,
  onStartUserNoteAtHunk,
  onToggleGap,
  showLineNumbers = true,
  showHunkHeaders = true,
  sourceStatus,
  wrapLines = false,
  theme,
  visibleAgentNotes = EMPTY_VISIBLE_AGENT_NOTES,
  hoverActive = true,
  hoverClearSignal = 0,
  width,
  selectedHunkIndex,
  sectionGeometry,
  shouldLoadHighlight = true,
  scrollable = true,
  visibleBodyBounds,
}: {
  codeHorizontalOffset?: number;
  copySelectedRowRanges?: Map<string, CopySelectedRowRange>;
  copySelectedSide?: "left" | "right";
  expandedGapKeys?: ReadonlySet<string>;
  file: DiffFile | undefined;
  layout: Exclude<LayoutMode, "auto">;
  onHover?: () => void;
  onActiveAddNoteAffordanceChange?: (affordance: ActiveAddNoteAffordance | null) => void;
  onStartUserNoteAtHunk?: (hunkIndex: number, target?: UserNoteLineTarget) => void;
  onToggleGap?: (gapKey: string) => void;
  showLineNumbers?: boolean;
  showHunkHeaders?: boolean;
  sourceStatus?: FileSourceStatus | undefined;
  wrapLines?: boolean;
  theme: AppTheme;
  visibleAgentNotes?: VisibleAgentNote[];
  hoverActive?: boolean;
  hoverClearSignal?: number;
  width: number;
  selectedHunkIndex: number;
  sectionGeometry?: DiffSectionGeometry;
  shouldLoadHighlight?: boolean;
  scrollable?: boolean;
  visibleBodyBounds?: VisibleBodyBounds;
})

Source from the content-addressed store, hash-verified

59
60/** Render a file diff in split or stack mode, with inline agent notes inserted between diff rows. */
61export function PierreDiffView({
62 codeHorizontalOffset = 0,
63 copySelectedRowRanges,
64 copySelectedSide,
65 expandedGapKeys = EMPTY_EXPANDED_GAP_KEYS,
66 file,
67 layout,
68 onHover,
69 onActiveAddNoteAffordanceChange,
70 onStartUserNoteAtHunk,
71 onToggleGap,
72 showLineNumbers = true,
73 showHunkHeaders = true,
74 sourceStatus,
75 wrapLines = false,
76 theme,
77 visibleAgentNotes = EMPTY_VISIBLE_AGENT_NOTES,
78 hoverActive = true,
79 hoverClearSignal = 0,
80 width,
81 selectedHunkIndex,
82 sectionGeometry,
83 shouldLoadHighlight = true,
84 scrollable = true,
85 visibleBodyBounds,
86}: {
87 codeHorizontalOffset?: number;
88 copySelectedRowRanges?: Map<string, CopySelectedRowRange>;
89 copySelectedSide?: "left" | "right";
90 expandedGapKeys?: ReadonlySet<string>;
91 file: DiffFile | undefined;
92 layout: Exclude<LayoutMode, "auto">;
93 onHover?: () => void;
94 onActiveAddNoteAffordanceChange?: (affordance: ActiveAddNoteAffordance | null) => void;
95 onStartUserNoteAtHunk?: (hunkIndex: number, target?: UserNoteLineTarget) => void;
96 onToggleGap?: (gapKey: string) => void;
97 showLineNumbers?: boolean;
98 showHunkHeaders?: boolean;
99 sourceStatus?: FileSourceStatus | undefined;
100 wrapLines?: boolean;
101 theme: AppTheme;
102 visibleAgentNotes?: VisibleAgentNote[];
103 hoverActive?: boolean;
104 hoverClearSignal?: number;
105 width: number;
106 selectedHunkIndex: number;
107 sectionGeometry?: DiffSectionGeometry;
108 shouldLoadHighlight?: boolean;
109 scrollable?: boolean;
110 visibleBodyBounds?: VisibleBodyBounds;
111}) {
112 const renderer = useRenderer();
113 const [hoveredRowKey, setHoveredRowKey] = useState<string | null>(null);
114 const hoverIdleTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
115 const previousHoverClearSignalRef = useRef(hoverClearSignal);
116
117 // Latest-value refs for upstream handlers that DiffPane/DiffSection recreate on every render.
118 // Row-level callbacks read these at invocation time, which keeps the callbacks below

Callers

nothing calls this directly

Calls 12

useHighlightedDiffFunction · 0.90
useHighlightedSourceFunction · 0.90
buildDiffSectionRowPlanFunction · 0.90
fitTextFunction · 0.90
diffMessageFunction · 0.90
reviewRowIdFunction · 0.90
plannedReviewRowVisibleFunction · 0.90
isAddNoteTargetRowFunction · 0.85
addNoteAffordanceForRowFunction · 0.85
onMethod · 0.80

Tested by

no test coverage detected