N-Way Compare & Merge is a premium, high-performance Visual Studio Code extension designed for developers who need to compare and reconcile differences across multiple files ($N \ge 2$) simultaneously.
Unlike traditional 2-way diff editors, this extension renders $N$ scroll-synchronized columns side-by-side and allows you to select any column as the Base File to align the other files against.
⚡ Key Features
- Side-by-Side N-Way Panels: Compare 2, 3, 4, or up to $N$ files simultaneously in a single view with horizontal group scrolling.
- Vertical Synchronized Scrolling: Scroll any column, and all other columns automatically scroll in lockstep, keeping corresponding lines visually aligned.
- Dynamic Alignment Engine:
- Change the Base File via a dropdown menu in the header. The alignment is calculated on-the-fly relative to your new base.
- Generates clear visual empty-line placeholders where text is added in other files relative to the base, ensuring alignments never drift.
- Interactive N-Way Merging (New!):
- One-Click Merge: Hover over any difference in comparison columns and click the merge arrows (
→or←) to instantly copy that line's content into the Base column. - Free-Form Editing: The Base column is fully editable! Double-click or click directly on any code line in the Base column to type, correct, or adjust code.
- Save Merge on Disk: Click Save Merge (or press
Ctrl+S/Cmd+Sinside the Webview) to write your merged code back to the physical file on your disk.
- One-Click Merge: Hover over any difference in comparison columns and click the merge arrows (
- Sleek Themed Workspace: Natively integrates with VS Code color variables, adjusting automatically to dark, light, high-contrast, or custom themes.
- Lightweight Code Highlighter: Built-in, high-speed regex highlighter that runs entirely offline.
- Unified Text Search: Search/filter text across all files with highlighted matches.
🛠 How to Use N-Way Compare & Merge
Direct Selection (Fastest)
- Select 2 or more files in your VS Code Explorer (using
Ctrl+ClickorShift+Click). - Right-click, and select Compare Selected Files (N-Way).
- The comparison grid will open side-by-side.
Queued Selection
- Right-click the first file and select Select for N-Way Compare.
- Repeat for additional files (you can do this across different folders).
- Open the command palette (
Ctrl+Shift+P/Cmd+Shift+P) and run Open N-Way Comparison (or select it from the context menu). - Run Clear N-Way Selection Queue when you want to start a new queue.
💻 Merging Walkthrough
- Select your target merge file as the Base File using the dropdown at the top. This column will become editable.
- Scan the adjacent columns. Differences will be highlighted in green (additions), red (deletions), and blue (modifications).
- To merge an addition or edit from a comparison file, hover your mouse over the line and click the arrow button pointing towards the base file. The text will instantly copy over.
- To edit the code manually, click on the text in the Base File column and type freely.
- Once your merge is ready, click Save Merge in the top-right corner, or press
Ctrl+S(orCmd+Son macOS) to write the changes back to your file.
🛡 License
This project is licensed under the MIT License.