How can I set Visual Studio to use K&R style bracketing?

前端 未结 3 522
花落未央
花落未央 2020-12-23 10:51

I really don\'t like this style of formatting:

Class AwesomeClass
{
    private static void AwesomeMethod()
    {

    }

}

Can I make it f

相关标签:
3条回答
  • 2020-12-23 11:19

    Go to Tools > Options > Text Editor > C# > Formatting > New Lines.

    In recent version of Visual Studio (at least 2017):

    Tools > Options > Text Editor > C# > Code Style > Formatting > New Lines

    Then just uncheck every option you see there.

    0 讨论(0)
  • 2020-12-23 11:23

    Tools > Options

    Check "Show all settings"

    Text Editor > C# > Formatting > New Lines

    Uncheck the settings for where you want no extra newline added. Personally I always uncheck all items in this category.

    0 讨论(0)
  • 2020-12-23 11:45

    Tools->Options->Text Editor->C/C++->Formatting->New Lines

    change all values to

    "Keep on the same line, but add a space before"

    then select a block and reformat with Ctrl + K, Ctrl + F

    0 讨论(0)
提交回复
热议问题