Steps to Reproduce:
Say, Initially File 1 is on the left hand side, File 2 on right, at the moment File 2 is editable, but File 1 isn't. After swapping them, now File 2 is on left, and File 1 is on right, File 1 should be editable, otherwise no much point to swap them :)
@cateyes99 You can use the setting "diffEditor.originalEditable": true as a workaround (see https://github.com/Microsoft/vscode/issues/4180). Then in all diff views, i.e. also Git changes & staging view, the left file is changeable.
A simple swap option would be helpful even if the left side is editable as some people are used to have the newer file on left side (see #13225).
@Dominik-K when i added it in VSCode 1.13, it shows Unknown configuration setting 🙄
@cateyes99 That's correct. It's only an internal setting right now (introduced with https://github.com/Microsoft/vscode/commit/326378a431896a0ca7fc397568edcd4de855feac). However, it should work as I described it.
@Dominik-K i overlooked it. After tried, found i can edit the left hand panel of the diff editor now, but can not save with inside the diff editor, so have to go to the changed file's own editor to save it.
@cateyes99 Saving the left hand panel works for me in the "Compare files" view. You can't save the source control diff's left hand as this is a file already fixed in the source control. Which diff editor did you try out?
@Dominik-K yes, i tried in Compare files. First I select one file A.cs for compare, then compare B.cs with A.cs. A.cs in the left hand side panel is editable, but press ⌘S or click Save on the File menu has no effect. Have to go the changed file's own editor to save it, or press ⌥⌘S i.e., Save all. I'm using VSCode 1.13.1 on a Mac.
@cateyes99 You're right. With the default setting "files.autoSave": "off", it is not saved. I use "files.autoSave": "onFocusChange", so the changes before I could check it (even outside of VSCode).
More importantly, Eclipse can do this. That's how I think when I use a diff: New is on the left (because it's next to the Left Panel, which is all about my local changes tree is), old is on the right.
This where a very basic functionality in any diff editor implementation i've ever seen. Would be very, very, very nice to have this soon as possible, as i'm really to dumb to choose the right file first ;)
@alexandrudima @bpasero The other issue is closed now but this one has become more popular; the stackoverflow question tied to this has a few hundred views, too. This is a small but very useful feature, is it likely to implemented at all?
I have just upgraded to 1.31.0 and now find I can no longer even choose which file is left and which is right by selecting them in the preferred order! It used to be that the order I selected the files determined left/right order, but now it's always determined by the order they are in the explorer tree (top=left, bottom=right). Help! How do I downgrade to the previous version? [edit] I got the old version here - https://code.visualstudio.com/updates/v1_30 - and the old compare behaviour is back after the downgrade, phew.
@ahmgithubahm -- I had the same issue. Using the "diffEditor.originalEditable": true setting let me keep using the new version (just have to sometimes edit on the left)
I have just upgraded to 1.31.0 and now find I can no longer even choose which file is left and which is right by selecting them in the preferred order! It used to be that the order I selected the files determined left/right order, but now it's always determined by the order they are in the explorer tree (top=left, bottom=right). Help! How do I downgrade to the previous version? [edit] I got the old version here - https://code.visualstudio.com/updates/v1_30 - and the old compare behaviour is back after the downgrade, phew.
This issue still occur in version 1.35.1.
same in 1.36.1
"diffEditor.originalEditable": true results in Unknown Configuration setting
The ability to swap diff panels would still mean a lot.
Is this really still needed now that both sides can be edited without changing any settings?
Yes, because the two sides aren't equal in a diff. There is still the underlying assumption that the right panel is the newer version. Any code changes are highlighted accordingly as additions and substractions from left to right.
In some cases however you can end up with the newer version on the left. Even without an option to change that. Being able to swap the panels would be an intuitive fix for this situation.
Got it, thanks for clarifying.
I second @KolyaKorruptis. This would definitely still be useful. For example, when using the command "Compare active file with clipboard", the clipboard always ends up on the left as the "old" file. Often, this is not what you want but no way to change that.
I second @KolyaKorruptis and @janosh. In get history when comparing a specific commit against the workspace version it always puts the workspace version on the left. If your used to the new version being on the right this is not intuitive. It would be nice to be able to switch that.
I would very much like to have the option to place the editable current version to the left and old reference version to the right. With ultrawide screen the right file is more difficult to read than the left (left version is more on the center of the screen).
I second @KolyaKorruptis and @janosh. In get history when comparing a specific commit against the workspace version it always puts the workspace version on the left. If your used to the new version being on the right this is not intuitive. It would be nice to be able to switch that.
Don't mean to spam here but I too would really love this feature to be implemented.
Cheers
Most helpful comment
Yes, because the two sides aren't equal in a diff. There is still the underlying assumption that the right panel is the newer version. Any code changes are highlighted accordingly as additions and substractions from left to right.
In some cases however you can end up with the newer version on the left. Even without an option to change that. Being able to swap the panels would be an intuitive fix for this situation.