Skip to content
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

Allow to compare 3 files #57687

Open
sguillia opened this issue Aug 31, 2018 · 22 comments
Open

Allow to compare 3 files #57687

sguillia opened this issue Aug 31, 2018 · 22 comments
Assignees
Labels
diff-editor Diff editor mode issues feature-request Request for new features or functionality

Comments

@sguillia
Copy link

sguillia commented Aug 31, 2018

VS Code allows to easily compare two files by choosing Select for compare and Compare with selected.

But we can only select two files.

diff3, kdiff3 and vimdiff do the job but I would prefer it integrated into VS Code.

This would be helpful!

Edit: would also be nice to be able to compare 4 files 😄 vimdiff and diffuse do

@vscodebot
Copy link

vscodebot bot commented Aug 31, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@sguillia
Copy link
Author

I asked on Stack overflow beforehand if any extension already does the job.

My post got downvoted and voted for close.

The issue reporter suggests to ask questions on stack overflow with VS Code tag, and I didn't want to request a feature that an extension already provides.

Could anyone explain me what I did wrong??

@chpxu
Copy link

chpxu commented Aug 31, 2018

Eh nothing's wrong, it's more of Stack Overflow's community guidelines, they want you to be as relevant as possible (hence the tag problem the reporter said) and make sure you search as thoroughly as possible, and try to be as specific as possible (I understand what you meant), and if you want it integrated into VSCode as a Feature Request, then it's fine to post your idea here!

@dbaeumer
Copy link
Member

Asking for 3 way diff support.

@alexdima alexdima added feature-request Request for new features or functionality diff-editor Diff editor mode issues labels Aug 31, 2018
@alexdima alexdima added this to the Backlog milestone Aug 31, 2018
@alexdima alexdima removed their assignment Sep 22, 2018
@bpasero bpasero changed the title [Feature request] Allow to compare 3 files Allow to compare 3 files Sep 24, 2018
@fokep
Copy link

fokep commented Jan 29, 2019

Diff on four (4) files would be great as well! It would REALLY help to justify the purchase ("investment towards productivity increase") of a 34" 3440x1440 monitor

Yes. n files. We might need two n of those monitors (for productivity).

@alexdima alexdima modified the milestones: Backlog, Backlog Candidates Oct 24, 2019
@vscodebot
Copy link

vscodebot bot commented Jan 15, 2020

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodebot
Copy link

vscodebot bot commented Jan 27, 2020

🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodebot vscodebot bot modified the milestones: Backlog Candidates, Backlog Jan 27, 2020
@vj68
Copy link

vj68 commented Jun 9, 2021

Any update on how this can be used? (diff for 3 files)

@lucasmaffazioli
Copy link

This would be very useful!

@moseleyi
Copy link

Diff for n files would be great. I have number of projects that use a base file that is nearly the same, however I would like to check which projects have custom code in it.

@Gabrieloxe
Copy link

Wondering if there is a possibility of getting this feature in 2023?

@mooserson
Copy link

Yet another n-differ hoping this makes it..

@dtrts
Copy link

dtrts commented Sep 13, 2023

Chiming in as an nth supporter wanting to diff n files :)

@Paulo-Pinto
Copy link

please

@hediet hediet self-assigned this Dec 12, 2023
@hediet
Copy link
Member

hediet commented Dec 12, 2023

VS Code now has a three way diff editor.

@hediet hediet closed this as completed Dec 12, 2023
@hediet hediet removed this from the Backlog milestone Dec 12, 2023
@srudolph-credera
Copy link

For anyone (like me 🤦‍♂️) that was accidentally watching this ticket looking for 3-way merge version 1.69 (https://code.visualstudio.com/updates/v1_69#_3-way-merge-editor) introduced the feature and there's a menu item to show the base (two actually, one for top, one for center). See: #155277.

@martinvonz
Copy link

@srudolph-credera, that seems to describe the 3-way merge editor (for merging a base and two sides, I would think).

@hediet, can you clarify how one opens the 3-way diff editor? Which version was it added in?

@srudolph-credera
Copy link

@srudolph-credera, that seems to describe the 3-way merge editor (for merging a base and two sides, I would think).

@hediet, can you clarify how one opens the 3-way diff editor? Which version was it added in?

Yes, indeed - I had mistakenly conflated them and wanted to help anyone else that had similarly done so. In figuring out what had been added to VS Code, I too could not find the 3-way diff support announcement/UI. I wonder if it got conflated with being able to show multiple 2-way diffs in the same pane, which was just released in preview: https://code.visualstudio.com/updates/v1_85#_multifile-diff-editor.

@martinvonz
Copy link

I wonder if it got conflated with being able to show multiple 2-way diffs in the same pane, which was just released in preview: https://code.visualstudio.com/updates/v1_85#_multifile-diff-editor.

Yeah, could be. Incidentally, the combination of that feature with 3-way diffs would be useful for us for giving the user a nice UI for splitting commits (martinvonz/jj#1155). And ideally it can be started from the CLI. So that's what I'm really hoping for.

@hediet
Copy link
Member

hediet commented Dec 18, 2023

My mistake, I thought 3 way diff editor would refer to 3 way merge editor.

Can you describe the uses cases for a 3 way diff editor? How would they be diffed? A vs B and C vs B? or A vs B and B vs C, while aligning the two Bs?

@hediet hediet reopened this Dec 18, 2023
@martinvonz
Copy link

I mentioned splitting commits above. You can use the same interface for something like git commit -i. I don't know that use cases others have in mind.

For splitting commits, we would want the content from the parent commit on the left, the content from the commit itself on the right, and the result (output) in the middle. We currently let users split commits by letting them edit the right pane in a 2-way diff instead. I think it would be useful to have the separate output in the middle, so you can compare that to the final state on the right.

@hediet
Copy link
Member

hediet commented Feb 23, 2024

The complicated part of a 3 file diff editor is to compute the line alignments:
Given the diffs between A<->B and B<->C, each as { orig: Range, mod: Range }[] (Range having a start/end lineNumber/column), how do I compute the alignment-spacers (in form of { afterLineNumber: number, heightInLines: number }[]) for A, B and C, such that after inserting these spacers, unmodified lines are aligned (and modified lines are aligned heuristically)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diff-editor Diff editor mode issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests