Skip to content

Fat/merge conflict diff#367

Merged
amadeus merged 55 commits intomainfrom
fat/merge-conflict-diff
Mar 10, 2026
Merged

Fat/merge conflict diff#367
amadeus merged 55 commits intomainfrom
fat/merge-conflict-diff

Conversation

@fat
Copy link
Contributor

@fat fat commented Mar 3, 2026

Merge conflict built on top of diff primitive…

VSCODE (note the syntax highlighting failure)
CleanShot 2026-03-02 at 20 34 18@2x

Pierre (note the correct highlighting)
CleanShot 2026-03-02 at 20 34 36@2x

@vercel
Copy link

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierrejs-diff-demo Ready Ready Preview Mar 10, 2026 3:33am
pierrejs-docs Ready Ready Preview Mar 10, 2026 3:33am

Request Review

Copy link
Member

@amadeus amadeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in prog review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dedicated “unresolved merge conflict” diff primitive on top of the existing diffs renderer, including parsing conflict markers into a structured diff, rendering conflict-aware UI rows, and providing utilities + docs/SSR support to resolve conflicts while preserving syntax highlighting.

Changes:

  • Introduces merge-conflict parsing and resolution utilities (getMergeConflictLineTypes, parseMergeConflictDiffFromFile, resolveMergeConflict) with test coverage.
  • Adds UnresolvedFile (vanilla + React) and UnresolvedFileHunksRenderer to render conflict markers/sections with built-in action controls and optional custom utilities via slots.
  • Extends renderer infrastructure (line decorations, custom <pre> properties) and updates docs + SSR preloading (preloadUnresolvedFile) to demo/hydrate the new UI.

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/diffs/test/resolveMergeConflict.test.ts Adds tests for applying merge-conflict resolutions to raw contents.
packages/diffs/test/parseMergeConflictDiffFromFile.test.ts Adds tests ensuring conflict files are split into current/incoming views + diff metadata/actions.
packages/diffs/test/getMergeConflictLineTypes.test.ts Adds tests for marker/body classification, nested handling, and region extraction.
packages/diffs/src/utils/setWrapperNodeProps.ts Adds support for custom <pre> attributes during DOM application.
packages/diffs/src/utils/resolveMergeConflict.ts New utility to apply a merge-conflict resolution payload to file contents.
packages/diffs/src/utils/parseMergeConflictDiffFromFile.ts New utility to convert conflict-marked file contents into a synthetic diff + action metadata.
packages/diffs/src/utils/hast_utils.ts Extends gutter item creation to accept additional properties.
packages/diffs/src/utils/getMergeConflictLineTypes.ts New parser for conflict markers/stages + region extraction.
packages/diffs/src/utils/getMergeConflictActionSlotName.ts New helper to generate stable slot names for action rows.
packages/diffs/src/utils/createPreElement.ts Adds custom <pre> properties for SSR/HAST-rendered output.
packages/diffs/src/utils/arePrePropertiesEqual.ts Updates equality check to include custom <pre> properties.
packages/diffs/src/utils/areMergeConflictActionsEqual.ts Adds equality helper for merge-conflict action metadata caching.
packages/diffs/src/types.ts Introduces merge-conflict types, CustomPreProperties, and BaseDiffOptionsWithDefaults.
packages/diffs/src/style.css Adds conflict-marker/section styling and action-row UI styling.
packages/diffs/src/ssr/preloadDiffs.ts Adds SSR preload APIs for unresolved merge-conflict files and refactors common rendering flow.
packages/diffs/src/renderers/UnresolvedFileHunksRenderer.ts New renderer that decorates conflict lines and injects action rows/slots.
packages/diffs/src/renderers/DiffHunksRenderer.ts Adds line decoration hooks + custom pre properties support to enable conflict rendering overlays.
packages/diffs/src/react/utils/useUnresolvedFileInstance.ts New hook to manage UnresolvedFile instance + sequential conflict resolutions in React.
packages/diffs/src/react/utils/useFileDiffInstance.ts Minor refactor to reduce repeated ref reads.
packages/diffs/src/react/utils/renderDiffChildren.tsx Adds rendering of merge-conflict utility slot children in React.
packages/diffs/src/react/index.ts Exports React UnresolvedFile.
packages/diffs/src/react/constants.ts Adds styling constant for merge-conflict slot wrappers.
packages/diffs/src/react/UnresolvedFile.tsx New React component wrapper for unresolved merge-conflict rendering.
packages/diffs/src/managers/InteractionManager.ts Adds click targeting + dispatch for merge-conflict action buttons and accounts for action rows in layout logic.
packages/diffs/src/index.ts Exports vanilla UnresolvedFile and resolveMergeConflict.
packages/diffs/src/components/UnresolvedFile.ts New vanilla component handling uncontrolled/controlled conflict resolution flows and optional custom action rendering.
packages/diffs/src/components/FileDiff.ts Refactors renderer construction for extensibility and allows custom separator renderers to return undefined.
apps/docs/app/page.tsx Adds a merge-conflict demo section to the homepage.
apps/docs/app/docs/page.tsx Integrates merge-conflict demo + adds docs/examples for new APIs.
apps/docs/app/docs/VanillaAPI/content.mdx Documents UnresolvedFile in vanilla API docs.
apps/docs/app/docs/VanillaAPI/constants.ts Adds vanilla unresolved-file example snippet.
apps/docs/app/docs/VanillaAPI/ComponentTabs.tsx Adds an “UnresolvedFile” tab in vanilla API example UI.
apps/docs/app/docs/Utilities/content.mdx Documents resolveMergeConflict utility usage.
apps/docs/app/docs/Utilities/constants.ts Adds resolveMergeConflict example snippet.
apps/docs/app/docs/SSR/content.mdx Documents preloadUnresolvedFile.
apps/docs/app/docs/SSR/constants.ts Adds SSR preload unresolved-file example snippet.
apps/docs/app/docs/ReactAPI/content.mdx Documents React UnresolvedFile and its uncontrolled behavior.
apps/docs/app/docs/ReactAPI/constants.ts Adds React unresolved-file example snippet.
apps/docs/app/docs/ReactAPI/ComponentTabs.tsx Adds an “UnresolvedFile” tab in React API example UI.
apps/docs/app/diff-examples/MergeConflict/constants.ts Adds merge-conflict demo fixture/options.
apps/docs/app/diff-examples/MergeConflict/MergeConflict.tsx Adds client-side demo UI for resetting/toggling theme while testing the conflict renderer.
Comments suppressed due to low confidence (1)

packages/diffs/src/style.css:38

  • The "Available CSS Color Overrides" list now mentions --diffs-fg-conflict-marker-override, but the stylesheet also introduces several new conflict-related override variables (e.g. --diffs-bg-conflict-marker-override, --diffs-bg-conflict-current-override, etc.) that aren't documented in this list. To keep the inline docs accurate/discoverable, consider adding the rest of the conflict override vars that are actually supported below.
    /*
    // Available CSS Color Overrides
    --diffs-bg-buffer-override
    --diffs-bg-hover-override
    --diffs-bg-context-override
    --diffs-bg-separator-override

    --diffs-fg-number-override
    --diffs-fg-number-addition-override
    --diffs-fg-number-deletion-override
    --diffs-fg-conflict-marker-override

    --diffs-deletion-color-override
    --diffs-addition-color-override
    --diffs-modified-color-override

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@amadeus amadeus merged commit b193494 into main Mar 10, 2026
8 checks passed
@amadeus amadeus deleted the fat/merge-conflict-diff branch March 10, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants