I'm using Visual Studio to develop a C/C++ library. I would like to know if there is a way to customize the autoformat tool (Ctrl+K,F) so that:
It automatically break lines that are bigger than 120 columns
Format a function/method parameter the following way:
void myFunction(int parameterA,
float parameterB,
string paramterC)
Format the brackets the following way:
void myFunction()
{
// Code goes here...
}
To summarize, I want something similar to what Eclipse does with it's autoformat (Ctrl + Shift + F) that can be customized by editing a XML file.
If you are like me and like to have consistency in formatting your code, this is definitely a must to have configuration. By default, you can use VS code formatters with the shortcut Alt+Shift+F but, you can also configure it to format every time you save your file, like this:
You can personalize Visual Studio in various ways to best support your own development style and requirements. Many of your settings roam with you across Visual Studio instances—see Synchronized settings. This article briefly describes different personalizations and where you can find more information.
Enables auto formatting of the code when you save a file. Visual Studio supports auto formatting of the code with the CTRL+E,D or CTRL+E,F key shortcuts but with this extension the command 'Format Document' is executed on Save. Thanks Karen ! The Code Formatter is a 3rd party Visual Studio plugin.
For Visual Studio for Mac, see Customize the Visual Studio for Mac IDE. You can choose a default collection of settings that optimizes Visual Studio for your type of development. For more information, see Environment settings. Many personalization options are exposed through the Environment Options dialog box.
If those options are not good enough for you get UniversalIndentGUI it is a frontend for a whole slew of code formatting engines, you should be able to get the style that you want from it
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