Repository navigation
Resolve conflicts in a click - #1882
Conversation
fregante
left a comment
There was a problem hiding this comment.
Thank you for this! I thought it was gonna be impossible!
And sorry for the many comments 😅
This comment has been minimized.
This comment has been minimized.
|
I'd resolve issues and pushed them. Thank you, I learned from your comments 😃
😨 I didn't test it on Firefox, I'll test and search around to see what we can do for it or do we have any other way |
|
Ok I think I found a solution. I'll push it here |
|
I created the base file, you can move the code in there |
There was a problem hiding this comment.
This is looking great already! I'm happy to see this working in Firefox as well!
These would be the last things I'd love to see, if manageable:
Undothat works for the whole block, instead of line-by-lineUndothat restores also the widget- Quicker CodeMirror detection.
Edit: I think this is possible by waiting for the focus event of CodeMirror (this.editor.on('focus', processConflicts)), this would replace all setTimeouts and the swapDoc listener:
- The file can be injected right away, the widget will wait for
focusbefore being activated - The same
focusevent would also work when changing file
It isn't possible, because there isn't any editor until first file load, so we cant listen
focus calls everytime user interact with other parts of page and back to editor, it also calls when user navigate between tabs, I don't know is it ok to use focus for file change or not |
Oh nice, sure it's possible
But I don't sure about this, because add/remove a widget is not a history change in CodeMirror |
The editor is there before the file load, but maybe not await elementReady('.CodeMirror'); // *Not* safeElementReady
document.head.append(...);
That makes sense, is there an |
That's fine, we can detect whether the widget was already added and avoid any further code execution. |
Unfortunately not, but there is a change event, but it calls frequently with every change |
|
I've made changes to undo whole operations, it does not bring back widget yet but as we used focus event to add resolver widget, the widget added again on focus change On initial load, we have a small issue, sometimes (because edit already gained its focus) widget does not show until next focus |
I found a solution to that, I'll push something |
Instead of going through the dom
The dom changes during the first `appendLineInfo` and the next `conflict` in the loop is no longer in the document, so we need to use the native CodeMirror loop
This comment has been minimized.
This comment has been minimized.
67a4526 to
5c377fa
Compare
|
WoW, I can't even recognize these codes 👍 👍 |
|
The undo is not working correctly. I have to undo multiple times to get back to what I initially had before pressing one the accept buttons. I tried it on the package-lock.json conflict we have in this PR, and clicking one of the buttons, causes the page to hang for 5 or more seconds for it to handle the change. The file is large, but there seems to be something slow going on. Manually fixing the text is not slow like this. Pressing "Accept both changes" creates an invalid JSON. Not sure if this is the fault of the conflict resolver or Git though. |
Indeed. It worked perfectly on small files but on the big conflict right here is slow and has a multi-step undo (probably related issues since the undoability relies on the timestamp, I think)
That's normal, package-lock conflicts are to be solved via <<<<<<<
.red {
color: red;
=======
.blue {
color: blue;
>>>>>>>
} |
|
Fixed! I used multi-selections to let the editor batch proper The problem was GitHub's listener synchronously trying to update the conflict markers after every line deletion. With a DOM that big, each deletion took 500ms+ Now the whole "Accept incoming" operation takes 80ms on that page. The only drawback is that now I'm leaving the conflict so you can test it. |
I used |
|
Thanks for this feature @farnabaz! It'll be very useful 🌈
Great! I forgot we were handling the |
Add a single bar above every conflict in the editor. Closes #341
