We have a code style checker that's run before every check-in that requires that C# if statements be formatted like:
if (condition)
However, my muscle memory has already developed for typing:
if(condition)
Is there any way to get Visual Studio 2010 to automatically insert that space if I type the if without it? I know you can set it that when you paste code, it will automatically do this, but not while typing. Thanks!
Go to Tools->Options, then Text Editor-C>/C++->Formatting->Spacing and look through the options, however I do not believe that particular item is configurable. As a last resort there is an option "Automatically format statement when I type a ;" that can be turned off.
I was able to set this by simply searching in the User Settings (CTRL+SHIFT+P) for spacing and there are two separate boxes that were set to 0 for terminal and editor.
Tools > Options > Text Editor > C# > Formatting > Spacing
Then check/tick Insert space after keywords in control flow statements, which is listed under the Set other spacing options sub group.
Win.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With