allow a customized userEvent annotation for acceptChunk and rejectChunk in the unified merge view #3

Closed
hamilton wants to merge 1 commit from unified-merge-accept-reject-custom-events into main
hamilton commented 2023-12-13 16:12:39 +01:00 (Migrated from github.com)

This PR allows for a custom userEvent to be set for acceptChunk and rejectChunk. This enables handling finer-grained programmatic accepting & rejecting while maintaining the existing userEvent behavior by default.

This PR allows for a custom `userEvent` to be set for `acceptChunk` and `rejectChunk`. This enables handling finer-grained programmatic accepting & rejecting while maintaining the existing `userEvent` behavior by default.
marijnh commented 2023-12-14 11:30:41 +01:00 (Migrated from github.com)

This seems a use case that's too specific to add functionality for. I recommend copying the code for these commands (using getChunks instead of the private ChunkField) if you need to customize them.

This seems a use case that's too specific to add functionality for. I recommend copying the code for these commands (using `getChunks` instead of the private `ChunkField`) if you need to customize them.
hamilton commented 2023-12-14 13:19:27 +01:00 (Migrated from github.com)

good idea ~ thanks!

good idea ~ thanks!
hamilton commented 2023-12-14 17:27:08 +01:00 (Migrated from github.com)

@marijnh to make my own version of these commands, I'd need access to originalDoc and updateOriginalDoc – is there a way to get these without exposing them directly? I'd be happy to submit a PR that exports these. I assume these are private for a reason.

@marijnh to make my own version of these commands, I'd need access to `originalDoc` and `updateOriginalDoc` – is there a way to get these without exposing them directly? I'd be happy to submit a PR that exports these. I assume these are private for a reason.
marijnh commented 2023-12-14 18:21:54 +01:00 (Migrated from github.com)

That's a good suggestion. Attached patch adds a getOriginalDoc function.

That's a good suggestion. Attached patch adds a `getOriginalDoc` function.
hamilton commented 2023-12-14 18:50:33 +01:00 (Migrated from github.com)

Fantastic, thank you! Is there another way to also get updateOriginalDoc? Believe this will be needed to trigger the effect when accepting.

Fantastic, thank you! Is there another way to also get `updateOriginalDoc`? Believe this will be needed to trigger the effect when accepting.
marijnh commented 2023-12-15 14:22:57 +01:00 (Migrated from github.com)

Oh, good point, it also does that. This patch exports a function for that.

Oh, good point, it also does that. This patch exports a function for that.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/merge!3
No description provided.