The Procrustean bed of Resharper formatting

I was playing with some Javascript in Visual Studio, and I found that it gets annoyingly reformatted every time I end a statement or a block. Visual Studio formatting options have a choice of disabling auto-format, but Resharper is not that generous. All I get to choose is how the code will be auto-formatted, but there is no option to leave the formatting alone. This applies to any language, not just Javacsript.

E.g., consider this piece of code:

return (sorted[len/2-1] + sorted[len/2]) / 2;

I like it the way it is, but with Resharper the only options I get is no spaces around binary operators, i.e.

return (sorted[len/2-1]+sorted[len/2])/2;

or spaces around every binary operator:

return (sorted[len / 2 - 1] + sorted[len / 2]) / 2;

I like neither: the first one is too terse, the second one is too sparse, but that’s the only two choices I get if Resharper is installed. Quick googling reveals that ‘leave my code alone’ option has been requested several times in the past, but JetBrains insists that uniform formatting is good for your health. This thread is a typical example:

User: I have my assignments neatly formatted and don’t want Resharper to ruin it.
JetBrains: The main problem with such formatting style is that it is EXTEMELY hard to maintain

That is, they decided that they know better how to format your code, and you all you can do is to pick a party line and stick to it. Fooling around is not allowed.

Leave a Reply

Your email address will not be published. Required fields are marked *