-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: diff-view-v2-no-conflict #1335
Conversation
- Implemented a new Diff view in the Workbench to track file changes - Added file history tracking with version control and change tracking - Created a FileModifiedDropdown to browse and manage modified files - Enhanced ActionRunner to support file history persistence - Updated Workbench and BaseChat components to support new diff view functionality - Added support for inline and side-by-side diff view modes
I'm done here if you have anything to talk about now is the time! @thecodacus @leex279 @coleam00 @wonderwhy-er @dustinwloring1988 @Stijnus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Everything working :) Nice work.
@xKevIsDev can you verfiy/check the code part as well and merge?
that is pretty cool, testing this out just now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on my end. This is a awesome feature thanks @Toddyclipsgg, Merging now.
Thanks for your contribution @Toddyclipsgg! I had to revert this PR due to a build issue, but the fix is straightforward. Could you please submit a new PR with these changes:
'module': {},
Everything else in your changes looks great! The new PR should be identical to this one with these adjustments. Please make sure to test the build locally before submitting. Let me know if you need any help with the new PR. 👍 |
Overview
This pull request introduces a new
DiffView
component (app/components/workbench/DiffView.tsx
) to the Workbench, enabling users to visually compare changes in files. The component supports both inline and side-by-side diff views, handles binary files, large files, and identical files gracefully, and integrates with the application's file history and state management. It uses thediff
library for efficient diffing andshiki
for syntax highlighting.Key Features & Functionality
shiki
to provide syntax highlighting for the diff view, improving readability.DiffView
component conditionally renders eitherInlineDiffComparison
orSideBySideComparison
based on thediffViewMode
prop. These sub-components handle the actual rendering of the diffs.NoChangesView
is rendered.State Management and Data Flow
nanostores
for state management (workbenchStore
).workbenchStore
.fileHistory
) and updates it whenever the current document changes.processChanges
function calculates the diff and determines if there are changes, handling binary/large files and identical content.Styling
app/styles/diff-view.css
for styling the diff view.Visual Diagram
Explanation of the Diagram:
Workbench.client.tsx
component.Workbench.client.tsx
interacts with theworkbenchStore
, which holds the application's state, including the selected file, current document, file map, and unsaved files.Workbench.client.tsx
renders theDiffView.tsx
component.DiffView.tsx
receives data from theworkbenchStore
and determines which diff mode to display (inline or side-by-side).processChanges
function (using thediff
library) calculates the diff between the original and current file content.shiki
for highlighting) or theNoChangesView
are rendered.DiffView.tsx
also manages and interacts with theFileHistory
state.Meu.Video-1.mp4