-
Notifications
You must be signed in to change notification settings - Fork 84
Editor: Inline Git Diff Rendering with Context Menu Toggle #343
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
base: master
Are you sure you want to change the base?
Conversation
- Add showInlineDiff setting with actions\n- Wire context menu toggle with GitMerge icon\n- Default to off; allows per-file inline diff viewing
- Build unified lines sequence with diff + buffer\n- Pass diff context to LineWithContent and gutter\n- Add styles for added/removed diff backgrounds\n- Preserve selection and virtual scrolling behavior
- Fetch diff on file open and pass to openBuffer\n- Maintain diffData in buffer; refresh after saves\n- Expose diffData via editor view store for rendering
}; | ||
|
||
// Debounce updates to avoid frequent diff calculations while typing | ||
timer = setTimeout(run, 500); |
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.
Instead of doing that every 0.5 seconds, why not do it on save of the buffer?
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.
It is because when you are editing the file and havn’t saved the file yet. It will still show you the git diff based upon the buffer changes
@@ -55,7 +60,7 @@ export const LineGutter = ({ | |||
className={cn("gutter-decoration", decoration.className)} | |||
style={{ | |||
position: "absolute", | |||
left: "2px", // Small gap from left edge | |||
left: "-4px", // Small gap from left edge |
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.
this makes an inverted gap I guess?
this comment can be removed
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.
It sticks the git gutter to the left end this way. Will see if there is something better that can be done.
Pull Request
Adds inline Git diff rendering in the editor, gated by a new setting and context menu toggle. Shows added/removed lines inline with background cues; supports live updates while typing.
Toggle via editor context menu or programmatically via setShowInlineDiff(true/false).