Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
can you write a bit about the architecture on this? to help me review it better? |
5e6c1ca to
151785f
Compare
|
| @@ -0,0 +1,35 @@ | |||
| import type { PreloadFileOptions } from '@pierre/diffs/ssr'; | |||
There was a problem hiding this comment.
simple conflict example…
| </ButtonGroup> | ||
| </div> | ||
|
|
||
| <File |
There was a problem hiding this comment.
conflicts are auto detected, ui is auto displayed, and conflict resolution is auto handled (similar to hunk divider logic)
| this.options = { ...this.options, ...options }; | ||
| } | ||
|
|
||
| private getInteractionManagerOptions(options: FileOptions<LAnnotation>) { |
There was a problem hiding this comment.
setup/cleanup weren't provided by default interaction options, so we just set them to our conflict listener actions
| }; | ||
| } | ||
|
|
||
| private getFileRendererOptions( |
There was a problem hiding this comment.
this is annoying, but basically is for the fancy mergeConflictActions
| return; | ||
| } | ||
|
|
||
| const conflictIndex = Number.parseInt( |
There was a problem hiding this comment.
each mergeConflict instance has an index. We look up when index is firing here to make sure we resolve the correct region
| event.preventDefault(); | ||
|
|
||
| const payload = { resolution, conflict }; | ||
| if (this.options.onMergeConflictAction != null) { |
There was a problem hiding this comment.
if people provide this, we let them decide what to do… otherwise just resolve internally
| return true; | ||
| } | ||
|
|
||
| private getEffectiveFile(file: FileContents): FileContents { |
There was a problem hiding this comment.
if we're managing the file state in a controlled way, we make decisions on what content to render here
| }; | ||
| } | ||
|
|
||
| private resolveMergeConflictInternally( |
There was a problem hiding this comment.
handle the merge conflict (default)
| } | ||
| this.annotationCache.clear(); | ||
|
|
||
| for (const { element } of this.mergeConflictActionCache.values()) { |
There was a problem hiding this comment.
logic matches annotaitonCache above
| return lineCache.lines; | ||
| } | ||
|
|
||
| public getMergeConflictRegions( |
There was a problem hiding this comment.
Helpers for working with mergeconflicts…
| rowCount++; | ||
|
|
||
| if (mergeConflictActionType !== 'none') { | ||
| const mergeConflictActions = |
There was a problem hiding this comment.
create render ui and inject it
| this.file, | ||
| renderRange | ||
| ); | ||
| for (const conflict of conflicts) { |
There was a problem hiding this comment.
append the slots for each merge conflict
| @@ -0,0 +1,114 @@ | |||
| import type { MergeConflictRegion } from '../types'; | |||
|
|
|||
| export type MergeConflictLineType = | |||
There was a problem hiding this comment.
bunch of parsing logic for merge conflicts, etc.
| color-mix(in lab, var(--diffs-bg-context) 60%, var(--diffs-bg)) | ||
| ) | ||
| ); | ||
| --diffs-bg-conflict-marker: var( |
There was a problem hiding this comment.
styles for merge conflict markers, etc
Lots of people asking for this…
CleanShot.2026-02-24.at.22.31.12.mp4