Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I turn off auto-formatting in VS2013 for C++?

VS2013 has added auto-formatting for C++. My personal opinion on auto-formatting is that it's ultimately harmful for developers but I have to accept not everyone agrees. What bugs me is that I can't seem to disable auto-formatting completely. I have unchecked every checkbox under Tools->Text Editor->C/C++->Formatting->General yet when I type:

void f () 

VS2013 replaces this with

void f() 

That's not the code-standard in this specific project which means I have to go back and insert a space. There are other examples where I have to fight against VS.

I don't want to change the spacing settings because

  1. I work in multiple projects with different code standards
  2. I don't believe in auto-formatting so I just want it to get out of my way

I just want VS to not modify my code automatically.

PS. I am not against that VS can format code but I want to invoke that manually

like image 477
Just another metaprogrammer Avatar asked Aug 18 '13 10:08

Just another metaprogrammer


People also ask

How do I turn off auto format or code?

Enable/Disable Format On SaveOpen up VSCode Command Palette by pressing Ctrl + Shift + P. Search and select Open Settings (UI). Just start typing and it will auto-fill. Once there's a match, you can hit enter immediately, or manually click on the right option.

How do I turn off formatting in Visual Studio?

The solution was to go to 'Tools > Options > Text Editor > Basic > VB Specific' and turn 'Pretty Listing' OFF.

How do I turn on auto indent in Visual Studio?

Auto formatting settings in Visual Studio. Show activity on this post. Select the text you want to automatically indent. Click menu Edit → Advanced → *Format Selection, or press Ctrl + K , Ctrl + F .


2 Answers

You can turn off automatic C / C++ /C# code formatting by going to the Options dialog from the Tools menu, selecting the Text EditorC / C++ / C#FormattingGeneral page, and unchecking all the boxes there. You'll still be able to manually format when all of the auto-formatting settings are turned off.

enter image description here

like image 84
Jennifer Leaf Avatar answered Oct 23 '22 22:10

Jennifer Leaf


I know this isn't exactly the answer you're looking for, but you can preserver that void f () formatting if you go to Tools > Options > Text Editor > C/C++ > Formatting > Spacing and under Spacing for function parantheses you check the option Insert space between function names and opening parentheses of argument list.

like image 30
Marius Bancila Avatar answered Oct 23 '22 23:10

Marius Bancila