When a suggested edit changes the indentation of some code (for example indenting four spaces to get proper formatting), the markdown diff often shows the changed spaces highlighted differently in each line:

diff view

This makes it unnecessarily unclear what really was edited.

Instead, all the lines should just have the first four spaces highlighted.


Instead, all the lines should just have the first four spaces highlighted.

From the next build on, this will be the case.

When creating those diffs, the diff engine doesn't really care how it distributes the added versus the unchanged space characters (technically, any way of doing it is correct). I've made a change now that forces added or removed tokens to always appear before unchanged tokens tokens that are equal. The only practical difference made by this change that I can think of is the indentation issue that you're bringing up here.


I just got this absurd example, where what (as far as I can tell) was just a suggestion adding indentation to a code block resulted in a diff that made it look as though almost all the code had been drastically rewritten:

enter image description here

This is a problem when reviewing these edits because if the user suggesting the edit has changed things other than the indentation, I need to be able to see and review them. In this case, I glanced over the diff, figured it looked like nothing but formatting had changed, and decided to trust the user's edit comment that made no mention of any changes other than code formatting.

But honestly, since I didn't carefully diff it line-by-line myself, I might have just approved all kinds of blatant vandalism, and if that's the case, then I'll probably never know that I did so.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .