Skip to content

[WIP] Add AI edit diffs#56

Draft
omaredu wants to merge 13 commits intoerictli:mainfrom
omaredu:feat/ai-edit-diffs
Draft

[WIP] Add AI edit diffs#56
omaredu wants to merge 13 commits intoerictli:mainfrom
omaredu:feat/ai-edit-diffs

Conversation

@omaredu
Copy link
Contributor

@omaredu omaredu commented Feb 23, 2026

Important

This PR is still a work in progress. I am currently investigating bugs related to switching notes, toggling raw Markdown mode, and performing multiple consecutive edits. The UI is not finalized and will be refined after the core functionality is stable.

Description

This pull request introduces a visual AI diff indicator system for the editor, enabling users to view and interact with AI-generated changes, including additions, modifications, and deletions. It adds new UI components, editor integrations, and styling to support diff visualization and block-level rejection of changes.

The implementation depends on the newly added prosemirror-changeset package and is being integrated carefully into the existing editing workflow.

Why

The goal is to solve the diff and partial restoration features suggested in #37

AI Diff Visualization and Interaction

  • Added DiffIndicator and DiffMenu React components to visually represent and interact with AI-generated diffs in the editor. This includes block-level markers, deletion dividers, and contextual menus for rejecting changes.
  • Integrated the AiDiffIndicatorExtension and diff session state into the editor, with support for updating and rejecting individual diff blocks, as well as ensuring state resets when switching notes.

Editor and App Integration

  • Updated the main application to manage the AI diff session lifecycle, including capturing before/after document snapshots, creating a diff session, and passing it to the editor for visualization and interaction.

Preview

diff-demo.mp4

Capture and compare editor snapshots before and after AI edits
to list raw document changes for improved AI editing feedback.
Show visual blocks marking AI-generated changes in the editor with
a sidebar indicator. Includes extension plugin, styling, and editor
integration to display real-time diff markers.
Show visual "Deleted" dividers in the editor for block deletions
detected
in AI edit diffs, enhancing clarity of removed content alongside
additions
and modifications. Adjust styling and logic to support deletion anchors.
Implement block and inline decorations for AI edit diffs in the editor,
including hover effects and deleted text widgets.
Add DiffMenu component for rejecting changes.
Refactor diff logic to use AiDiffSession for improved tracking and
rendering.
Render deleted word widgets differently inside code-like blocks and
limit their length for better readability in AI diff indicators.
Split DiffIndicator logic into dedicated modules: extension,
decorations, layout, types, and a useDiffIndicatorState hook. Re-export
AiDiffIndicatorExtension and plugin keys and move decoration/layout
logic out of the main component for better separation of concerns.
@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant