Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio : Automatically insert a space after typing if(

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!

like image 904
Robert Fraser Avatar asked Mar 22 '11 21:03

Robert Fraser


People also ask

How do I turn off auto spacing in Visual Studio?

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.

How do you add space between words in Vscode?

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.


1 Answers

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.

like image 96
dotalchemy Avatar answered Sep 22 '22 06:09

dotalchemy