Skip to content

Conversation

SyedMuzamilM
Copy link
Contributor

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).

devkokooo and others added 3 commits September 15, 2025 10:43
- 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);
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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.

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.

4 participants