1

Fairly straightforward question - When I have a merge conflict in a CSS file and use VSCode's 'accept both' option for the conflicting block, I'm often left with a CSS file that has an error right at the end because somewhere in the 10,000 lines, there is a bracket that hasn't been correctly merged.

If I'm accepting both changes (and both files are correct individually) why is one bracket left out of the newly created merge file?

How can I avoid that?

Is there a good tool to find non-paired brackets?

Cheetara
  • 529
  • 1
  • 6
  • 19
  • 1
    This would be a lot easier to answer if you gave an example of the four views: merge-base version, target branch version, source branch version, and what the "accept both" option did. (And perhaps also what you wish it would do if it isn't obvious.) – TTT Mar 07 '22 at 19:18
  • If your CSS files are anywhere near 10,000 lines then you are doing something wrong with regard to code organization. If you keep your CSS files to a reasonable size (500-700 lines max) then it should be easy to inspect the merge and if your code is indented correctly it should be easy to find the missing bracket by scrolling through the file. – bcstryker Mar 07 '22 at 19:20
  • 1
    What about just read each conflict and do the right choice, you detect issue about bracket but perhaps you lost other things. There is no magic to solve conflict – Ôrel Mar 07 '22 at 21:01
  • @TTT I could give a single example when it next arises (having just solved it and then posted this out of frustration :D ), but this happens fairly often.... In general I can't see why this should arise – Cheetara Mar 07 '22 at 21:39
  • @bcstryker Yes, but sometimes we inherit the code of others and have a client deadline where refactoring the CSS isn't an option... – Cheetara Mar 07 '22 at 21:41
  • @Ôrel That's exactly what we're doing - VSCode chunks out the conflicts, and you choose 'take theirs', 'keep ours' or 'keep both'. 'Keep both' breaks a bracket somewhere - a lot – Cheetara Mar 07 '22 at 21:42
  • Would enabling a setting [like this](https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer) help? – TTT Mar 07 '22 at 21:56

0 Answers0