microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.3k stars 28.9k forks source link

Allow merging from right to left with diff arrows view #153620

Open connor4312 opened 2 years ago

connor4312 commented 2 years ago

Testing https://github.com/microsoft/vscode/issues/25887

The arrows work for merging from the left hand to the right-hand file, that's great 👍

However, there's no way to do the opposite. I was thinking I could alt or shift-click on the arrow (or at least have a context menu) to go the other direction, but I cannot.

hediet commented 2 years ago

FYI @Mingpan. Maybe we can use the EditorGutter in the merge editor to get rid of the glyphs. Then we can show arrows next to each other for both ways.

Mingpan commented 2 years ago

Thanks for the feedback!

I think right => left arrows are helpful when the left-hand-side editor is editable (e.g. in a file-to-file compare view). But they don't make sense for same-file diff views ("source control diff views"). This should be considered when implementing this.

Put this in a right-click context menu sounds doable and doesn't affect the editor experience too much (e.g. doesn't consume more horizontal space), though a nit-picking point is it is not symmetric and doesn't treat left / right arrows equal.

Maybe we can use the EditorGutter in the merge editor to get rid of the glyphs. Then we can show arrows next to each other for both ways.

Thanks for the pointer, I'll take a look at the EditorGutter and see if / how the arrows can make use of it.

connor4312 commented 2 years ago

Yea, the use case I was using for testing was "compare active file with...". I think if the LHS is readonly, then having unidirectional arrows makes sense.

gulshan commented 2 years ago

I think an option to "swap sides" in the comparison page will be good enough for me.

nbransby commented 2 years ago

In IntelliJ the arrows are added to whichever side is editable which can mean they could both appear at the sametime, also atm the arrows from the left to the right hand side appear even if the right hand file is not editable and don't do anything upon click

shef-er commented 2 years ago

Also want this feature. Wonder this feature still has not implemented

alexolog commented 2 years ago

Another vote for bidirectional copying. There is more to diff than source control.

tonoslav commented 1 year ago

I think adding just some shortcut to switch direction would be awesome, for example if you hold CTRL arrow would switch to left and do what is should

cdenneen commented 1 year ago

@Mingpan would adding the opposite direction be possible?

Also noticed that if you have a complete empty space the copy arrow works... if not it doesn't provide an option to copy what is on left to right... so for in the screenshot maybe we want to copy the format from left to right? It doesn't provide an arrow to do that. Those are only provided where complete lines are missing on the right side.

Screen Shot 2022-11-21 at 9 11 26 AM

wh0else commented 1 year ago

+1

cheezit46 commented 1 year ago

Definitely would like a left arrow.

I know we'd basically be making the Meld tool in vs-code, and I'm fine with that.

RufusVS commented 1 year ago

So I have to do the compare merge in BeyondCompare external to VSCode be able to copy-left AND copy-right? Maybe I'll look into the Meld tool until this gets "fixed". Although swapping sides may be useful, but there are many times I am moving changes in both directions. I love my BeyondCompare, but we don't need THAT much functionality.

shef-er commented 8 months ago

@hediet Any progress on this?

holdingsllc commented 7 months ago

I'm amazed that this essential feature still doesn't exist. What's going on?

kmhatre14 commented 2 months ago

+1

nemchik commented 2 months ago

It seems like the ability to swap what is on the left and right now exists, so it's possible to achieve getting changes from A to B or B to A.

kmhatre14 commented 2 months ago

How do you swap? I don't see any option when I select files to compare

nemchik commented 2 months ago

Two new unsaved files image Swap button image

So with that you can effectively "copy from right to left" by swapping (and then if you need you can swap back)

Note; I don't think you can do this with the diff editor when using it to compare changes to a file in version control. You're not comparing two files, you're comparing the current state to a previous state. The previous state (last commit) is locked in, so you can't swap in order to copy changes from current state to previous state.

nbros commented 3 weeks ago

Repeatedly swapping left and right sides to pick the right one works but I find it disorienting, I'd still much rather have two arrows pointing each side to "Copy left to right" / "Copy right to left" in the case when both sides are editable (for example when using "File: Compare Active File With...")

wwdok commented 1 week ago

It can add a column of left arrow as shown in the following red box: image