HKC72
HKC72

Reputation: 532

How to disable adding automatically spaces (e.g.in the if condition line) in VS17

I'm using VS17 and I would like to change my coding settings so that VS stops adding spaces at e.g. if conditions in language C. I searched for enabling this option but unfortunaly I could find a formatting option.

So please help me :)

What I'm coding and what it should like afterwards:

if(varA == varB){}

What it looks like after I close the second }. VS is adding single spaces after if and between ) and {

if (varA == varB) {}

Best regards

Upvotes: 2

Views: 2834

Answers (1)

dxiv
dxiv

Reputation: 17648

The settings are language specific, and are under Text Editor in the Tools / Options dialog.

For C# for example, unchecking "insert space after keywords in control flow statements" in Text Editor / C# / Code Style / Formatting / Spacing turns off the automatic space after if, for etc.

enter image description here

For C/C++ a similar setting exists under Text Editor / C/C++ / Code Style / Formatting / Spacing "insert space between keyword and opening parenthesis in control flow statements".

Upvotes: 3

Related Questions