I have two unsaved files in VS Code and am looking to compare them. My online searches led me to this GitHub issue from 2016: https://github.com/microsoft/vscode/issues/14501
It seems as though this feature should be available. Another VS Code development team member even validated it. However, I am struggling to come up with how would I do it?
Since the files are not saved I can’t go to the Explorer and right-click to select Select For Compare and Compare With Selected. I tried calling up the Cmd+Shift+P menu and seeing if those two options can be found there when an unsaved file editor is active. But no such options came up.
Is this feature really in VS Code?
How could the VS Code dev team member validate it without the UI elements I searched for?
Or did I search in a wrong place and the UI for selecting for compare and comparing with selected does exist in VS Code?
2
Answers
If you click on the right panel of vs Code the first tab is
explorer
, which you may see in the screenshot attached, here there is atimelines
window that holds the whole history of the page, and also stores the history of saved changes and commit changes too.I think this may help:
You have at least two options:
You can focus on of those untitled files and then use the
File: Compare Active File With...
command in the command palette, which will open a menu to select what to compare it with- at which point you can select the other untitled file you want to compare it with.The other option is to use the Explorer View’s "Open Editors" section, where you can right-click one untititled file, click the "Select for Compare" item, and then right click the one you want to compare with, and then click "Compare with Selected".