microsoft / microsoft/vscode

Add native "Swap Sides" button in Diff Editor and optimize "Compare with Clipboard" UX

Open
#330,562 0 comments 1 reaction 1 assignee Claimed by @hediet View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

# Feature Request: Add native "Swap Sides" button in Diff Editor and optimize "Compare with Clipboard" UX

### Is your feature request related to a problem? Please describe.

The current manual comparison workflow in VS Code is highly counter-intuitive and often results in a "reversed" comparison view, creating unnecessary cognitive load for developers.

1. **No "Swap Sides" button:** Once a diff view is opened, there is no native way to swap the left (Base) and right (Modified) panes. If the comparison starts in the "wrong" order, the user is forced to close the tab and restart the process.
2. **Counter-intuitive Clipboard Logic:** In most "Compare with Clipboard" workflows, the clipboard is treated as the "Base" (Left) and the current file as the "Modified" (Right). In real-world scenarios, developers often copy **newer** code snippets to the clipboard to compare against **older** local files. This results in the new code being marked as "Deleted" (Red) and the old code as "Added" (Green).
3. **Productivity Killer:** Developers have to perform "mental color inversion" to understand what they actually changed, or waste time creating temporary files just to get the order right.

### Describe the solution you'd like

1. **Native "Swap Sides" Icon:** Add a toggle button in the Diff Editor's title bar (next to the "Inline View" toggle) to instantly swap the contents of the left and right panes.
2. **Configurable Clipboard Comparison:** Provide a setting (e.g., `diffEditor.clipboardComparisonPosition: "left" | "right"`) to allow users to define whether the clipboard should be the source or the target by default.
3. **Native Folder Comparison:** Implement a built-in side-by-side directory tree comparison to reduce reliance on third-party extensions for basic file-system auditing.

### Describe alternatives you've considered

- **Third-party extensions:** Extensions like `Partial Diff` or `Swap Diff` attempt to solve this, but they often struggle with virtual documents (like clipboard buffers) or fail to provide a seamless UI experience.
- **Manual Workaround:** Creating an `untitled` file, pasting clipboard content, and then using "Select for Compare" vs "Compare with Selected." This is far too many steps for a frequent task.

### Additional context

Professional comparison tools (like Beyond Compare or JetBrains IDEs) have included "Swap Sides" functionality for decades. As a leading code editor, VS Code's diff engine should cater to manual workflows as much as it does to Git workflows. Modern competitors (like Cursor) are already moving towards more intuitive "Review/Apply" models that avoid this "left-right" confusion entirely.

***

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.