Skip to content

Explore UX for three-way merge #146091

Closed
Closed

Description

We're exploring what it could look like to enable a three-way merge workflow in VS Code. Here are some initial ideas to get the ball rolling 👍

Prototype

Here's a brief walkthrough where I set up a simple merge conflict and resolve it with a three-way merge editor:

three-way-merge-walkthrough-converted.2.mp4

Main views

Here are some quick screenshots from the prototype above:

Entry point

I've been exploring the idea of having multiple entry points from a merge conflict state. One is via the existing codelens actions ("Preview Merge")...

entry-point-codelens

..and another via the SCM where there could be an icon button (icon here is just a placeholder) on the file that has conflicts:

entry-point-scm

Preview merge

Here's what the merge editor preview could look like. Here it features a mixed layout with the branches on top and the resulting code below. The branch editors are read-only while the result editor is editable.

default-state

With selections

Here are two examples where selections have been made. One with a selections from different conflicts on each branch:

with-selections

...and another showing the same changes being picked on both branches:

accept-both-changes

Feedback and ideas welcome!

cc @misolori Alberto Elizondo (@albertelo) Ladislau Szomoru (@lszomoru) Peng Lyu (@rebornix)

Activity

  1. added
    ux
    merge-conflict
    on Mar 26, 2022
  2. Snailedlt commented on Mar 26, 2022

    @Snailedlt

    Would be nice to see what branch incoming and current branches are.
    I always struggle to remember which one is incoming and whoch one is current.

    Maybe something like showing the branchname in parenthesis next to current/incoming, or showing the branchname on hover would be a good option?

    Edit:
    Really looking forward to this btw! If the implementation is good I'll fully transition over to vscode for most of my projects!

  3. hawkticehurst commented on Mar 26, 2022

    @hawkticehurst
    Member

    Feedback:

    Entry point:
    Why not have both? I personally question if I would have noticed either of the entry points that you demonstrated (or at least I think it would've taken me a while to notice), so having multiple opportunities to discover the new feature feels better to me than aligning on one of them.

    Preview merge:
    I love the mixed layout view, but more generally think that offering multiple layouts is the way to go.

    One potential nit is the "inconsistency" of panel order between the horizontal and vertical layouts––I was expecting the results tab to be in the middle of the horizontal layout based on you demoing the vertical layout first. With that said, I could kind of see how you were maybe trying to align the mixed layout and horizontal layouts by having the results on the bottom?

    I don't think I have a strong opinion about what the horizontal/vertical layout order should be (since again I can see myself almost exclusively using the mixed layout) but probably worth discussing this a bit more/getting community feedback on. Or maybe even giving the option to let people adjust the vertical/horizontal layout order to suit their preferences?

    With selections:

    I actually really like the usage of checkboxes as a mechanism for selecting lines of code (iirc this is not done elsewhere in VS Code right?). I personally think it's a really clear UI/UX model.

    To offer another suggestion that came to mind while watching this: a visually cleaner (but potentially less intuitive) model could be to remove the checkboxes and simply click on the highlighted lines of code you want to choose from the incoming and current panels (since they are read-only). I almost imagine it as a sort of toggle button-esque experience since you've already designed a checked (higher opacity colors/text) and unchecked (lower opacity colors/text) state for the lines of code themselves.

    I still think I prefer the usage of checkboxes though.

    Misc:

    Setting to make this a default
    I love what you've presented so much that I can easily see myself wanting this to be the default way I manage merge conflicts in VS Code (if it's implemented), so I just want to toss in a formal request that a setting to make three-way merge the default view when managing merge conflicts be added as well. Please and thank you 🙏😊

    Icon buttons are no longer icon buttons?
    More of a concern for future webview UI toolkit work, but I just wanted to make sure that there was an intentional decision to break the conventions of the icon button to include text in the top right corner of each panel?

    I personally really like how it looks (compared to using a secondary button for example) and think the addition of text is a really important and useful way of distinguishing between the actions of each panel. But again just want to make sure this an intentional shift in how the icon button style is used?

  4. hawkticehurst commented on Mar 26, 2022

    @hawkticehurst
    Member

    Would be nice to see what branch incoming and current branches are.

    Jørgen Kalsnes Hagen (@Snailedlt) I think that's already been included in the design 😊

    three-way-merge

  5. bpasero commented on Mar 26, 2022

    @bpasero
    Contributor

    David Dossett (@daviddossett) really like it and seems to pretty much match Visual Studio in terms of UX which I felt was already a great UI when I had used it.

    Can we also make sure to get VS behaviour of auto-picking every change that can be merged without conflicts, such as in this example where a change is selected for getting applied automatically since it does not result in conflicts:

    image

    I think another entry point could be a prominent action in the editor toolbar to open the merge editor. Nevertheless, I think all the entry points you suggest work for me. We probably also want a setting to let the user choose to always open the merge editor by default when opening a file with merge markers. I personally would not want to always having to click on the entry point to get into this mode, I would want it always.

    Have we thought about how to represent a change in a line? Throwing in some ideas from others:

    image

    image

    The reason I bring this up is #25887, where people ask for a way to take changes from left or right even when just comparing 2 files. I think if we solve this for the merge editor, the same solution could be used for diff editors too?

  6. Snailedlt commented on Mar 26, 2022

    @Snailedlt
  7. flumacs commented on Mar 28, 2022

    @flumacs

    I think another entry point could be a prominent action in the editor toolbar to open the merge editor. Nevertheless, I think all the entry points you suggest work for me. We probably also want a setting to let the user choose to always open the merge editor by default when opening a file with merge markers. I personally would not want to always having to click on the entry point to get into this mode, I would want it always.

    similarly to what Benjamin Pasero (@bpasero) said, would it be possible to open this way all the conflicting files - by default - with a simple command within the CLI ?

  8. bpasero commented on Mar 28, 2022

    @bpasero
    Contributor

    👍 , I think the requirements for the command line are captured in #5770 and we want to make sure that is supported.

  9. Zerotask commented on Mar 28, 2022

    @Zerotask

    It would be great to see how many remaining conflicts exists (and how many got resolved).
    By clicking on the "x Conflicts remaining" it would jump to the next conflict. This can be especially useful for large files.

    Example:

    a

  10. isidorn commented on Mar 28, 2022

    @isidorn

    Love the direction David Dossett (@daviddossett) 👏
    Some feedback I already shared, just to repeat here for transparency:

    • You are suggesting that we introduce a new editor title area. I think this works for this use case, not sure if we could get away without this?

    fyi for editor Alexandru Dima (@alexdima) Henning Dieterichs (@hediet), for scm thoughts Ladislau Szomoru (@lszomoru) João Moreno (@joaomoreno)

  11. miguelsolorio commented on Mar 28, 2022

    @miguelsolorio
    Contributor

    Overall, really digging the design and direction! I do think we'll need to have a separate exploration around improving the codelenses for the conflicts as the multiple actions can be hard to comprehend quickly.

    I just wanted to make sure that there was an intentional decision to break the conventions of the icon button to include text in the top right corner of each panel?

    +1 to this thought, we also already use a "Merge" button action for settings sync so we should make both of these button styles consistent either way we go. I'm more inclined to go with button style to avoid introducing another style (though it is used in some areas like the notebook toolbar).

    CleanShot 2022-03-28 at 11 20 48@2x

  12. 26 remaining items

  13. hediet commented on Apr 19, 2022

    @hediet
    Member

    While most of the time I find them sufficient, for some problematic conflicts I'd like to edit the source to avoid seeing insignificant conflicts and get a clearer view on more important areas.

    Do you happen to have a real world example? A screen recording would be amazing!

  14. AnrDaemon commented on Apr 19, 2022

    @AnrDaemon

    Consider a class file where you and your colleague added a new method each and modified one of the existing methods.
    The new methods are clear additions, and the modified method is a conflicting change.
    Merging all changes into common version would leave change marks in 3 places on each source panel. While actually only one change is significant.

  15. JuanmaMenendez commented on May 4, 2022

    @JuanmaMenendez

    We need much space as possible, will be better if we open the conflict solving view in a Modal that covers the full screen (or most of it 80%) and set the "column layout" mode by default as this is the mode clearest to understand by far.

    The merge conflict window of WebStorm is perfect, we should use it as a close reference.

  16. IllusionMH commented on May 5, 2022

    @IllusionMH
    Contributor

    Floating windows aren't here yet #10121

  17. AnrDaemon commented on May 5, 2022

    @AnrDaemon

    merge conflict window of WebStorm

    Dare to add a screenshot?

  18. locked as off topic and limited conversation to collaborators on May 5, 2022
  19. isidorn commented on May 5, 2022

    @isidorn

    Locking conversation for now. Thank you very much for your feedback. We will keep this issue updated once we have more details.

  20. daviddossett commented on Jun 29, 2022

    @daviddossett
    CollaboratorAuthor

    Closing now that this is available as an experimental feature via "git.mergeEditor": true.

    Tracking specific issues with the merge-editor label going forward 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

merge-conflictmerge-editorux

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions