Repository: vscode
Issue: Merge Conflict incorrectly removing conflict markers
Labels: bug,merge-conflict

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes/No

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
Version: 1.62.1 (user setup)
Commit: f4af3cbf5a99787542e2a30fe1fd37cd644cc31f
Date: 2021-11-05T10:57:55.946Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.18363

I believe this is likely the same issue described by #131067, but I can reliably trigger it. I can't use my own code (proprietary) to show this, but I hacked together an example using the vscode repo. (Note, I butchered the code to make this, ignore the actual contents). 
If someone knew what caused the delay between presses of "Accept", they could probably reproduce this in a much cleaner way. I did it by increasing the file length via gratuitous copy & paste, but it still was fairly short compared to my own repo.
![7355A4B6-76E1-41E4-AC65-33F8C0BDB141](https://user-images.githubusercontent.com/24679742/142043483-96fcaf93-200a-45a2-a34f-d3836bc16004.GIF)

I don't know all the inner workings of VSCode, so my terminology might be a little off, but from what I can see:
1. Pressing Accept on one of the conflict resolution lines puts the file/module into a state that begins to refresh the page to update the conflict resolution lines.
2. During whatever process is running after the previous Accept is triggered, there is a window in which you can press Accept on a different conflict marker, and it will try to process it. This causes it to incorrectly delete conflict markers. Once triggered, the conflict markers are now in an invalid state and don't process correctly. I'm guessing there is a tracking mechanism that gets desync somewhere internally.
3. Something about the background process occurring after hitting Accept can take longer than usual - Not sure if it's related to the file size, project size, or the cleanliness of the git project at the time.  The longer the process takes, however, the larger the window to trigger this bug. I can very easily trigger it in my own code, which takes ~1 second or more to finish the conflict updates.
4. To 'avoid' the failure to edit cleanly, you have to wait until the original conflict resolution line (Accept Current, Accept Incoming, etc) vanishes and the editor removes the line. Once that line vanishes, the next conflict resolution will work just fine.